Category "r"

R Studio Fatal error: 'R_TempDir'contains space

I tried to download the latest version (4.2.0) of R on my windows computer and received this error message upon trying to open the program. "Fatal error: 'R_Te

How can I make one plot from multiple variables in ggplot?

I'm trying to make a pre-post change plot for three groups. In my data frame, pre data and post data are stored as two different variables like this. pre_treat

Tried scale_linetype_manual to add legend but not successful

Following the thread from Tried p + scale_fill_discrete(name = "New Legend Title") but legend title still not changing, I now only want to generate line plot wi

How to create a dummy variable corresponding to a change in a value in R

I have the following data: week <- c(1,2,3,4,1,2,3,4,1,2,3,4) product <- c("A", "A", "A", "A", "B", "B", "B", "B", "C", "C", "C", "C") price <- c(5,5,6

gridtext::element_markdown doesn't apply margin with css selector

I'm trying to define different margins for x-axis labels in ggplot2 using css syntax, as allowed by ggtext package. I created an object with the CSS selector an

Multiples rows to one row in R [closed]

In R, I have a data frame with several values. I would like to have a data frame that transforms the data frame into a data frame with just on

Error in deployment of shinyapps Error accessing GitHub repository nstrayer/shinysense. HTTP 401: Unauthorized

I am trying to publish a shiny app, you can see the source code here, it was being deployed correctly until I tried using the shinysense package This is the err

How to extract the coefficients of a linear model and store in a variable in R?

I have a data frame and I did a linear model. I want to extract the coefficients and store each coefficient into a variable using R. This is my data frame df &l

Split comma-separated strings in a column into separate rows

I have a data frame, like so: data.frame(director = c("Aaron Blaise,Bob Walker", "Akira Kurosawa", "Alan J. Pakula", "Alan Parker", "A

Summarize two dataframes in r

I have two dataframes df1 # var1 var2 # 1 X01 Red # 2 X02 Green # 3 X03 Red # 4 X04 Yellow # 5 X05 Red # 6 X06 Green df2 # X01 X02

Rmarkdown: include plot height in resulting html <img> tag

I am working on a larger RMarkdown-site. Due to the size of images on the pages I implemented lazy loading for images using the loading="lazy"attribute of the &

Assigning different types of tasks to the same `foreach` loop

Many are familiar with foreach() to assign a loop across many cores in parallel using %dopar%. However, in R how do you send a single job request for a variety

mixed effect model with more than two uncorrelated random effect slopes in python

I have multi-level data and want to fit a mixed-effect model in python due to parallelization potential. But I am not able to compile the formula in 'statsmodel

Configuring compilers on Mac M1 (Big Sur, Monterey) for Rcpp and other tools

I'm trying to use packages that require Rcpp in R on my M1 Mac, which I was never able to get up and running after purchasing this computer. I updated it to Mon

R - subscript out of bounds with stringer and grep in lapply function

My goal is to extract strings of digits with fixed length (8 digits) from multiple text files in several folders after matching a certain pattern. I have spent

How to combine 2 RTF files in R

I'm unable to combine 2 or more RTF files in R. Anybody who knows please help me out. I'm trying to add footnotes for the rtf files but they are not taking it.

Ways to select multiple columns in base R using the native pipe |>?

What are good ways to select multiple columns of a data frame in base R using the native pipe |>? (i.e., without the tidyverse/dplyr to reduce external depen

DADA2 - Calculating percent of reads that merged

I have been following the tutorial for DADA2 in R for a 16S data-set, and everything runs smoothly; however, I do have a question on how to calculate the total

How can I write this to include multiple conditions?

I am trying to write out excel files as workbooks where columns satisfy more than one condition. I receive errors here with grep function and unexpected } If I

Should R package functions not include comments?

I'm in the process of creating a small R package containing a set of functions that should be useful in a specialized area of Biology. I currently have the pack