-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconvert2csv.R
More file actions
28 lines (24 loc) · 1 KB
/
convert2csv.R
File metadata and controls
28 lines (24 loc) · 1 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
#######################
##Converting opus files
#######################
## Read me
##This scripts works with spectral files named using a prefix 3-letter prefix followed
##by a six digit number
## 1. To use the script:
## 2.source the read.opus function
source.path<-source('~/Training/India/Spectral_processing/scripts', chdir = TRUE)#On the same computer remains unchanged
opus.file.path<-'~/HTS-xt_spectra/Kiberashi'
output.path<-'~/HTS-xt_spectra'
file<-"Raw spectra.csv"
source('~/Training/India/Spectral_processing/scripts/read.opus.R', chdir = TRUE,echo=TRUE)
## 3.Change path to point to the folder with OPUS files
lst <- as.list(list.files(path=opus.file.path, pattern=".[0-9]$", full.names=TRUE))
spectra<-c()
for ( i in 1:length(lst)){
spec <- opus(lst[[i]], speclib="ICRAF",plot.spectra=TRUE,print.progress=TRUE)
spectra<-rbind(spectra,spec)
}
#View part of spectra
spectra[,1:8]
setwd(output.path) #set working directory where to store converted folder
write.table(spectra,file=file,sep=",",row.names=FALSE)