Skip to content

Data Management

Paige Miller edited this page Jan 9, 2018 · 26 revisions

Types of raw data

Data can be copied from hand-written notes into Excel, data scraped from online resources, or simulation-based data. These data are considered to be 'raw data' and should be backed up and saved in their rawest form. It's tempting to overwrite with cleaner data but resist.

[Special notes on managing data scraped from internet/other sources?]

If your data do come from simulations, the files might be too large to manage this way. In this case, make sure you save the exact way that the data were generated including version number of R packages, and back up your source code on GitHub.

Managing raw data in the Drake Lab

In the Drake Lab, we don't have a uniform way of storing data [we should perhaps address this]. Summarized personal communication with Tad about management in the Hastings lab for data collected from experimental studies, "We have hard copies of data in binders. These data get entered into Excel and are saved on a shared drive that exists on a server." [Should we start something like this, does it already exist?]. Either way, you should ensure your data are backed up in more than one location (external hard-drives, cloud options?)

Incrementally improving your data

We try to use google style guide to name files. Other notes:

  • If data are originally in Excel, save data as CSV - easier to read into R, doesn't require proprietary software
  • If variables are not intuitive, figure out what they represent and change them to something you easily understand
  • If NA values are coded as something weird, take note and consider changing to NA so R understands
  • Name your data file as something people can easily understand 2016-05-alaska-b.csv and save meta-data with the same name

Tidy Data:

Hadley Wickham, developer of R packages like reshape, ggplot2, stringr, and probably others, has advocated for scientists to strive for "tidy" data. He says, "Tidy datasets are all alike but every messy dataset is messy in its own way". Here's a link to his paper on Tidy Data and here is a tutorial on data tidying. Tidy data make analysis much friendlier and this is why Drake Lab members might want to make their data Tidy. Key tidy data principles:

  1. Each column is it's own variable e.g., "male_treated" should be split into separate variables for sex and treatment status. Store units in their own variable or in metadata, e.g., "3.4" instead of "3.4kg".
  2. Make each row an observation: Data often come in a wide format, because that facilitated data entry or human inspection. Imagine 1 row per field site and then columns for measurements made at each of several time points. Be prepared to gather such columns into a variable of measurements, plus a new variable for time point.

Which R packages help you make Tidy Data?

  • dplyr -- relevant functions/links
  • tidyr --

Note that you can save intermediate data cleaning steps, or you can clean as you as part of the data management process. Either is fine. See Good Enough Practices for a discussion.

Submit data to a reputable DOI-issuing repo

Your data will likely to be useful in the future for yourself and others. Sites such as Figshare, Dryad, and Zenodo allow others to find your work, use it, and cite it. [What are the advantages to each??]

Resources:

  1. Good Enough Practices
  2. Tidy Data

Lab Links

Clone this wiki locally