Repository navigation
Data Management
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.
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?)
Some tips:
- 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.csvand 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:
- 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".
- 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--
Resources:
- journal-club doc
- google-sites lab manual
- index of all Drake-lab google sites
- lab-meeting--minutes doc Contact John if you are having trouble accessing google docs or websites.
- repository of public domain images