Join GitHub today
Adding options(stringAsFactors = FALSE) [episode 11] #393
Would it be worth mentioning to learners that having the line of code, options(stringAsFactors = FALSE), at the beginning of a script is another solution to prevent R from converting strings to factors?
Particularly in 11. Reading and Writing CSV files or 12. Factors (under Default Behavior)
I find this trick very useful because I don't have to manually set stringAsFactors to FALSE when I'm reading in multiple files that I know do not contain categorical variables.
Hi Duy, thanks for your comment!
Episode 11 already has an entire section on stringsAsFactors = FALSE in the reading of csv files, so I would put it there. I don't want to keep adding material due to length, but it is a useful trick and I think one sentence at the end of the section would be fine. The trick is to avoid adding an entire section on options, but maybe another sentence linking to where to find more information about options would solve this.
I'd be willing to review a pull request on this topic, if you or anyone else wants to work on it. The file to issue the PR against is located in the