- Measuring the speed of nervous system conduction
- And, a tiny lesson in open, transparent, reproducible data science
2017-04-24 09:46:06
We predict that the speed of conduction will be …
# Load R packages library("googlesheets") suppressPackageStartupMessages(library("dplyr")) suppressPackageStartupMessages(library("ggplot2"))
psych260 <- gs_title("psych-260-spring-2017")
## Sheet successfully identified: "psych-260-spring-2017"
psych260 %>% gs_read(ws = "distance") -> distance
## Accessing worksheet titled 'distance'.
## No encoding supplied: defaulting to UTF-8.
dist.hist <- ggplot(data = distance, aes(x=ankleshoulder)) + geom_histogram(bins = 5)
with(distance, summary(ankleshoulder))
## Min. 1st Qu. Median Mean 3rd Qu. Max. ## 122.0 125.5 132.0 133.2 137.5 149.0
# Calculate sum dist.sum = with(distance, sum(ankleshoulder))
The total distance is 2531 cm.
psych260 %>% gs_read(ws = "time") -> time
## Accessing worksheet titled 'time'.
## No encoding supplied: defaulting to UTF-8.
# Plot data time.plot = ggplot(data = time, aes(x=trial, y=time, color=condition)) + geom_point() + geom_line()
time %>% filter(condition == "ankle") -> ankle.times time %>% filter(condition == "shoulder") -> shoulder.times time.diff <- data_frame(trial=unique(time$trial), time=ankle.times$time - shoulder.times$time) time.diff.plot = ggplot(data = time.diff, aes(x=trial, y=time)) + geom_point() + geom_line()
time.diff$speed <- (dist.sum)*.01/time.diff$time speed.hist <- ggplot(data = time.diff, aes(x=speed)) + geom_histogram(bins = 5)
speed.plot <- ggplot(data = time.diff, aes(x=trial, y=speed)) + geom_point() + geom_line()
speed.plot
This document was prepared in RStudio 1.0.36 on 2017-04-24 09:46:13.
sessionInfo()
## R version 3.3.2 (2016-10-31) ## Platform: x86_64-apple-darwin13.4.0 (64-bit) ## Running under: OS X El Capitan 10.11.6 ## ## locale: ## [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8 ## ## attached base packages: ## [1] stats graphics grDevices utils datasets methods base ## ## other attached packages: ## [1] ggplot2_2.2.1 dplyr_0.5.0 googlesheets_0.2.1 ## ## loaded via a namespace (and not attached): ## [1] Rcpp_0.12.10 xml2_1.1.1 knitr_1.15.1 magrittr_1.5 ## [5] hms_0.3 munsell_0.4.3 colorspace_1.3-2 R6_2.2.0 ## [9] httr_1.2.1 stringr_1.2.0 plyr_1.8.4 tools_3.3.2 ## [13] grid_3.3.2 gtable_0.2.0 DBI_0.6-1 htmltools_0.3.5 ## [17] openssl_0.9.6 yaml_2.1.14 lazyeval_0.2.0 assertthat_0.2.0 ## [21] rprojroot_1.2 digest_0.6.12 tibble_1.3.0 readr_1.1.0 ## [25] purrr_0.2.2 curl_2.5 evaluate_0.10 rmarkdown_1.4 ## [29] labeling_0.3 stringi_1.1.5 cellranger_1.1.0 scales_0.4.1 ## [33] backports_1.0.5 jsonlite_1.4