Easy Frequency Tables

Generate 'SPSS'/'SAS' styled frequency tables. Frequency tables are generated with variable and value label attributes where applicable with optional html output to quickly examine datasets.


Travis-CI Build Status AppVeyor Build Status codecov

The goal of frequency is to provide quick and easy frequency tables from SPSS, SAS and other data files in a format that is familar to SPSS and SAS users. Frequencies are generated with variable labels and value labels where applicable.

Example

Features

  • Easily review an entire dataset with one line
  • Includes categories included in the label attributes, even if 0 cases exist in the dataset
  • Checks for NA and blank cases to review any missing data
  • User missing variables can be reported in missing category
  • Allows labels for both string and numeric classes
  • Suppresses printing of very long tables - defaults to top and bottom cases (can be changed with the maxrow option)
  • Supports label conventions from both foreign and haven packages

Installation

You can install frequency from github with:

# install.packages("devtools")
devtools::install_github("wilcoxa/frequency")

Example

Using foreign:

library(frequency)
library(foreign)
dat <- read.spss("mydat.sav")
 
freq(dat) # entire dataset
 
freq(dat$foo) # only one variable
 
freq(dat[3:5]) # specific variables
 

Using haven:

library(frequency)
library(haven)
dat <- read_sav("mydat.sav", user_na = TRUE)
 
freq(dat)
 
freq(dat$foo)
 
freq(dat[3:5])
 

To automatically open html output:

options(frequency_open_output = TRUE)
freq(dat)
 

Alternately check interactively at the console:

# produce a list of tables
x <- freq(dat) 
x[1]
 

Save output:

freq(dat, file = "myfile.html")
 

News

frequency 0.3.1

  • First release version

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("frequency")

0.3.1 by Alistair Wilcox, a year ago


https://github.com/wilcoxa/frequency


Report a bug at https://github.com/wilcoxa/frequency/issues


Browse source code at https://github.com/cran/frequency


Authors: Alistair Wilcox


Documentation:   PDF Manual  


GPL-3 license


Imports gtools, utils

Depends on rmarkdown, knitr, DT, ggplot2

Suggests foreign, haven, testthat, covr, shiny

System requirements: pandoc (>= 1.12.3) - http://pandoc.org


See at CRAN