Skip to content

Commit 34a7ca1

Browse files
committed
master table generation added
1 parent 08b8386 commit 34a7ca1

File tree

1 file changed

+20
-36
lines changed

1 file changed

+20
-36
lines changed

R/mastertable_generation.R

+20-36
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,40 @@
1+
rm(list=ls())
2+
RESULT_DIR <-"~/Documents"
3+
MASTER_FILE <- "~/Documents/snail_back_pack/experiments/snail_temperature_experiment/results/master_table.csv"
14

25

36

47

58

69

710

8-
pre_temp_1112 <- fread("~/Documents/temp_011_012.csv", sep=",", header=F, data.table=F)
911

10-
li_11 <- fread("~/Documents/heart_011.csv", sep=",", header=F, data.table=F)
1112

1213

1314

1415

1516

17+
makedt_for_animal <- function(subdt){
1618

17-
18-
19-
20-
21-
22-
23-
24-
25-
26-
master_table_v1 <- data.table(read.csv("~/Documents/snail_back_pack/experiments/snail_temperature_experiment/results/master_table.csv", header=T, na.strings=" ", skip=1))
27-
master_table_v2 <- na.omit(master_table_v1[1:16])
28-
29-
30-
heart_table <- sapply(master_table_v2$heart_file, fread("~/Documents/", sep=",", header=F, data.table=F))
31-
heart_table <- sapply(master_table_v2$heart_file, function(s){
32-
fread("~/Documents/"s, sep=",", header=F, data.table=F)
33-
})
34-
35-
DF1 <- NULL
36-
for(file in filecol){
19+
heart_dt <- fread(subdt$heart_file)
20+
temp_dt <- fread(subdt$temp_file)
21+
##interpolation goes here
3722

38-
newfile <- gsub("\\s", "", file)
39-
files <- read.csv(newfile, sep=",", header=F)
40-
DF1 <- rbind(DF1, files)
41-
}
42-
43-
filecol <- data.table(gsub("\\s", "", master_table_v2$heart_file))
44-
23+
heart_dt
24+
25+
}
4526

46-
heart_table <- sapply(filecol, read.csv)
4727

28+
master_table_v1 <- data.table(read.csv(MASTER_FILE, header=T, na.strings=" ", skip=1))
29+
master_table_v2 <- na.omit(master_table_v1[1:16])
30+
master_table_v2[, ID:= as.integer(as.character(ID))]
4831

49-
files <- list.files(pattern="heart")
32+
master_table_v2[, heart_file:= paste(RESULT_DIR,gsub("\\s", "", heart_file),sep="/")]
33+
master_table_v2[, temp_file:= paste(RESULT_DIR,gsub("\\s", "", temp_file),sep="/")]
34+
#FIXME
35+
master_table_v2 <- master_table_v2[ID<13, ]
36+
setkey(master_table_v2,ID)
5037

51-
DF2 <- NULL
52-
for (f in files) {
53-
heart_data <- read.csv(f, header=F, sep=",")
54-
DF2 <- rbind(DF2, data.frame(heart_data))
55-
}
38+
test <- master_table_v2[,makedt_for_animal(.SD),by=ID]
5639

40+
master_table_v2[test]

0 commit comments

Comments
 (0)