This repository was archived by the owner on May 23, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWhiteRef.R
More file actions
49 lines (39 loc) · 1.29 KB
/
Copy pathWhiteRef.R
File metadata and controls
49 lines (39 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#framate data contained in a list of files
dataformatwhite <- function(white){
i <- 1
#read white standard files and find
for (i in 1:length(white)) {
#read data and format into numeric data type and convert to wide format
wdata <-
read.csv(white[i], stringsAsFactors = FALSE)
wdata <- wdata[-1]
wdata[3] <- rep_len('white', nrow(wdata))
wdata[4] <- rep_len(i, nrow(wdata))
colnames(wdata) <- c('wave', 'val', 'con', 'rep')
#Clean up insterment quirks and normalize to total light recoreded
wdata <- tail(wdata, -163) #remove first 20 rows
if (min(wdata$val) < 0) {
wdata$val <- wdata$val + (-1 * min(wdata$val))
}
wdata$val <- wdata$val / max(wdata$val)
#conditonal loop data storage
if (i == 1) {
wfulldata <- wdata
}
if (i != 1) {
wfulldata <- rbind(wfulldata, wdata)
}
}
#here we round wave lenght then combine the vals
wfulldata$wave <- round(wfulldata$wave)
wfulldata <- wfulldata %>%
dplyr::group_by(wave, rep, con) %>%
dplyr::summarise(val = mean(val))
wfulldata <- as.data.frame(wfulldata)
#Average all rwplicates
wfulldata <- wfulldata %>%
dplyr::group_by(wave) %>%
dplyr::summarise(ave = mean(val))
wfulldata <- as.data.frame(wfulldata)
return(wfulldata)
}