---
tags: real experiments
---
# Female contant 70 deg 20April2020
#####
Cage 0 - 20.21g 1028f
Cage 1 - 23.58g 100f
Cage 2 - 18.45g 1025f
Cage 3 - 25.19g 7f
Cage 4 - 21.84g 37f
Cage 5 - 21.12g 1036f
Cage 6 - 19.80g 1029f
```
library(tidyverse)
library(lubridate)
library(readr)
cageweight0 <- 20.21
cageweight1 <- 23.58
cageweight3 <- 18.45
cageweight2 <- 25.19
cageweight4 <- 21.84
cageweight5 <- 21.12
cageweight6 <- 19.80
animalID0 <- "1028F"
animalID1 <- "100F"
animalID3 <- "1025F"
animalID2 <- "7F"
animalID4 <- "37F"
animalID5 <- "1036F"
animalID6 <- "1029F"
datafile <- "~/Dropbox/Cactus_Mouse_Physiology/data/20April20/apr20_final.csv"
apr20 <- read_csv(datafile,
col_types = cols(Animal = col_double(),
StartDate = col_date(format = "%m/%d/%Y"),
deltaCO2 = col_double(),
deltaH2O = col_double(),
H2Oml = col_double(),
VCO2 = col_double(),
StartTime = col_time(format = "%H:%M:%S")))
'%!in%' <- function(x,y)!('%in%'(x,y))
apr20 <- apr20 %>%
mutate(EE = 0.06*(3.941*VO2 + 1.106*VCO2)) %>%
mutate(RQ = VCO2/VO2) %>%
mutate(animal = round(Animal, digits=0)) %>%
mutate(Animal = NULL) %>%
unite("DateTime", StartDate:StartTime, remove = FALSE, sep = " ") %>%
mutate(weight =
ifelse(animal == 0, cageweight0,
ifelse(animal == 1, cageweight1,
ifelse(animal == 2, cageweight2,
ifelse(animal == 3, cageweight3,
ifelse(animal == 4, cageweight4,
ifelse(animal == 5, cageweight5,
ifelse(animal == 6, cageweight6, NA)))))))) %>%
mutate(Animal_ID =
ifelse(animal == 7, 'baseline',
ifelse(animal == 0, animalID0,
ifelse(animal == 1, animalID1,
ifelse(animal == 2, animalID2,
ifelse(animal == 3, animalID3,
ifelse(animal == 4, animalID4,
ifelse(animal == 5, animalID5,
ifelse(animal == 6, animalID6, NA))))))))) %>%
mutate(corEE = EE/weight) %>%
mutate(sex = "Male")
metric <- "corEE"
target <- c(0,1,2,3,4,5,6)
cages20apr <- apr20 %>% filter(animal %in% target)
measurement <- cages20apr %>% select(metric)
df<-as.data.frame(measurement[[metric]])
legend_title <- "Animal ID"
p <- ggplot(data = cages20apr,aes(x=as.POSIXct(DateTime),y=measurement[[metric]]))
p <- p + geom_point(aes(group=as.factor(Animal_ID), color=as.factor(Animal_ID)), size = 3)
p <- p + theme_grey(base_size = 15)
p <- p + geom_smooth(data=df$V1, method='loess', span=.3)
p <- p + labs(x = "", y = metric)
p <- p + scale_color_brewer(legend_title, palette="Paired")
p <- p + scale_x_datetime(date_breaks = "2 hours", date_labels = "%d%b %H:%M")
p <- p + theme(axis.text.x = element_text(angle = 45, hjust = 1))
p
```


