Learn R Programming

mason (version 0.2.4)

polish: Do some final polishing of the scrubbed mason analysis data.

Description

Do some final polishing of the scrubbed mason analysis data.

Usage

polish_renaming(data, renaming.fun, columns = NULL)
polish_filter(data, keep.pattern, column)
polish_transform_estimates(data, transform.fun)
polish_adjust_pvalue(data, method = "BH")

Arguments

data
The scrubbed object.
renaming.fun
A function, typically with gsub, that searches and replaces strings.
columns
The columns to apply the renaming function to. Defaults to columns that are a factor or character vectors.
keep.pattern
Rows to keep based on a regular expression pattern.
column
The column to apply the filtering to.
transform.fun
A function to modify continuous variable columns.
method
Correction method for the p-value adjustment (p.adjust).

Functions

  • polish_renaming: polish_renaming simply takes a function, most likely one that uses gsub, and uses that to search and replace words, etc, in the specified columns.
  • polish_filter: polish_filter is basically a thin wrapper around filter, but using grepl for the pattern searching.
  • polish_transform_estimates: polish_transform_estimates is simply a thin wrapper around mutate_each.
  • polish_adjust_pvalue: polish_adjust_pvalue is a thin wrapper around mutate and p.adjust

Examples

Run this code
library(magrittr)
ds <- swiss %>%
 design('glm') %>%
 add_settings() %>%
 add_variables('yvar', c('Fertility', 'Education')) %>%
 add_variables('xvar', c('Agriculture', 'Catholic')) %>%
 add_variables('covariates', 'Examination') %>%
 construct() %>%
 scrub()
polish_renaming(ds, function(x) gsub('Education', 'Schooling', x))
polish_filter(ds, 'Xterm', 'term')
polish_adjust_pvalue(ds)[c('p.value', 'adj.p.value')]
polish_transform_estimates(ds, function(x) exp(x))

Run the code above in your browser using DataLab