Re: [R] dates and time series management

2013-06-05 Thread arun
Hi, I think it is due to the missing values: I get warnings()  z.5.annualMax<- daily2annual(z, FUN=max, na.rm=TRUE,dates=1) #There were 50 or more warnings (use warnings() to see the first 50) write.csv(z.5max.annual, file = "Stations.csv") Just to validate  the result: I tried this: res3<- lap

Re: [R] dates and time series management

2013-06-05 Thread arun
Hi, Try this: lstf1<- list.files(pattern=".txt") length(lstf1) #[1] 119 #I changed the function a little bit to unlist by rows to match the dates column I created. fun2<- function(lstf){  lst1<-lapply(lstf,function(x) readLines(x))  lst2<-lapply(lst1,function(x) {gsub("(\\d+)(-.99)","\\1 \\2"

Re: [R] dates and time series management

2013-06-05 Thread arun
Hi Atem, No problem.  which(res==-.99) # [1]   18246  397379  420059  426569  427109  603659  604199  662518  664678 #[10]  698982  699522  700062  701142  754745 1289823 1500490 1589487 1716011 #[19] 1837083  which(res==-.99,arr.ind=TRUE) #    row col #1506   1506   2 #12359 12359  2

Re: [R] dates and time series management

2013-06-05 Thread arun
Hi, Try this: lstf1<- list.files(pattern=".txt") length(lstf1) #[1] 119 fun2<- function(lstf){  lst1<-lapply(lstf,function(x) readLines(x))  lst2<-lapply(lst1,function(x) {gsub("(\\d+)(-.99)","\\1 \\2",x)})  lst3<-lapply(lst2,function(x) {x<-gsub("(\\d+)(-.99)","\\1 \\2",x)})  lst4<- lapply

Re: [R] dates and time series management

2013-06-04 Thread Zilefac Elvis
Hi A.K, I go an error on line 24 when processing all the 100 files: res<-fun1(lstf1) Error in read.table(x, sep = "", header = TRUE, stringsAsFactors = FALSE) :    more columns than column names There seem to be a difference between lstf and lstf1. Thanks, Atem. ___

Re: [R] dates and time series management

2013-06-04 Thread arun
Hi, Forgot that you wanted the result in a data.frame fun1<- function(lstf){ lst1<-lapply(lstf,function(x) read.table(x,sep="",header=TRUE,stringsAsFactors=FALSE)) lst2<- lapply(lst1,function(x) x[x$V1>=1961 & x$V1<=2005,]) lst3<- lapply(lst2,function(x) { if((m

Re: [R] dates and time series management

2013-06-04 Thread arun
Hi, May be this helps: I duplicated your dataset (only one was attached) and changed the dates. lstf1<- list.files(pattern=".txt") lstf1 #[1] "dt3031093-1.txt" "dt3031093-2.txt" "dt3031093-3.txt" #3rd one has less number of observations. fun1<- function(lstf){      lst1<-lapply(lstf,function(x