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 subset matrix to one column, maintain matrix data type, maintain row/column names?

When I subset a matrix to a single column, the result is of class numeric, not matrix (i.e. myMatrix[ , 5 ] …

r matrix subset r-faq
How do I get a list of built-in data sets in R?

Can someone please help how to get the list of built-in data sets and their dependency packages?

r dataset r-faq
Find complement of a data frame (anti - join)

I have two data frames(df and df1). df1 is subset of df. I want to get a data frame …

r join merge r-faq
Numeric comparison difficulty in R

I'm trying to compare two numbers in R as a part of a if-statement condition: (a-b) >= 0.5 In this particular …

r floating-point comparison comparison-operators r-faq
Use variable names in functions of dplyr

I want to use variable names as strings in functions of dplyr. See the example below: df <- data.…

r dplyr r-faq rlang
Why can't I get a p-value smaller than 2.2e-16?

I've found this issue with t-tests and chi-squared in R but I assume this issue applies generally to other tests. …

r precision r-faq
How do I install a package that has been archived from CRAN?

I typed the following in the R command line: install.packages("RecordLinkage") I got the following error: Warning in install.…

r installation package r-faq
Why is `vapply` safer than `sapply`?

The documentation says vapply is similar to sapply, but has a pre-specified type of return value, so it can be …

r apply r-faq
Conditional merge/replacement in R

I have two data frames: df1 x1 x2 1 a 2 b 3 c 4 d and df2 x1 x2 2 zz 3 qq I want …

r match r-faq
Why is it not advisable to use attach() in R, and what should I use instead?

Let's assume that we have a data frame x which contains the columns job and income. Referring to the data …

r dataframe r-faq