knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "README-"
)

foofactor

The goal of foofactor is to practice in the development of an R package. Functions include:

Installation

You can try out the dev version from GitHub with:

# install.packages("devtools")
devtools::install_github("csiu/foofactor")

Usage

We first load the package

library(foofactor)

In the package, I have also provided example factors

exampleFactor1
exampleFactor2
exampleFactor3

fbind - Bind two factors together

fbind(exampleFactor1, exampleFactor2, level.as.appears = TRUE)

Here we bind together two factors. When we specify level.as.appears = FALSE, the order of the levels will seemingly be random.

freq_out - Create a frequency table for a factor

freq_out(exampleFactor3, n.sort = "descending")

n.sort can take the values of ascending, descending, or NULL (where NULL refers to the default behaviour without sorting on the frequency column).

should_factor_stay_factor - Should factor stay as factor?

should_factor_stay_factor(exampleFactor3)

Here we ask whether it makes sense for a factor to stay as a factor e.g. if the number of unique values of a factor is equal to the length, then maybe the factor would be better suited as a character vector.

Vignettes

For more information, please check out the vignette at:

vignette("foofactor", package = "foofactor")

Acknowledgements



csiu/foofactor documentation built on May 14, 2019, 12:24 p.m.