See title. Frankly I am a bit sick of manually doing the adjustment all the time.
This should be a simple question, but I just can't figure out how to fix it. Thanks.
See title. Frankly I am a bit sick of manually doing the adjustment all the time.
This should be a simple question, but I just can't figure out how to fix it. Thanks.
Set options(stringsAsFactors = FALSE)
at the beginning of your R session, or in your .RProfile.
As the comments below may suggest, stringsAsFactors
is a bit of a controversial topic within the R community. How irritating you find this default value may depend somewhat on how much time you spend using R to fit many "standard" statistical models (lm
, glm
, etc). Many of those model fitting and related functions are built around using the factor data type.
If you spend most of your time doing other more "generic" types of data analysis, you might find this default more irritating.
It is widely considered dangerous to globally set stringsAsFactors = FALSE
for the reasons mentioned below: it can cause significant confusion when sharing code. Indeed, even if you work mainly alone, participating in online communities like StackOverflow can be tricky if you insist on running R with stringsAsFactors = FALSE
: your answer to a question may not work for the OP, or you may not be able to replicate errors others are seeing!
Of course, everyone can make their own choices about how best to manage these risks for themselves.