R. Xing
4-2-2018
The aim of the app is to create a data visualization platform for my upcoming manuscript. In the manuscript we reported the effect of the drug Ivabradine on cardiac parameters, including heart rate, cardiac duration etc.
However, the data presented in the manuscript were mean values based on the entire groups. As we observed heterogeneity among individual mice in response to the drug, it was thus necessary to investigate the data of each mouse.
my_sheet <- c("HeartRate", "CardiacDurationSys", "CardiacDurationDia")
for (i in c(1:3)) {
data_all[[i]] <- read.csv(paste0(directory, my_sheet[i],".csv"))
data_all[[i]][,1] <- c(1:3,10,11,4,5,12:16,6:9,17,18) # rearrange the mouse numbers
data_all[[i]] <- data_all[[i]][order(data_all[[i]]$Mouse_Number),]
data_all[[i]]$Iva_Ctrl <- factor(data_all[[i]]$Iva_Ctrl, levels=c(0,1), labels = c("Control Group", "Ivabradine Group"))
}
kable(data_all[[1]][1:3,], row.names = FALSE)
Mouse_Number | Baseline | After | Iva_Ctrl |
---|---|---|---|
1 | 528.1571 | 582.2102 | Control Group |
2 | 541.3557 | 578.7340 | Control Group |
3 | 545.9195 | 515.9555 | Control Group |
data_reshape <- lapply(data_all, function(y) {
y <- melt(y, id.vars = c("Iva_Ctrl", "Mouse_Number"))
colnames(y) <- c("Ivabradine", "MouseNumber","TimePoint", "Value")
y$MouseNumber <- as.factor(y$MouseNumber)
y
})
kable(data_reshape[[1]][1:3,], row.names = FALSE)
Ivabradine | MouseNumber | TimePoint | Value |
---|---|---|---|
Control Group | 1 | Baseline | 528.1571 |
Control Group | 2 | Baseline | 541.3557 |
Control Group | 3 | Baseline | 545.9195 |