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 to split a data frame?

I want to split a data frame into several smaller ones. This looks like a very trivial question, however I …

r split dataframe r-faq
Controlling number of decimal digits in print output in R

There is an option in R to get control over digit display. For example: options(digits=10) is supposed to give …

r precision digits r-faq output-formatting
What are the differences between "=" and "<-" assignment operators in R?

What are the differences between the assignment operators = and <- in R? I know that operators are slightly different, …

r assignment-operator r-faq
Extract a subset of a dataframe based on a condition involving a field

I have a large CSV with the results of a medical survey from different locations (the location is a factor …

r dataframe subset r-faq
Find the day of a week

Let's say that I have a date in R and it's formatted as follows. date 2012-02-01 2012-02-01 2012-02…

r date r-faq
How to reshape data from long to wide format

I'm having trouble rearranging the following data frame: set.seed(45) dat1 <- data.frame( name = rep(c("firstName", "secondName"), …

r reshape r-faq
Select rows from a data frame based on values in a vector

I have data similar to this: dt <- structure(list(fct = structure(c(1L, 2L, 3L, 4L, 3L, 4L, 1…

r subset r-faq
Quickly reading very large tables as dataframes

I have very large tables (30 million rows) that I would like to load as a dataframes in R. read.table() …

r import dataframe r-faq
Convert character to class Date

I have a data frame with a character column of dates. When I use as.Date, most of my dates …

r date lubridate as.date r-faq
List distinct values in a vector in R

How can I list the distinct values in a vector where the values are replicative? I mean, similarly to the …

r vector distinct-values r-faq