Read JSON with infinity in R
I'm looking for a way to read a matrix containing an infinite value that is encoded in a JSON file into R. I'm currently getting the furthest using the RJSONIO library for this (rjson and rjsonlite...
View Articlecannot install R tseries, quadprog ,xts packages in Linux
I am using R version 3.4.0I'm trying to install tseries package on linux machine:install.packages('https://cran.cnr.berkeley.edu/src/contrib/tseries_0.10-42.tar.gz',dependencies = TRUE,repos =...
View ArticleClustering many datasets R by 2 variables
I have 15 dataframes their structure is similar : (id,v1,v2) What I want is to cluster them based on V1 and V2 Sample Data from df1:ID, V1, V2 1, 0.5, 25 2, 0.3, 2
View Articlefilter based on numerous variables
I'm trying to filter a large data set by a few different variables. Here's a dummy dataset to show what I mean:df -> data.frame(game_id = c(1,1,2,2,3,3,4,4,5,5,6,6), team =...
View ArticleGeneral way to display or render html in RStudio (just as though it were in a...
Suppose we have some HTML, obviously we could write it to a file and open it in a browser, but is there a simpler way to render it inside RStudio? my_html <- "<h1>Here's some HTML</h1>...
View ArticleMatch strings using regular expressions but ignore (not exclude) certain...
I'm trying to find a way to match certain strings within a dataset, but ignore (not exclude) some expressions that contain a match.clin_pres <- c("Patient A received yellow fever vaccine, and had a...
View ArticleTaking a value from another column if column value == "character(0)"
In the following data:library(stringr) library(purrr) entry <- c("P17-Nationalist Revolutionary Movement-Free Bolivia Movement (Movimiento Nacionalista Revolucionario [MNR] - Movimiento Bolivia...
View ArticleCharacter subtraction and loop
I do have many sequences which consists 0,1 and it is imported into R as character. The seq looks like as below:...
View ArticleHow do I fill the space between multiple line segments in ggplot?
Suppose I have the following plot in ggplot2:p <- ggplot() + geom_point(aes(x=15,y=50),shape=19,fill="gray0", size=5)+ geom_point(aes(x=28, y=75),shape=19, fill="gray0", size=5)+...
View ArticleHow do I edit the dendrogram whilst using heatmap.2 function in r
I am trying to create a heatmap to represent the change of gene expression over a period of time. the code I have used is this: coul <- colorRampPalette(brewer.pal(8, "Reds"))(25) heatmap.2(dm,...
View ArticleThe right way of to Plot Actual vs Predicted SVM Regression
I am building an SVM regression model using caret package, however, I am not sure what is the best approach to plot predicted vs actual values. I have the code below. You can reproduce the output by...
View ArticleWhy I cant get n.tree parameter value in Caret package
I have a question regarding the Caret package to optimize the hyperparameters, such as random search for tuning the parameters of random forest. I run the following code but it gives better results...
View ArticleR boxplot - how to normalize against given high and low limits instead of min...
I have several measurements, which need to be presented in same boxplot chart, despite having completely different scales. Each group (=measurement type) has their own specific high and low acceptance...
View Article2by2 vs chisq.test functions
Probably a very basic stats question:I've applied the 2by2 (from the epiR library) function with the chisq.test to the same 2x2 contingency table but I get different X-squared and p-values.I use the...
View ArticleHow can I change the default colors of the density in gghistogram() in R?
I want to update the default colors of my ggplot2 plots in R to seablue <-rgb(0,0.6,0.82) lightred <-rgb(0.8,0,0) where seablue should be the color of the first line and lightred should be the...
View ArticleError in asMethod(object) : is an unknown item label error
I am doing association analysis using R.This is the code I am using to generate rules:rules <- apriori(trans, parameter = list(supp = .07,conf = 0.50,smax=6,minlen=3,maxlen=9,target = "rules")) This...
View ArticleWrong results due to NaN (package InfoTrad)
I'm trying to use a package called InfoTrad. I tried to compute an example given, but it doesn't produce the same results for me. Could the computing capacity be a reason for this? I get a bunch of...
View ArticleHow do you proceed when "Sign in with Google temporarily disabled for this app"?
I am trying to use the googlesheets package in R, but whenever I am prompted to sign into my Google account following gs_ls() or gs_auth() commands I receive an error saying "Sign in with Google...
View ArticleR Studio - package googlesheets does not work anymore
Hi I want to use the package "googlesheets" in R but when i try to authenticate than i get the error message from google: "Sign in with Google temporarily disabled for this app This app has not yet...
View ArticleFunction to loop through partial dependence command in R?
I'm trying to write a function that will calculate the partial dependence of all the variables in a model and store them in a data frame. But I'm new to loops in R and I'm not sure how to achieve this....
View Article