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)

grebbel/formr_test documentation built on May 17, 2019, 8:34 a.m.