Learn R Programming

descriptr (version 0.1.0)

screener: Screen Data Frames

Description

screener will screen data frames and return details such as variable names, class, levels and missing values. plot.screener creates bar plots to visualize in a data frame.

Usage

screener(y)

# S3 method for screener plot(x, ...)

Arguments

y

a data frame

x

an object of class screener

...

further arguments to be passed to or from methods

Value

screeneer returns an object of class "screener". An object of class "screener" is a list containing the following components

Rows

number of rows in the data frame

Columns

number of columns in the data frame

Variables

names of the variables in the data frame

Types

class of the variables in the data frame

Count

length of the variables in the data frame

nlevels

number of levels of a factor variable

levels

levels of factor variables in the data frame

Missing

number of missing observations in each variable

MissingPer

Percent of missing observations in each variable

MissingTotal

total number of missing observations in the data frame

MissingTotPer

total percent of missing observations in the data frame

MissingRows

total number of rows with missing observations in the data frame

MissingCols

total number of columns with missing observations in the data frame

Examples

Run this code
# screen data
mt <- mtcars
mt[, c(2, 8:11)] <- lapply(mt[, c(2, 8:11)], factor)
mt[sample(1:nrow(mt), 12), sample(1:ncol(mt), 6)] <- NA
screener(mt)

# visualize missing data
k <- screener(mt)
plot(k)

Run the code above in your browser using DataLab