|
| 1 | +rm(list=ls()) |
| 2 | +RESULT_DIR <-"~/Documents" |
| 3 | +MASTER_FILE <- "~/Documents/snail_back_pack/experiments/snail_temperature_experiment/results/master_table.csv" |
1 | 4 |
|
2 | 5 |
|
3 | 6 |
|
4 | 7 |
|
5 | 8 |
|
6 | 9 |
|
7 | 10 |
|
8 |
| -pre_temp_1112 <- fread("~/Documents/temp_011_012.csv", sep=",", header=F, data.table=F) |
9 | 11 |
|
10 |
| -li_11 <- fread("~/Documents/heart_011.csv", sep=",", header=F, data.table=F) |
11 | 12 |
|
12 | 13 |
|
13 | 14 |
|
14 | 15 |
|
15 | 16 |
|
| 17 | +makedt_for_animal <- function(subdt){ |
16 | 18 |
|
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 |
37 | 22 |
|
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 | + } |
45 | 26 |
|
46 |
| -heart_table <- sapply(filecol, read.csv) |
47 | 27 |
|
| 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))] |
48 | 31 |
|
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) |
50 | 37 |
|
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] |
56 | 39 |
|
| 40 | +master_table_v2[test] |
0 commit comments