I'm very new to R and just wrote this to obtain the mean for a number of timeseries in one file:
compiled<-read.table("/Users/Desktop/A/1.txt", header=TRUE)
z<-ncol(compiled)
comp_df<-data.frame(compiled[,2:z])
indmean<- rowMeans(comp_df)
The data in each file looks something like this:
Time A1 A2 A3 A4 A5
1 0.1 0.2 0.1 0.2 0.3
2 0.2 0.3 0.4 0.2 0.3
...
It works fine but I am hoping to apply this to many files of the same nature, with varying numbers of timeseries in each file. If anyone could advise on how I can improve the above to do so, it would be great. Thank you in advance!