Top "Na" questions

NA is a missing value indicator (Not Available) in the R language.

How to pass na.rm=TRUE to sapply when calculating median?

I have created a dataframe "killers" with 3 variables. The data are numeric though there exist NA values throughout. My goal …

r na sapply na.rm
dplyr arrange() function sort by missing values

I am attempting to work through Hadley Wickham's R for Data Science and have gotten tripped up on the following …

r sorting dplyr na
Creating (and Accessing) a Sparse Matrix with NA default entries

After learning about the options for working with sparse matrices in R, I want to use the Matrix package to …

r default-value sparse-matrix na
Select NA in a data.table in R

How do I select all the rows that have a missing value in the primary key in a data table. …

r select data.table missing-data na
Function to change blanks to NA

I'm trying to write a function that turns empty strings into NA. A summary of one of my column looks …

r function na missing-data
R is there a way to find Inf/-Inf values?

I'm trying to run a randomForest on a large-ish data set (5000x300). Unfortunately I'm getting an error message as follows: &…

r random-forest na
Insert NA values into dataframe blank cells when importing read.csv/read.xlsx

The attached screenshot shows part of a dataframe which I have just imported into R from an excel file. In …

r excel na read.csv
Replace a value NA with the value from another column in R

I want to replace the NA value in dfABy from the column A, with the value from the column B, …

r replace na
Hiding NA's when printing a dataframe in knitr

I'm trying to print a table in knitr from a data frame using xtable . The table in the example below …

r knitr na xtable
Extract second subelement of every element in a list while ignoring NA's in sapply in R

I'm trying to extract the second subelement of every element in a list while ignoring NAs in R. Here's a …

r list apply na sapply