Learn R Programming

oii (version 1.0.2.1)

oii.freq: Frequency tables

Description

This function prints a simple frequency table with totals and percentages

Usage

oii.freq(x)

Arguments

x

input variable, (usually of class factor)

Value

A data.frame with one row per each unique value of x. These values of x are assigned to the row.names of the data.frame. The data.frame also has rows for:

Valid Total

The total number of non-missing cases (i.e., sum(!is.na(x)))

Missing

The total number of missing/NA cases (i.e., sum(is.na(x)))

Total

The total number of cases (i.e., length(x))

The data.frame has the following columns:

freq

The number of cases with this value

percent

The percentage of all cases that this value represents

valid_percent

The percentage of all valid (i.e., not missing) cases that this value represents

cum_percent

The cumulative percentage of valid cases

See Also

data.frame, row.names is.na, length, summary, table

Examples

Run this code
# NOT RUN {
#Create var as 200 A's, B's, and C's
var<-sample(LETTERS[1:3],size=200,replace=TRUE)

#Generate a frequency table for the counts of A's, B's, and C's
oii.freq(var)

# }

Run the code above in your browser using DataLab