Skip to main content
The 2024 Developer Survey results are live! See the results

Questions tagged [r]

R is a free, open-source programming language & software environment for statistical computing, bioinformatics, visualization & general computing. Please use minimal reproducible examples others can run using copy & paste. Show desired output entirely. Use dput() for data & specify all non-base packages with library(). Don't embed pictures for data or code, use indented code blocks instead. For statistics questions, use https://stats.stackexchange.com.

-2 votes
1 answer
21 views

Possible issues with text encoding

I'm having a strange problem when I read a .csv file using read_csv. I'm afraid I don't think I can produce a reproducible example because the issue may involve my current R/RStudio session and how ...
whdaffer's user avatar
-1 votes
0 answers
16 views

Google Cloud Platform Maps API key: Best practice to use in R to avoid incurring large API costs?

I'm using google maps API and ggmap to create a simple map of NYC in an RMarkdown document, in R: install.packages("ggmap") ggmap::register_google(key = "<your-api-key>", ...
DiamondJoe12's user avatar
  • 1,691
-1 votes
0 answers
16 views

Why does my mutate(across()) function not work in lapply? [duplicate]

I have a simple function that works just fine on one data frame but doesn't do anything when I use it in lapply. For example: df1 <- data.frame(x = c(1:5), y = c(11:14, NA)) df2 <- data.frame(...
Sara's user avatar
  • 45
-4 votes
0 answers
25 views

Dplyr ( count for total number/treatment) [closed]

I have data frame with two columns the first column is the number of children under the age of five that receive a treatment and the second column classifies the type of the treatment. I would like to ...
Hamad Alonazi's user avatar
0 votes
0 answers
33 views

How to extract from multiple zip files only the csv files whose name starts with a specific string of characters in r? [duplicate]

Let's consider a folder myfile containing more than a hundred zip files (z001.zip, z002.zip, z003.zip ...) each always including 4 distinct csv files whose names always start with these three letters ...
denis's user avatar
  • 487
0 votes
0 answers
18 views

Increasing fontsize of numbers in forestplot in R

I am trying to prepare a forest plot for summarizing patient survival outcomes in multiple cohorts using the forestplot package in R. The plot comes out fine but I am struggling to increase the size ...
accibio's user avatar
  • 535
0 votes
0 answers
21 views

Problems running accuracy metrics on Validation_Set using fable package

I am unable to let the ACCURACY function point only to the Validation_set. The code perfectly works only in case the first argument of Accuracy is the whole dataset("data_tsibble") but in ...
Mark_'s user avatar
  • 21
-1 votes
1 answer
36 views

Produce table with data bars in base R or ggplot2

I am looking to make a table with horizontal bar graphs in each cell to display continuous numeric data with 2 categorical independent variables. It would look similar to the below (fictional data): ...
whv20's user avatar
  • 151
-1 votes
0 answers
22 views

Getting "invalid 'type' (character) of argument" error with numeric values when I do apply.weekly(data$x, sum) [closed]

I have a time series object and I am creating a list of the variables at different timesteps. when I do apply.weekly( , mean) it works fine, but when I want to sum the values over a week it gives me.. ...
Tatiana's user avatar
1 vote
4 answers
70 views

Find row in Matrix A which is closest two Matrix B

Lets say I have two matrices A and B given by set.seed(123) m1 = matrix(runif(10*5), nrow = 10, ncol = 5) m2 = matrix(runif(10*5), nrow = 10, ncol = 5) I want to find for each row in matrix A the row ...
MGP's user avatar
  • 2,511
0 votes
0 answers
25 views

Making a ggplot2 Sankey plot in R less crowded

If I have a dataframe in R (called connections_df), that shows the connections between the two endpoints (endpoint1 and endpoint2) with the corresponding chromosome (CHR): endpoint1 ...
HKJ3's user avatar
  • 467
-1 votes
0 answers
38 views

Making lines not overlap

I am creating a DGE plot for 2 samples. I want the lines in the resulting plot to NOT BE STACKED on top of each other, bot to be next to each other (so that both are visible). ## Load packages if (! ...
Marek Pospíšil's user avatar
1 vote
2 answers
33 views

R function 'transform' ignoring argument 'check.names=FALSE'

I'm having issues with the function transform in R and the argument check.names. For example: df <- data.frame('A' = sample(1:10), 'B' = sample(1:10), 'C(%)' = NA, check.names = FALSE) > names(...
SchlaWiener's user avatar
0 votes
0 answers
47 views

Conditional variable for COMPLETE DATA [duplicate]

Attached data : id = c (2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2) vm = c("12", "13", "14", "15", "16", "17", "18" "19", &...
user25334460's user avatar
1 vote
2 answers
29 views

Change the absolute value of elements in a dataframe without changing their sign (+ / -)

I have a dataframe of cumulative changes, which I am trying to convert into (multiplicative) factor values. If all values were positive, I could simply add 1: e.g. a 25% increase would be 0.25, adding ...
ravinglooper's user avatar

15 30 50 per page
1
2
3 4 5
22