take_nonmissing: take only nonmissing

Description Usage Arguments Examples

View source: R/data_wrangling.R

Description

this function takes a subset of a dataset, omitting all cases with missings in variables specified in 'keep' and omitting all variables that still have missings after that. Good to see how large your dataset for a certain analysis will be and which covariates are 'free' in terms of sample size.

Usage

1
take_nonmissing(df, keep = c())

Arguments

df

dataset

keep

defaults to empty vector

Examples

1
2
3
4
5
6
data(ChickWeight)
ChickWeight[1:2,c('weight','Chick')] = NA
ChickWeight[3:4,'Diet'] = NA
names(ChickWeight); nrow(ChickWeight)
ChickWeight2 = take_nonmissing(ChickWeight, keep = c('weight'))
names(ChickWeight2); nrow(ChickWeight2)

rubenarslan/formr documentation built on March 19, 2018, 8:54 p.m.