Raman2df() now includes evenly spaced spectrum in return dataframe.

It appears this will be such a common operation that it is worth
including in the fetch function itself.
master
Taha Ahmed 14 years ago
parent aadd16e605
commit 9d67dbfad2

@ -36,6 +36,12 @@ Raman2df <- function(datafilename) {
ff <- ff[order(ff$shift), ] ff <- ff[order(ff$shift), ]
# And fix the row.names # And fix the row.names
row.names(ff) <- seq(1, dim(ff)[1]) row.names(ff) <- seq(1, dim(ff)[1])
# Re-calculate the spectrum with evenly spaced points
# (so that the peak-finding algorithms of diffractometry package may be used)
ff$cshift <- approx(x = ff$shift, y = ff$counts,
method = "linear", n = length(ff$shift))$x
ff$ccounts <- approx(x = ff$shift, y = ff$counts,
method = "linear", n = length(ff$shift))$y
## ##
return(ff) return(ff)
} }

Loading…
Cancel
Save