Skip to contents

The goal of mutagen is to provide extensions to dplyr’s mutate().

mutagen provides simple-to-use functions as alternatives to complex R idioms for variable generation. Some mutagen functions are specific to problems encountered in R (e.g., working with list-columns in a data frame), while others solve more generic data science operations that are inspired by the excellent set of egen functions in Stata.

Installation

You can install the development version of mutagen from GitHub with:

# install.packages("devtools")
devtools::install_github("gvelasq/mutagen")

Usage

mutagen functions begin with the prefix gen_* and are designed to be used inside dplyr’s mutate(). A mnemonic for this is that to use mutagen, first mutate then generate.

mutagen function R idiom Stata idiom
gen_na_listcol()1 modify_tree(leaf = \(x) replace(x, is.null(x), NA)) N/A

Contributing

Please note that the mutagen project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.