viewIf | R Documentation |
List head or tail of a data.frame allowing to select column to be viewed and an optional condition to select rows to be displayed.
viewIf
allow to quickly display some column of a dataframe satisfiyng a condition. It can be used during
data exploration or after a recoding to verify the result
When a condition is given, viewIf return all rows for which the condition is TRUE plus all rows with NA
viewIf(data, ..., cond = NULL, nline = 10)
data |
The dataframe to explore |
... |
variable name(s) to include in view, as character |
cond |
A logical condition to select records which will be evaluated into data, given as character string. The condition should be passed between quote : cond="mycondition". |
nline |
Number of rows to show (default to 10) If nline is negative then |
the resulting selection of n rows for the given list of column
data <- data.frame(id = 1:10,
case = c(rep(1,3), rep(0,7)),
vacc = sample(c(0,1), replace = TRUE, size = 10),
ill = sample(c(0,1), replace = TRUE, size = 10))
data[8,2]<-NA
viewIf(data ,case,vacc)
viewIf(data, ,case,vacc, nline=3)
viewIf(data,case,ill, nline= -3)
viewIf(data,case,ill,cond="vacc==1" )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.