title: R: when to use stringAsFactors
body: <p>I have been reading about stringAsFactors and how despite the default being TRUE, in many instances you have to set it to FALSE for certain commands. From what I understand:</p>
  
  <ul>
  <li><p>Factors are the default way in which R stores text so if you have a df with a column containing text, R will (always?) convert it to factors when you import your data.</p></li>
  <li><p>If you are intending to do statistical tests (regression etc) using this particular text column, then this is fine, because many statistical functions (like lm() or glm() ) will require for you to have your text variables set as factors, so that it can treat them as categorical data.</p></li>
  <li><p>However, if you are intending to do things other than statistical testing (i.e. manipulating your df, merging it etc), then you might want to set stringAsFactors to FALSE because some functions could give you errors if you have your text variables set as factors.</p></li>
  </ul>
  
  <p>Is this correct? I think I understand the main concept of stringAsFactors, but I was wondering if there was any "rule" that people use? In other words, when you are starting a new script, it is "normal" not to be entirely sure whether you should set stringAsFactors to TRUE or FALSE? Is there a list of (non-statistical) packages that are particularly known for wanting stringAsFactors to be set to FALSE?</p>
  
  <p>In other words, is it considered "good practise" to set stringAsFactors to FALSE, if one is fairly sure you are not going to use a statistical function on your data?</p>
  
  <p>I appreciate my question is quite vague, but I was just wondering if there was some kind of "trick"/"rule" that people use, when "deciding" whether to set the parameter to TRUE or FALSE. Thanks</p>