byType: Return indicator matrix

Description Usage Arguments Value

View source: R/byType.R

Description

This function takes in a dataframe representing a single categorical/numerical group. based on the different types of data the input dataframe representing, it will perform different processure like cut, recode and etc and return a indicator matirx

Usage

1
byType(dat, types, reqs)

Arguments

dat

a dataframe representing a single categorical or numerical group to be processed

types

representing the types of the input variable, possible values: "factor", "numeric","logic". if factor: recode the factors into different groups if numeric: cut the numeric variables into factors if logic(indicator matrix): group different factors if needed

reqs

rules as string for recode/cut/group based on the different types of input variable if factor: examples as "c(0)='No';c(1,2,3,4)='Yes'", recode 0 into 'No', recode 1,2,3,4 into 'Yes' if numeric: input the cuts if logic(indicator matrix): input the categories to be grouped together

Value

A dataframe of the indicator matrix


xinBrueck/raking documentation built on Aug. 6, 2019, 12:14 p.m.