Re: [R] : Quantile and rowMean from multiple files in a folder

2014-04-17 Thread Zilefac Elvis
Hi AK, Thanks very much for the updated code. My simulated results are even more consistent with observations after apply the updated version of the code. Cheers, Atem. On Wednesday, April 16, 2014 11:31 PM, Zilefac Elvis wrote: Hi AK, Thanks very much. Atem. On Wednesday, April 16, 2014

Re: [R] : Quantile and rowMean from multiple files in a folder

2014-04-16 Thread Zilefac Elvis
Hi AK, Thanks very much. Atem. On Wednesday, April 16, 2014 9:32 PM, arun wrote: Hi, Use this code after `lst2`. lapply(seq_along(lst2), function(i) {     lstN <- lapply(lst2[[i]], function(x) {         datN <- as.data.frame(matrix(NA, nrow = 101, ncol = length(names1), dimnames = list(NULL,

Re: [R] : Quantile and rowMean from multiple files in a folder

2014-04-16 Thread arun
Hi, Use this code after `lst2`. lapply(seq_along(lst2), function(i) { lstN <- lapply(lst2[[i]], function(x) { datN <- as.data.frame(matrix(NA, nrow = 101, ncol = length(names1), dimnames = list(NULL, names1))) x1 <- x[, -1] qt <- numcolwise(function(y) quan

Re: [R] : Quantile and rowMean from multiple files in a folder

2014-04-15 Thread Zilefac Elvis
Hi AK, Thanks very much. I worked great. Many thanks. Atem. On Tuesday, April 15, 2014 9:20 AM, arun wrote: Hi Atem, May be this works. ### Q1: working directory: Observed #Only one file per Site.  Assuming this is the ### case for the full dataset, then I guess there is no need to average di

Re: [R] : Quantile and rowMean from multiple files in a folder

2014-04-15 Thread arun
Hi Atem, May be this works. ### Q1: working directory: Observed #Only one file per Site. Assuming this is the ### case for the full dataset, then I guess there is no need to average dir.create("final") lst1 <- split(list.files(pattern = ".csv"), gsub("\\_.*", "", list.files(pattern = ".csv")))

Re: [R] : Quantile and rowMean from multiple files in a folder

2014-04-14 Thread Zilefac Elvis
Hi AK, All codes for simulation files work great. I will try the code for observations and let you know. Thanks very much. Atem. On Tuesday, April 15, 2014 12:01 AM, arun wrote: Yes, my new solution ignores such cases. On Monday, April 14, 2014 11:58 PM, Zilefac Elvis wrote: Hi AK,

Re: [R] Quantile and rowMean from multiple files in a folder

2014-04-14 Thread arun
Hi Atem, I guess this is what you wanted. ###Q1: ### ###working directory: Observed  #Only one file per Site.  Assuming this is the case for the full dataset, then I guess there is no need to average dir.create("final") lst1 <- split(list.files(pattern = ".csv"), gsub("\\_.*", "", list.files(

Re: [R] Quantile and rowMean from multiple files in a folder

2014-04-14 Thread zilefacel...@yahoo.com
Hi AK, Thanks very much. I did send you another email with a larger Sample.zip file. The Quantilecode.R which you initially developed for a smaller sample.zip did not complete the task when I used it for a larger data set. Please check to rectify the error message.

Re: [R] : Quantile and rowMean from multiple files in a folder

2014-04-14 Thread arun
Hi, Q1 solution already sent. Regarding Q2, one of the files in the new Observed folder doesn't have any  data (just the Year column alone). That may be the reason for the problem. ### Q1: working directory: Observed #Only one file per Site.  Assuming this is the ### case for the full data

Re: [R] : Quantile and rowMean from multiple files in a folder

2014-04-14 Thread arun
Hi, It is because of different dimensions of Simulation data  within each Site. Try: dir.create("final") lst1 <- split(list.files(pattern = ".csv"), gsub("\\_.*", "", list.files(pattern = ".csv"))) sapply(lst1,length) #G100 G101 G102 G103 G104 G105 G106 G107 G108 G109 G110 G111 G112 G113 G114 G

Re: [R] Quantile and rowMean from multiple files in a folder

2014-04-13 Thread Zilefac Elvis
Hi AK, I must admit that you did an excellent job. Thanks very much. My analysis is manageable now. Regards, Atem. On Sunday, April 13, 2014 8:54 AM, arun wrote: Hi, I am formatting the codes using library(formatR).  Hopefully, it will not be mangled in the email. dir.create("final") lst1 <- s

Re: [R] Quantile and rowMean from multiple files in a folder

2014-04-13 Thread arun
Hi, I am formatting the codes using library(formatR).  Hopefully, it will not be mangled in the email. dir.create("final") lst1 <- split(list.files(pattern = ".csv"), gsub("\\_.*", "", list.files(pattern = ".csv"))) lst2 <- lapply(lst1, function(x1) lapply(x1, function(x2) { lines1 <- readLine