readr 0.2

If your life as an ecologist is spent loading/writing .csv files in R, you should be using readr. Why? Well it’s a Hadley Wickham package for one. But really, it’s defaults make sense!

  1. read_csv: strings are assumed as characters, not factors. FINALLY!
  2. write_csv: doesn’t include row numbers by default.
  3. readr recognizes YYYY-mm-dd format. Goodbye strptime!
  4. In v0.2, readr looks at the first 1000 rows when guessing column types (although 5000 would be handy too).

Read all about v.0.2.0 in the RStudio Blog.

While readr is my friend 99% of the time, not everything is sunshine and lollipops. For instance, while looping through thousands of files, I would randomly get an “unknown TZ” error, even when setting a timezone. After banging my head a few times, I went back to read.csv. You can’t win ’em all.

Timezone error using read_csv
Timezone error using read_csv
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s