You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
925 B
R
36 lines
925 B
R
# Renishaw.R
|
|
# Functions to read data from the Renishaw Raman spectrometer
|
|
# Taha Ahmed, Feb 2011
|
|
|
|
# CONTENTS
|
|
source("/home/taha/chepec/chetex/common/R/common.R")
|
|
# >>>> Raman2df
|
|
|
|
|
|
|
|
|
|
|
|
##################################################
|
|
################### Raman2df #######################
|
|
##################################################
|
|
Raman2df <- function(datafilename) {
|
|
# Function description: for reading Raman spectrum into dataframe
|
|
#
|
|
datafile <- file(datafilename, "r")
|
|
chifile <- readLines(datafile, n = -1) #read all lines of input file
|
|
close(datafile)
|
|
#
|
|
#####
|
|
sampleid <- ProvideSampleId(datafilename)
|
|
#
|
|
ff <- data.frame(NULL)
|
|
zz <- textConnection(chifile, "r")
|
|
ff <- rbind(ff, data.frame(sampleid,
|
|
matrix(scan(zz, what = numeric(), sep = "\t"),
|
|
ncol = 2, byrow = T)))
|
|
close(zz)
|
|
names(ff) <- c("sampleid", "shift", "counts")
|
|
#
|
|
return(ff)
|
|
}
|