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 pathdatarecord.R
More file actions
56 lines (32 loc) · 1.26 KB
/
Copy pathdatarecord.R
File metadata and controls
56 lines (32 loc) · 1.26 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
50
51
52
53
54
55
56
setwd('C:/Users/cchampio/Dropbox/demeter')
condition <- 'salt'
area <- 'leaf'
date <- Sys.time()
filename <- paste(condition, area, date, sep = '.')
#read data in
x <- readClipboard()
#remove first row, extranious data
x <- x[-1]
#convert to data frame
foo <- data.frame(do.call('rbind', strsplit(as.character(x),'\t',fixed=TRUE)))
#convert to numeric data type and rename coulmns
asNumeric <- function(x) as.numeric(as.character(x))
factorsNumeric <- function(d) modifyList(d, lapply(d[, sapply(d, is.factor)],
asNumeric))
f <- factorsNumeric(foo)
colnames(f) <- c('wave', 'value')
###################csv archive
setwd('./csv_archive')
meta <- data.frame(filename, date, condition, area)
write.csv(meta, "metadata.csv", append = TRUE)
filename <- gsub(" ", "", filename, fixed = T)
filename <- gsub(":", "_", filename, fixed = T)
write.csv(f, paste(filename, '.csv', sep = ''))
##sql database
################
#reflectance calulation
#pams to use, 1-5 boxcar, 40ms to 1 sec, 10 scanes to average, normalize to max vaules
#data <- 100
#background <- 1
#ref <- 100
#(((data-background)/(ref-background)))*100