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.

Unique combination of all elements from two (or more) vectors

I am trying to create a unique combination of all elements from two vectors of different size in R. For …

r r-faq
Using ggplot2, can I insert a break in the axis?

I want to make a bar plot where one of the values is much bigger than all other values. Is …

r ggplot2 r-faq
Why do R objects not print in a function or a "for" loop?

I have an R matrix named ddd. When I enter this, everything works fine: i <- 1 shapiro.test(ddd[,…

r for-loop printing r-faq
Scheduling R Script

I have written an R script that pulls some data from a database, performs several operations on it and post …

r windows schedule r-faq
Confusion between factor levels and factor labels

There seems to be a difference between levels and labels of a factor in R. Up to now, I always …

r r-factor r-faq
How to debug "contrasts can be applied only to factors with 2 or more levels" error?

Here are all the variables I'm working with: str(ad.train) $ Date : Factor w/ 427 levels "2012-03-24","2012-03-29",..: 4 7 12 14 19 21 24 29 31 34 ... $ Team : …

r regression lm glm r-faq
Error in if/while (condition) { : argument is of length zero

I received the error Error in if (condition) { : argument is of length zero or Error in while (condition) { : argument is …

r r-faq
How to get mean, median, and other statistics over entire matrix, array or dataframe?

I know this is a basic question but for some strange reason I am unable to find an answer. How …

arrays r matrix dataframe r-faq
Read SAS sas7bdat data into R

What options does R have for reading files in the native SAS format, sas7bdat, into R? The NCES Common …

r r-faq
Convert a vector into a list, each element in the vector as an element in the list

The vector is like this: c(1,2,3) #[1] 1 2 3 I need something like this: list(1,2,3) #[[1]] #[1] 1 # #[[2]] #[1] 2 # #[[3]] #[1] 3 I tried this: list(c(1,2,3)) #[[1]] #[1] 1 2 3

r r-faq