From 9d67dbfad28a46e29cbd89033f486234cb8c13f8 Mon Sep 17 00:00:00 2001 From: Taha Ahmed Date: Fri, 15 Apr 2011 11:48:38 +0200 Subject: [PATCH] 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. --- Renishaw.R | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Renishaw.R b/Renishaw.R index fbb5157..555f545 100644 --- a/Renishaw.R +++ b/Renishaw.R @@ -36,6 +36,12 @@ Raman2df <- function(datafilename) { ff <- ff[order(ff$shift), ] # And fix the row.names 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) }