R Shiny - Tracking the active tab in a tabset using JQuery
The app below contains two vertical tabsets. I would like to keep track of the active tab for each. I am using the following JQuery function to do this:function getActiveTab(ns, id) { $('#' + ns +...
View ArticleWhat is the correct/standard way to check if difference is smaller than...
I often end up in situations where it is necessary to check if the obtained difference is above machine precision. Seems like for this purpose R has a handy variable: .Machine$double.eps. However when...
View ArticleFinding the first number after consecutive zeros in data frame
I have a following data frame data <- tibble(ID=rep(c(1:2), each= 9), time = rep(1:9, 2), event = c(1,1,1,0,0,0,0,1,1,1,1,0,0,0,1,0,1,0)) I want to retrieve the first row for each subject which has...
View Articleggplot bar chart of only the most freq repeated data
For a given data with below structure, how is possible to plot the freq chart of only most frequent day of week for each Names instead of all with ggplot? (For example, if name FIX011 has most day of...
View ArticleHow to interpret this output from the chisq.multcomp() function?
After running a global chisq.test() analysis on the following data, I would like to test for significant differences between pairs. merged.table no yes Central 1735 412 Northeast 419 92 Northwest 419...
View ArticleR HELP! CHANGING COMMAS WITH PERIODS
1Here is my task:There is some structual issues with this dataset, write a function, named 'convert_number' that will accomplish the following: - change the numbers in a column so that the ',' is a '.'...
View ArticleR package installation in Linux
I am trying to install a R package in Ubuntu using the following commands:R CMD INSTALL rpart_4.1-5.tar.gz install.packages("/home/rpart_4.1-5.tar.gz", repos = NULL, type="source") * installing to...
View ArticleSimultaneously applying each element of a matrix to a function in R
I simulated three matrixes and hope to realize a function. It is hard to explain this function but I think the folllowing code of FOR LOOP is nice and simple to interpret what I want to...
View ArticleReplacing commas to periods in all colums in R
I am trying to write a function to change the numbers in a column so that the ',' is a '.'I want to then convert that column into a double.For example, here is some data to copy/paste:df <-...
View ArticleInstall R packages from linux command line
I am using AWS EC2 (ubuntu 12.04) to run some simulations in R. I have a scripts that boots up the instance and updates and upgrades and installs r-base r-base-devI would like to add a command to the...
View ArticleWhat's the best way to install R packages on Linux?
I happen to have Linux Mint on my machine (and I am not very experienced in Linux). When trying to install R packages (using install.packages()) on Linux Mint, I've got the following problems:The...
View ArticleHow to string replace rows in a data table
I'm working with GSS data, and one of their variables is Total family income. I think that they unnecessarily split up income below 10,000 into 8 groups, so I want to join them all together. I went...
View ArticleSet the legend of a ggplotly() plot to have only the color and not the shape...
I have the dataframe below:etf_id<-c("a","b","c","d","e","a","b","c","d","e","a","b","c","d","e") factor<-c("A","A","A","A","A","B","B","B","B","B","C","C","C","C","C")...
View ArticleUse tooltip with plotly_build() to prevent hover text from being displayed twice
I have the dataframe below:etf_id<-c("a","b","c","d","e","a","b","c","d","e","a","b","c","d","e") factor<-c("A","A","A","A","A","B","B","B","B","B","C","C","C","C","C")...
View Articlemlr equivalent of carets model selectionFunction in R
The caret library in R has a hyper-parameter 'selectionFunction' inside trainControl(). It's used to prevent over-fitting models using Breiman's one standard error rule, or tolerance, etc. Does mlr...
View ArticleRcpp unique order output
I noticed that unique function from Rcpp orders the results evalCpp("unique(IntegerVector::create(6,6,1,5,5,1))") [1] 6 5 1 unique(c(6,6,1,5,5,1)) [1] 6 1 5 Is there a way to avoid this ? Thanks for...
View ArticleR - convert date column in daily format to hourly granularity
I have the following dataframe df:> head(df) date demand 1 2019-09-21 6 2 2019-09-21 1 3 2019-09-21 9 4 2019-09-21 3 5 2019-09-21 12 6 2019-09-21 3 and I will like it to have hourly granularity as...
View ArticleHow to convert nested list name into tibble with row names
I have the following nested list:l <- list(`1` = c(Fn1 = 85.3820037423659, Sema3c = 0.0362596376899117, App = 8.08423415658745), `3` = c(Fn1 = 11.0051859200698, Sema3c = 0, App = 44.0000000000306),...
View ArticleTensorflow installation not found in R
I am attempting to install tensorflow on R-Studio in Windows 10. I have tried multiple different installation methods (from CRAN, from source, from Conda, from pip)Each time, I am told that it installs...
View ArticleReplace NA with value within group for subset
I need to replace missing values in all columns of a data frame within ID and time point for a subgroup that have data from several sources. If it is not too complicated, it would be best to prioritize...
View Article