na.keep: Do-nothing na.action

Description Usage Arguments Value Author(s) See Also Examples

View source: R/na.keep.s

Description

Does not delete rows containing NAs, but does add details concerning the distribution of the response variable if options(na.detail.response=TRUE). This na.action is primarily for use with describe.formula.

Usage

1
na.keep(mf)

Arguments

mf

a model frame

Value

the same model frame with the "na.action" attribute

Author(s)

Frank Harrell
Department of Biostatistics
Vanderbilt University
fh@fharrell.com

See Also

na.omit, na.delete, model.frame.default, na.detail.response, naresid, naprint, describe

Examples

1
2
3
4
5
6
options(na.action="na.keep", na.detail.response=TRUE)
x1 <- runif(20)
x2 <- runif(20)
x2[1:4] <- NA
y <- rnorm(20)
describe(y ~ x1*x2)

Example output

Loading required package: lattice
Loading required package: survival
Loading required package: Formula
Loading required package: ggplot2

Attaching package: 'Hmisc'

The following objects are masked from 'package:base':

    format.pval, units

y ~ x1 * x2 

 3  Variables      20  Observations
--------------------------------------------------------------------------------
y 
       n  missing distinct     Info     Mean      Gmd      .05      .10 
      20        0       20        1   0.2572    1.161 -0.97653 -0.96150 
     .25      .50      .75      .90      .95 
-0.30120  0.03227  0.73556  1.25100  2.54307 

lowest : -1.1643463 -0.9666412 -0.9609298 -0.7464795 -0.4377385
highest:  0.7731265  1.0471329  1.1081941  2.5362546  2.6725113
--------------------------------------------------------------------------------
x1 
       n  missing distinct     Info     Mean      Gmd      .05      .10 
      20        0       20        1   0.4085   0.3494  0.01898  0.03599 
     .25      .50      .75      .90      .95 
 0.12541  0.40759  0.64099  0.73672  0.84193 

lowest : 0.01487140 0.01920102 0.03785983 0.05553392 0.05951288
highest: 0.69665308 0.70119353 0.72569769 0.83589710 0.95650092
--------------------------------------------------------------------------------
x2 
       n  missing distinct     Info     Mean      Gmd      .05      .10 
      16        4       16        1   0.4883   0.3145  0.06246  0.14346 
     .25      .50      .75      .90      .95 
 0.33699  0.50447  0.75180  0.83126  0.84679 

lowest : 0.007729233 0.080706225 0.206214697 0.303191735 0.348250756
highest: 0.737956970 0.793340678 0.817307080 0.845217382 0.851495689
--------------------------------------------------------------------------------

Hmisc documentation built on Feb. 28, 2021, 9:05 a.m.