Re: [R] Automatic creation of columns in zoo object

2009-02-03 Thread Gabor Grothendieck
That's not really in the spirit of R. Normally one works with whole objects at a time. You might wish to rethink your entire approach to this. On Tue, Feb 3, 2009 at 9:11 AM, Sergey Goriatchev wrote: > Dear Gabor, > > Yes, these extra columns are of value as I later write code that fills > in t

Re: [R] Automatic creation of columns in zoo object

2009-02-03 Thread Sergey Goriatchev
It works perfectly! Thank you, Gabor, for the quick solution and for letting me learn sub() function. Supreme! :-) Regards, Sergey On Tue, Feb 3, 2009 at 15:05, Gabor Grothendieck wrote: > Not sure why you need to have all these extra columns if they are only > zero anyways. Could you not appe

Re: [R] Automatic creation of columns in zoo object

2009-02-03 Thread Sergey Goriatchev
Dear Gabor, Yes, these extra columns are of value as I later write code that fills in those columns row by row conditional on some event taking place, and when there is no event there should be zero in a particular cell. BIG thanks for the quick reply. I will try the code out right away! Kind Reg

Re: [R] Automatic creation of columns in zoo object

2009-02-03 Thread Gabor Grothendieck
Not sure why you need to have all these extra columns if they are only zero anyways. Could you not append them when you get data for them? Are these placeholders really of any value? At any rate its done using cbind or merge like this: library(zoo) library(chron) nms <- sub(".Comdty", "tr", me.

[R] Automatic creation of columns in zoo object

2009-02-03 Thread Sergey Goriatchev
Hello, everyone I have a question. Assume I have the following zoo object: me.la <- structure(c(1524.75, 1554.5, 1532.25, 1587.5, 1575.25, 1535.5, 1550, 1493.5, 1492.5, 1472.25, 1457.5, 1442.75, 1399, 1535.75, 1565.25, 1543.5, 1598.5, 1586.5, 1547, 1561.5, 1504.75, 1503.75, 1483.75, 1468.75, 145