This multiple choice question set relates to the introductory R lesson on data as well as the supplementary lesson on data reading.

Question 1

Can R read data from file having of the following forms listed below?

Pick one of these answers:

Question 2

Should you choose the stringsAsFactors=FALSE option when reading data?

Pick one of these answers:

Question 2 – Discussion

This is a somewhat challenging topic, and question two extends from question one. The possible distractions are

  1. this is intentionally misleading; R does indeed apply heuristics when reading a file to determine data types, column width etc – but it does not help here as the (old) default of factors comes from a time when that saved precious memory as opposed to repeating strings (which are now hashed internally and handled efficiently too)
  2. this is a valid answers, but useful mostly for advanced users / some contexts
  3. this is also a valid answer, and possibly the preferred one
  4. this is generally considered bad style as the script then becomes less portable as its behaviour is tied to a (local, machine-only) setting of a global state variable