knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "README-" )
The goal of foofactor is to practice in the development of an R package. Functions include:
fbind()
freq_out()
should_factor_be_factor()
You can try out the dev version from GitHub with:
# install.packages("devtools") devtools::install_github("csiu/foofactor")
We first load the package
library(foofactor)
In the package, I have also provided example factors
exampleFactor1 exampleFactor2 exampleFactor3
fbind
- Bind two factors togetherfbind(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 factorfreq_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.
For more information, please check out the vignette at:
vignette("foofactor", package = "foofactor")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.