README.md

FooFactors

Factors are a very useful type of variable in R, but they can also be very aggravating. This package provides some helper functions for the care and feeding of factors.

Installation

You can install the released version of FooFactors from CRAN with:

install.packages("FooFactors")

And the development version from GitHub with:

# install.packages("devtools")
devtools::install_github("shakkyaNV/FooFactors")

Example

This is a basic example which shows you how to solve a common problem:

library(FooFactors)

Binding two factors via fac_bind():

a <- factor(c("character", "hits", "your", "eyeballs"))
b <- factor(c("but", "integer", "where it", "counts"))

Simply concatenating two factors leads to a result that most don’t expect.

c(a, b)
NV> [1] 1 3 4 2 1 3 4 2

The fbind() function glues two factors together and returns factor.

fac_bind(a, b)
NV> [1] character hits      your      eyeballs  but       integer   where it 
NV> [8] counts   
NV> Levels: but character counts eyeballs hits integer where it your


shakkyaNV/FooFactors documentation built on March 8, 2021, 12:08 a.m.