Hi there,
I'm trying to perform a fourier transformation on several different files at once, and I'd like to save the resulting vectors of each file as variables with different names so that I can later compile them into 1 dataset. At the moment when I try to print the results I can only obtain results for the 1st file in the list of files. I'd really appreciate a suggestion as to how to give each output a different name so I can access all of them.
rm(list=ls(all.names=TRUE))
dataset <- data.frame()
file.list <- list.files(path="", setnames=TRUE)
> for (i in 1:length(file_list)){
+
+ my_data <- read.table(file_list[i], header = TRUE, sep='\t')
+
+
+ filepath <- file_list[i]
+ title1<-sub(pattern = "(.*)\\..*$", replacement = "\\1", basename(filepath))
+
+ fourierd <- apply(my_data,2,function(x) fft(as.numeric(x))) #it's now a matrix
+
+ fourierdat <- as.data.frame(fourierd)
+
+
+ absTestAll <- abs(fourierdat)
+
+
+ histData <- sapply(absTestAll[2:nrow(absTestAll),], which.max) * 0.977 + 0.977
+ histData.df <- as.data.frame(histData)
+ }