Re: [R] Question related to merging zoo objects and apply function

2009-07-15 Thread Sergey Goriatchev
Hello, Gabor Generally, I follow the r-help rules and provide working code snippets to illustrate the problem. In this case it was more methodological question of how to loop names in merge() function. I solved this very simply buy renaming specific columns after I have ran merge(). Thank you for

Re: [R] Question related to merging zoo objects and apply function

2009-07-15 Thread Gabor Grothendieck
Please read the last line of every message to r-help. In particular simplify this as much as possible and construct some small artificial test data to illustrate. Anyways, func is probably not what you want. It has the same effect as func <- function(x, j) x[72+j] + [144+j] On Wed, Jul 15, 2009

[R] Question related to merging zoo objects and apply function

2009-07-15 Thread Sergey Goriatchev
Hello everyone, Say I have defined a convenience function in my code like this: func <- function(x, j){ x[168+j] <- x[72+j]+x[144+j] } And now I apply it to some columns in a big zoo object like this: for (m in 1:24){ combined <- merge(combined, LA1sum=apply(combined, 1, func,