xfun (version 0.7)

stringsAsStrings: Set the global option options(stringsAsFactors = FALSE) inside a parent function and restore the option after the parent function exits

Description

This is a shorthand of opts = options(stringsAsFactors = FALSE); on.exit(options(opts), add = TRUE); strings_please() is an alias of stringsAsStrings().

Usage

stringsAsStrings()

strings_please()

Arguments

Examples

Run this code
# NOT RUN {
f = function() {
    xfun::strings_please()
    data.frame(x = letters[1:4], y = factor(letters[1:4]))
}
str(f())  # the first column should be character
# }

Run the code above in your browser using DataLab