This repository has been archived by the owner on Jul 2, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathIrga.R
64 lines (36 loc) · 1.64 KB
/
Irga.R
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
50
51
52
53
54
55
56
57
##Requires ggplot2
unraw <- function(file, type = "csv", save = FALSE){
#check arguments
if(!type %in% c("csv", "xls")){stop("Argument type not recognised, must be either \"csv\" or \"xls\"")}
if(type == "csv"){
con <- file(file, open = "rt", raw = T)
text <- readLines(con, skipNul = T)
close(con)
text <- text[11:length(text)]
text <- text[-2]
text <- text[- grep("Remark", text)]
text <- text[- grep("\"", text)]
text <- strsplit(text, split =",")
text <- data.frame(matrix(unlist(text), nrow = length(text), byrow = T), stringsAsFactors = F)
text[1,] <- as.character(text[1,])
colnames(text) <- text[1, ]
text <- text[-1,]
text
}
#if(type == "xls"){
# data = read.xlsx(file, sheetIndex = 1, header = TRUE, startRow = 1)
#
#}
}
plotcurve <- function(data, curve = "light"){
#check arguments
if(!curve %in% c("light", "aci")){stop("curve must be ether \"light\" or \"aci\"")}
if(curve == "light"){
data$PARi <- as.numeric(data$PARi)
data$Photo <- as.numeric(data$Photo)
plot <- ggplot(data, aes(data$PARi, data$Photo)) + stat_smooth()
}
if(curve == "aci"){
}
plot
}