How can I test whether a plot has a fixed aspect ratio in R
I wonder if there is a way to ask R whether a plot has or has not a fixed aspect ratio. Here are two example plots:library (ggplot2) plot_a <- ggplot(iris, aes(Sepal.Length, Sepal.Width, color =...
View ArticleHow do I create a heat map of the US using plot_usmap
I am interested in creating a heat map of the US based on a fitness score. My data has 3 columns: a rank column, a state name column where states are abbreviated into FIPS codes, and a fitness score...
View ArticleTransform y-axis in barplot into the time scale
I am constructing bar plots for 2 different parameters for 22 patients.The database consists of 3 columns (for patient name, parameter I and parameter C) and thousands of rows (each of it corresponds...
View ArticleError in Rcpp::sourceCpp(): Error 1 occurred building shared library
I am trying to use the mixl package in R for discrete choice modelling. mixl includes a pre-compiler that takes a model specification written in plain text, and converts it to a C++ utility function...
View ArticleFilter images out of large set, and move only those fulfilling criteria to...
I have a dataset of 4000+ images. For the purpose of figuring out the code, I moved a small batch of them to another folder.The files look like this: folder r01c01f01p01-ch3.tiff r01c01f01p01-ch4.tiff...
View ArticleR: How to add indifference curves like these?
I have got a graph like below, except without the red and blue indifference curves (level sets). I know I can use contour() but that creates long curves going from edge to edge. Is there any way I can...
View Articlenot possible to set the "R home directory path" in Bluesky Statistics
I have problems in setting the "R home directory path" with the latest 64bit release of Bluesky Statistics (6.20.7235). After running the software for the first time, I received the following...
View Articlesession not created: This version of ChromeDriver only supports Chrome...
I'm trying to run RSelenium using the rsDriver function, but when I run rD <- rsDriver() I get a message telling me I need a newer version of Chrome:> rD <- rsDriver() checking Selenium Server...
View Articlesegment an IP Address generating /8, /16 and /24
Via R and using RStudio, I'm trying to segment an ip address (eg.: 10.10.10.7) and generate a /8>/16>/24>/32.Edit: My input is a list with +/- 100 IPs and have repeated IPs. The output I want...
View ArticleHow to find overlapping regions between two data frames based on conditions
I have two data frames, one called strain_1 and the other called strain_2. Each data frame has 4 columns (st_A, ed_A, st_B, ed_B : for "start" and "end" positions), but a different number of rows....
View ArticleR Vectorize FOR loop using previous iteration values
Is it possible to vectorize / speed up the execution of a FOR loop that is using the previous iteration values ?In the reproductive example below :the current production is computed from the current...
View Articlehow to draw a radar chart with a lot of rows (or dimensions) using R?
Let's say I have such data:a <- tibble(id=c(1,1.1,1.2,1.7,2,2.1,2.6,4,4.6,4.68), x=c(0.3,0.5,0.2,0.7,0.1,0.5,0.43,0.6,0.3,0.65), y=c(0.2,0.1,0.22,0.1,0.5,0.2,0.3,0.2,0.14,0.3)) This is just a...
View Articleignore missing variable in R
> DS datum AUL_T ZUL_T_SW 1 25.06.2017 21.9 22 2 25.06.2017 21.9 22 3 25.06.2017 21.9 22 4 25.06.2017 21.9 22 5 25.06.2017 21.9 22 6 25.06.2017 21.9 22 7 25.06.2017 21.9 22 [ reached 'max' /...
View ArticlePlots (ggplot2) in Rmarkdown PDF cropped
Within R I use the ggplot2 plotting library to create plots. I output a bunch of them and also print \n\n in between them such that they become their own paragraph in the PDF (via LaTeX). Lately (new R...
View ArticleCalculate revenues for each month by total revenues in r
Let’s say a consultancy releases the total revenues of firm A and B in region alpha and beta monthly, the data may look like:# generate data foo <- expand.grid(month = 1:3, region = c("alpha",...
View ArticleR function to merge
Can we merge 2 files with non unique values in R, example. postal code that are repeated more than once in one file a and once in the other file bmerge(a,b,by="Postal", all.b=TRUE)
View ArticleForce ggplot2 scatter plot to be square shaped
I can force ggplot2 scatter plot to be square shaped with the same x and y scaling using xlim() and ylim(), but it needs manual calculation of the limits. Is there any more convenient way of doing...
View ArticleSum Rows by Column Position Rather than name
I have a dataframe with dates that will change everymonth for the next 24 months, so I can't use the column names in my code. I want to use mutate that sums each row, so in this example sum by row...
View ArticleHow can I do polynomial interpolation in R
I am aware of a function called poly.calc(x, y) from library polynom. It seems to return a string that can't be used to computing directly. Is there another similar function or is there other work around?
View ArticleR - date format after cbind
I have a dataframe column that looks like:> head(merged_2$ReferenceDate) [1] "2008-03-31 UTC""2008-03-31 UTC""2010-03-31 UTC""2010-06-30 UTC""2008-03-31 UTC" [6] "2008-03-31 UTC"but when I use cbind...
View Article