Side by side geom_boxplot for the high and low values of multiple variables...
I am trying to create boxplot that would compare ob vs A and B at multiple location (I.e., Start, Mid, End) for Top and Low values (10% in this case). I am trying to use the gather, facet_wrap,...
View ArticleR Lmer model fails to converge, nearly unidentifiable (very large...
I had the two following warnings when running a multilevel model:Warning messages: 1: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, : Model failed to converge with max|grad| =...
View ArticleSet colors of Factors in R
I am attempting to make two scatter plots with ggplot2, which will have different groupings, but I would like the colors of the factors/groups to stay the same in both plots. The code below produces...
View ArticleHow do you write multiple rasters in [r]?
I am using lapply() to load 144 rasters as in my previous post: How do you load multiple rasters in [r] using a for loop?library(raster) rastlist <- list.files(path=path, pattern='tif$',...
View ArticleR shiny bigger window
Can you guys help me, how not to need to scroll, or make the window of the application bigger, so you can see the slider bars and plots at once? Or that slidebar and the plot will be side by side.see...
View ArticleWhy does gsub/sub not work to replace ".."?
When I call rownames on my df I get something like this:"Saint.Petersburg..Russia""Istanbul..Turkey"This what I codedgsub("..", "", rownames(df)) This is what was returned [1] """""What I expected was...
View Articlesystem2 call - different result if redirecting output
In my package, I'm trying to verify that svn command is available to use. To do that, I invoke svn --version command and ignore any output it produces, just checking the status code produced.Now, when...
View ArticleLinking Records in R
I'm working with a large amount of administrative data (~22 million records) and am trying to link individuals over time. I know that each row represents a unique individual for a given year, but (with...
View ArticleChange histogram bar percentage label in R ggplot
I have made a histogram in R using the following code: (I have tried generating a reprex. Try the code reprex hereprogressiveNumber = c(1:50) c = c(-0.22037439, -0.21536365, -0.34203720, 0.04501624,...
View ArticleHow to install azuremlsdk for R on rocker/tidyverse:latest?
I try to install azuremlsdk for R on rocker/tidyverse:latest image:dir.create("library") install.packages("azuremlsdk", repos="https://cloud.r-project.org", lib="library") azuremlsdk::install_azureml()...
View ArticleHow to I create a data frame from inbuilt data set 'iris'?
I am a beginner at using Rstudio and have been working through the exercises outlined as part of our course notes. We are to work with the 'iris' dataset however I haven't been able to successfully...
View ArticleHow to import this csv to R
I have no idea how to import this dataset into R. I tried the read.csv function in many different variations by changing the arguments, but all I get is a dataframe with 63 observations of 1 variable....
View ArticleHow do I make a nested for loop in R that multiples X & X?
So I'm trying to do a nested for loop that will multiple 1:100 with 1:100 (10,000 possible combinations). So 1*1, 1*2 ... 1* 100. Once it reaches 100, I want it to repeat, so 2*1, 2*2, 2*100.Of note: I...
View ArticleHow can I plot the wordcount from all specifically extracted sentences of...
OK, so I have extracted all the sentences with "oil" in the three bound versions of the congressional records and I managed to extract a wordcloud from it after cleaning the data. Code...
View ArticleTurning closure output into dataframe in R
The following code generates an object of type 'closure'. function (x, df1, df2, ncp, log = FALSE) { if (missing(ncp)) .Call(C_df, x, df1, df2, log) else .Call(C_dnf, x, df1, df2, ncp, log) } The...
View ArticleConvert factor to number with this command correct
Im trying to convert the following factor to number in RStudio, can I use this commands?NewFactor <- factor(c(31, 764, 9.6, 513, 125.344, 3131.657, 9853));as.numeric(NewFactor)
View ArticleLagging in R when a condition is matched
I have a dataframe with just dates of medical checkups and presence of infection (yes/no), and I want to add a third column representing the date of the last infection. The new last_infection column...
View ArticleMLE and CI for parameter via Newton-Raphson in r
I found the MLE estimator and i want to find the CI for this estimate using the wilk theorem. So I have this equation. loglike<-n*log(a)+n*k*log(x)-n*log(gamma(k)) +...
View ArticleR how to vectorize a function with multiple if else conditions
Hi I am new to vectorizing functions in R. I have a code similar the following.library(truncnorm) library(microbenchmark) num_obs=10000 Observation=seq(1,num_obs) Obs_Type=sample(1:4, num_obs,...
View ArticleFind substring not at beginning of string [duplicate]
I want to find and replace a substring of a string, but only if the substring is NOT at the beginning of the string. I've tried the code below, which gives these errors:string <- c("some text...
View Article