Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

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()

Examples

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

xfun

Miscellaneous Functions to Support Packages Maintained by 'Yihui Xie'

v0.22
MIT + file LICENSE
Authors
Yihui Xie [aut, cre, cph] (<https://orcid.org/0000-0003-0645-5666>), Wush Wu [ctb], Daijiang Li [ctb], Xianying Tan [ctb], Salim Brüggemann [ctb] (<https://orcid.org/0000-0002-5329-5987>), Christophe Dervieux [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.