--- title: "Zebrafish motion" author: "Danny Kaplan & Mary Harrington" date: "July 14, 2015" output: html_document --- ```{r message=FALSE,warning=FALSE} library(dplyr) library(tidyr) library(ggplot2) library(printr) # for nice table printing ``` # Introduction [Still in draft ...] Zebrafish are fish who swim ... *add more profound description*. They are interesting *why?* [DTK: Even though I have a joint paper about the activity of Mauthner neurons in zebrafish, that probably has nothing to do with Mary's interests. # Data as they arrived for me Mary, this is just for our internal purposes. It's here to document where the data came from and provide a "chain of evidence" for the validity of the data to be presented in your research publication. (But I should have saved the original CSV file with a better name to refer to this specific run.) ```{r} OriginalForm <- readr::read_csv("Zebrafish.csv", stringsAsFactor) OriginalForm[1:8,1:6] ``` I'm going to translate this to a long form. Think of this as cleaning more than it is wrangling. Cleaning is often ugly. ```{r} Tmp <- t(OriginalForm) # transpose nms <- Tmp[1,] Tmp <- Tmp[-1,] nrows <- nrow(Tmp) Tmp <- data.frame(matrix(as.numeric(Tmp), nrow = nrows), stringsAsFactors=FALSE) names(Tmp) <- nms Activity <- gather(Tmp, "fish", "value", -time, -temp) ``` Temperature to Fahrenheit Time to hours Just fish A1 Just temperatures greater than 28 degrees Mean and standard deviation of each fish Arrange by maximum activity for each fish