|
| 1 | +--- |
| 2 | +title: "VectorByte Methods Training" |
| 3 | +subtitle: "Introduction to Data Types and Best Practices" |
| 4 | +author: "The VectorByte Team (Leah R. Johnson, Virginia Tech)" |
| 5 | +title-slide-attributes: |
| 6 | + data-background-image: graphics/VectorByte-logo_lg.png |
| 7 | + data-background-size: contain |
| 8 | + data-background-opacity: "0.2" |
| 9 | +format: |
| 10 | + revealjs: |
| 11 | + auto-stretch: false |
| 12 | +--- |
| 13 | + |
| 14 | +```{r setup, include = FALSE} |
| 15 | +knitr::opts_chunk$set(cache = FALSE, |
| 16 | + echo = FALSE, |
| 17 | + message = FALSE, |
| 18 | + warning = FALSE, |
| 19 | + #fig.height=6, |
| 20 | + #fig.width = 1.777777*6, |
| 21 | + tidy = FALSE, |
| 22 | + comment = NA, |
| 23 | + highlight = TRUE, |
| 24 | + prompt = FALSE, |
| 25 | + crop = TRUE, |
| 26 | + comment = "#>", |
| 27 | + collapse = TRUE) |
| 28 | +library(knitr) |
| 29 | +library(kableExtra) |
| 30 | +library(xtable) |
| 31 | +library(viridis) |
| 32 | +
|
| 33 | +options(stringsAsFactors=FALSE) |
| 34 | +knit_hooks$set(no.main = function(before, options, envir) { |
| 35 | + if (before) par(mar = c(4.1, 4.1, 1.1, 1.1)) # smaller margin on top |
| 36 | +}) |
| 37 | +knitr::opts_chunk$set(echo = FALSE) |
| 38 | +knitr::opts_knit$set(width = 60) |
| 39 | +source("my_knitter.R") |
| 40 | +#library(tidyverse) |
| 41 | +#library(reshape2) |
| 42 | +#theme_set(theme_light(base_size = 16)) |
| 43 | +make_latex_decorator <- function(output, otherwise) { |
| 44 | + function() { |
| 45 | + if (knitr:::is_latex_output()) output else otherwise |
| 46 | + } |
| 47 | +} |
| 48 | +insert_pause <- make_latex_decorator(". . .", "\n") |
| 49 | +insert_slide_break <- make_latex_decorator("----", "\n") |
| 50 | +insert_inc_bullet <- make_latex_decorator("> *", "*") |
| 51 | +insert_html_math <- make_latex_decorator("", "$$") |
| 52 | +## classoption: aspectratio=169 |
| 53 | +``` |
| 54 | + |
| 55 | + |
| 56 | +## Why is Data/Code Curation and Management Important? |
| 57 | + |
| 58 | +In order for analyses to be repeatable, data and code first must: |
| 59 | + |
| 60 | +- properly organized and documented |
| 61 | +- accessibly stored and findable, and |
| 62 | +- ideally, made available to others. |
| 63 | + |
| 64 | +Data obtained with support from public funds (such as NSF or NIH) are usually ***required*** to be made available to other scientists and the public. |
| 65 | + |
| 66 | + |
| 67 | +## Steps to Data Management |
| 68 | + |
| 69 | +There are many steps to obtaining and effectively managing data (right, below). Today we talk about important components that fit in areas (ii) to (v). |
| 70 | + |
| 71 | + |
| 72 | +::: columns |
| 73 | +::: {.column width="45%"} |
| 74 | + |
| 75 | +<br> |
| 76 | + |
| 77 | +1. Manage Raw Data |
| 78 | +1. Check Data |
| 79 | +1. Store and Curate Data |
| 80 | + |
| 81 | + |
| 82 | +::: |
| 83 | + |
| 84 | +::: {.column width="55%"} |
| 85 | + |
| 86 | +<center> |
| 87 | +{width="70%"} |
| 88 | +</center> |
| 89 | + |
| 90 | + |
| 91 | +::: |
| 92 | +::: |
| 93 | + |
| 94 | +## 1. Manage Raw Data |
| 95 | + |
| 96 | +So you’ve got some "raw" data: |
| 97 | + |
| 98 | +- handwritten notes |
| 99 | +- automatic data logger (this includes sequencing machines, temperature monitors, etc.) |
| 100 | +- output from simulation |
| 101 | + |
| 102 | +These data should be transferred to an organized electronic format and checked as soon as possible after collection. |
| 103 | + |
| 104 | +## What Electronic Formats? |
| 105 | + |
| 106 | +Often easiest to input as a table into a spreadsheet. |
| 107 | + |
| 108 | +But don’t leave it simply as a spreadsheet – save it to a non-proprietary format, like a comma-delimited file (csv). |
| 109 | + |
| 110 | +<br> |
| 111 | + |
| 112 | +## How should data be recorded |
| 113 | + |
| 114 | +<center> |
| 115 | +**`r myred("Input it in the least compact form that you can – you don’t want to lose information!")`** |
| 116 | +</center> |
| 117 | + |
| 118 | +<br> |
| 119 | + |
| 120 | +Usually this means that you want your data to be in a "long" format -- but what does this mean? |
| 121 | + |
| 122 | +## Long vs. Wide |
| 123 | + |
| 124 | +## Metadata |
| 125 | + |
| 126 | +## What is in a "row" of data? |
| 127 | + |
| 128 | +- units separate from measured values |
| 129 | +- dates |
| 130 | +- individual measurements when possible |
| 131 | +- separate columns for all covariates with units and settings recorded separately. |
| 132 | + |
| 133 | +## Examples from VectorByte |
| 134 | + |
| 135 | + |
| 136 | +## Check Data |
| 137 | + |
| 138 | +Almost always errors are made when data are being collected or inputted. |
| 139 | + |
| 140 | +- Decimal points moved |
| 141 | +- Digits switched |
| 142 | +- Missing data are not properly encoded |
| 143 | +- Instrument errors |
| 144 | +- Skip some data |
| 145 | + |
| 146 | +As (and after) you input, do some "sanity checks" |
| 147 | + |
| 148 | +- count/sum across rows and columns |
| 149 | +- check for empty fields |
| 150 | +- visualize your data and look for outliers. |
| 151 | + |
| 152 | + |
| 153 | +## FAIR Data Practices |
| 154 | + |
0 commit comments