proc_freq: (limited) Emulation of SAS proc_freq

Description Usage Arguments Examples

View source: R/proc_freq.R

Description

(limited) Emulation of SAS proc_freq

Usage

1
proc_freq(x, weight, tables)

Arguments

x

A data.frame, data.table, or matrix containg data. Tables will be generated with variables in the order that the data is coded. Data should be in long format (see Hawkeye data)

weight

The variable/column name in x the represents the frequency or count, as a length one character vector, i.e., "Freq"

tables

This is similar to the 'TABLES' argument in SAS. This should also be a length one character vector. At a minimum, this should contain two variables from x that we are interested in tabulating, joined with an '*'. Similar to SAS code, we can request a number of tables and options, including Measures, RelRisk, ChiSq, CellChi2, Exact, and CMH1. This argument should be of this form: tables = "var1*var2 / table1 option1 table2 table3"

Examples

1
2
3
tab1 <-  proc_freq(Rhabdo1, "Freq", "Shakes*Rhabdo / ChiSq CellChi2")
tab2 <- proc_freq(Hawkeye, "Freq", "Year*Win_Loss / Measures")
tab3 <- proc_freq(HA, "Freq", "Trt_Grp*MI / RelRisk")

collinn/sassyR documentation built on May 1, 2020, 1:59 a.m.