find gaps and visualize it in R
I have 2 separate files for the dataset before and after filling the gaps, what i want to do is to find the gaps in at least one row (one time series) and plot it and then use the same index/row for...
View Articleh2o in R: model calculation hangs
I cannot figure out why my random forest grid search hangs. I tried many things suggested on Stackoverflow, but nothing works. First of all, here is my code:library(data.table) library(h2o)...
View ArticleHow do I use rvest to sort text into different columns?
I am using rvest to (try to) scrape all the author affiliation data from a database of academic publications called RePEc. I have the authors' short IDs, which I'm using to scrape affiliation data....
View Articlelme4 in R error: boundary (singular) fit: see ?isSingular
I am trying to run lme4 package in R. I have 10 Lines in total with four plants for each line in each of the two replications. But some of the plants died and there are some missing values. Weight is...
View ArticleRemove the output of the garbage collector gc() in Rmarkdown
I have a Rmarkdown document where the garbage collector is used to save memory during renderization. The function gc() is called at the end of some code chunks for convenience, but I would like to hide...
View ArticleError loading NEXRAD file into bioRad - file not found
I am trying to read a NEXRAD polar volume using bioRad in R Studio, but I get an error saying the file does not exist when it does in fact exist in the proper directory. Any thoughts on how to solve...
View ArticleCount duration from intervals in R
I need to count, from the total period that each person was in the study, how much time they contributed by age-interval. Age is represented in days. For example, the first participant started at age...
View ArticleHow to find doubling time of cells with scatterplot in R?
I'm trying to calculate the doubling time of cells using a scatterplot. This is my dataframedf = data.frame("x" = 1:5, "y" = c(246, 667, 1715, 4867, 11694)) and I've graphed this dataframe using this...
View ArticleCompute area under density estimation curve, i.e., probability
I have a density estimate (using density function) for my data learningTime (see figure below), and I need to find probability Pr(learningTime > c), i.e., the the area under density curve from a...
View ArticleLook up table based on integer values
Consider the following dataframe:lookup <- data.frame( level = 1:5, points_needed = c(150, 250, 420, 580, 620) ) lookup level points_needed 1 1 150 2 2 250 3 3 420 4 4 580 5 5 620 Now consider the...
View ArticleHow to set colors for bar plot with multiple layers in R?
I'm using ggplot2 to creat bar plot using three variables "stage", "sex" and "total" from data like below: residtraj sex stage perc total <chr> <fct> <fct> <dbl> <int> 1...
View ArticleIs there an R function for maximising the size of a dataset with blanks and NA?
I have several large(ish) datasets with large numbers of blanks, NAs and N/As. I can remove rows or columns with these values. Is there a function where R will successively remove the rows or columns...
View ArticleOutput of parallel computing in R on Windows
I would like to do some parallel computing in R on Windows. library(doSNOW) library(foreach) cl<-makeCluster(4) registerDoSNOW(cl) nn = seq(2,20, by=2) nn2 = rep(-1,10)...
View ArticleImprove first run time in sql r services
I am using an r service in SQL Server 2016 to generate a text file with a message in it. The stored procedure's output is the binary of that file. I am using the library hexView which I installed in...
View ArticleFinding effects sizes for ordinal models in R
I'm working with ordinal logistic regressions (using the function clmm in the package "ordinal"). The only way I can find of finding effects sizes for the variables in ordinal models is displaying the...
View ArticleHow to dynamically rename columns in a function in R?
Here is a function I'm trying to build in Rlag_decay_gen <- function(data,col,lag_val,decay_val) { temp <- lag(col, n = lag_val*7, default =0) temp <- temp + shift(temp)*decay_val temp <-...
View ArticleSum columns based on index in a a different data frame in R
I have two data frames similar to this:df<-data.frame("A1"=c(1,2,3), "A2"=c(3,4,5), "A3"=c(6,7,8), "B1"=c(3,4,5)) ref_df<-data.frame("Name"=c("A1","A2","A3","B1"),code=c("Blue"...
View ArticleAdding a "Pie chart out of pie chart" using R
I was wondering if R offers the possibility to show different pie charts at different levels of detail?I am thinking about something like this, wherea part of a more general piechart will be broken...
View ArticleExtracting day with lubridate
I have a date column, but it's written all the way around, Ex: "31-12-2019" When I try to extract the day using the day function from lubridate : day("31-12-2019") it returns "19" instead of "31"PS :...
View ArticleSolving double (n-tuple) multivariate integrals in R
I would like to write a code to solve this kind of equations:For that I wrote the code below, however it does not solve the problem. Do you have any ideas about the possibility to solve this kind of...
View Article