Learn R Programming

validate (version 1.1.5)

indicator: Define indicators for data

Description

An indicator maps a data frame, or each record in a data frame to a number. The purpose of this class is to store and apply expressions that define indicators.

Usage

indicator(..., .file, .data)

Arguments

...

A comma-separated list of indicator definitions

.file

(optional) A character vector of file locations

See Also

syntax, add_indicators

Examples

Run this code
# create an indicator for the number of missing x in data set


I <- indicator( 
 sum(is.na(.))               # number of missing variables
 , sum(is.na(.[c("x","y")])) # number of missing x and y
 , mean(is.na(.))            # fraction of missing variables
 , sum(x)
 , mean(x)
) 

dat <- data.frame(x=1:2, y=c(NA,1))
C <- confront(dat, I)
values(C)

Run the code above in your browser using DataLab