[R] renaming multiple columns + interpolating temperature series

tomtomme langkamp at tomblog.de
Tue Jun 28 19:23:30 CEST 2011


Greetings R Users, 
I´m new to R but at least managed to read in multiple files:

filenames <- list.files(path=getwd())  
numfiles <- length(filenames) 
for (all_temp in c(1:numfiles)) {
  filenames[all_temp] <- paste(filenames[all_temp],sep="")
 
assign(gsub("[.]ASC$","temp",filenames[all_temp]),read.delim2(filenames[all_temp],
fileEncoding="ISO-8859-15", skip = 4))
  }

Now I want to change the column names on the fly within the above loop. How?
I only found out for one file:

  colnames(w01_10temp) <- c("date", "time", "temp", "na")

I want then to lineary interpolate "date", "time" and "temp" from the
original 5 to 1 second interval for all the files, like:

old:
	date	         time	         temp 	na
1	22.05.11	16:00:00	23.653	NA
2	22.05.11	16:00:05	23.541	NA
...

new:
	date	         time	         temp 	na
1	22.05.11	16:00:00	23.653	NA
2	22.05.11	16:00:01	23.631	NA
3	22.05.11	16:00:02	23.609	NA
 ...

I already found out about the zoo package, but could not really figure out
how to use it correctly...
Thanks for any help.

--
View this message in context: http://r.789695.n4.nabble.com/renaming-multiple-columns-interpolating-temperature-series-tp3630927p3630927.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list