Top "R-faq" questions

The r-faq tag is created to group a limited number of questions discussing problems that come up regularly on the R tag.

How should I deal with "package 'xxx' is not available (for R version x.y.z)" warning?

I tried to install a package, using install.packages("foobarbaz") but received the warning Warning message: package 'foobarbaz' is not …

r installation repository package r-faq
How can two strings be concatenated?

How can I concatenate (merge, combine) two values? For example I have: tmp = cbind("GAD", "AB") tmp # [,1] [,2] # [1,] "GAD" "AB" My …

r string-concatenation r-faq
How to sum a variable by group

I have a data frame with two columns. First column contains categories such as "First", "Second", "Third", and the second …

r dataframe aggregate r-faq
How does one reorder columns in a data frame?

How would one change this input (with the sequence: time, in, out, files): Time In Out Files 1 2 3 4 2 3 4 5 To this output (…

r sorting dataframe r-faq
Formatting Decimal places in R

I have a number, for example 1.128347132904321674821 that I would like to show as only two decimal places when output to …

r formatting rounding r-faq
How do I install an R package from source?

A friend sent me along this great tutorial on webscraping NYtimes with R. I would really love to try it. …

r package installation r-faq
Test if characters are in a string

I'm trying to determine if a string is a subset of another string. For example: chars <- "test" value &…

r regex string r-faq
Plotting two variables as lines using ggplot2 on the same graph

A very newbish question, but say I have data like this: test_data <- data.frame( var0 = 100 + c(0, cumsum(…

r ggplot2 graph time-series r-faq
Change R default library path using .libPaths in Rprofile.site fails to work

I am running R on Windows, not as an administrator. When I install a package, the following command doesn't work: &…

r rstudio r-faq library-path
Error in if/while (condition) {: missing Value where TRUE/FALSE needed

I received this error message: Error in if (condition) { : missing value where TRUE/FALSE needed or Error in while (condition) { : …

r r-faq