[R] Reading data with two rows of variable names using read.zoo

2015-07-28 Thread 김상환
Dear R gurus. I have a data file which has two rows of variable names. And the time index has a little unusual format. I have no idea how to handle two names and awkward indexing for the quarters. Lines <- " Index; UK; UK; JP; JP Index; a1; a2; a1; a2 2009 2/4;2;4;3;2 2009 3/4;5;2;1;4 2009 4/4;7;

[R] Help on converting a daily zoo to a weekly zoo

2010-11-26 Thread 김상환
Dear R-gurus: I want to convert a zoo object of daily stock prices to a weekly one, based on the following 4 steps. 1. No problem in creating weekly data using Wednesday Obs. wed.index <- ( weekdays(index(daily)) == "Wed" ) week.dat <- daily[wed.index] > week.dat A10 A20 A30 A00

[R] rollapply on zoo object

2007-11-30 Thread 김상환
Dear R users. I have zoo object "size_june" containing market-capital values: > dim(size_june) # market-cap data of 625 firms for 20 years [1] 20 625 > class(size_june) [1] "zoo" > size_june # colnames = "size.firmcode" size.34020 size.4710 size.11050 size.10660 size.9540 size.8060