I'm facing a problem with making columns using loop.
I have a xts dataset and it's second-by-second data.
It's start from
2014-09-01 00:00:00 104.172
2014-09-01 00:00:01 104.170
2014-09-01 00:00:02 104.170
2014-09-01 00:00:03 104.170
2014-09-01 00:00:04 104.170
2014-09-01 00:00:05 104.170
and end up with
2014-09-30 03:59:43 109.312
2014-09-30 03:59:44 109.312
2014-09-30 03:59:45 109.312
2014-09-30 03:59:46 109.312
2014-09-30 03:59:47 109.312
2014-09-30 03:59:48 109.313
I would like to make nth day columns from this data set. So I did something like this
for(i in 1:30){ask[i] <- ask[.indexmday(ask) == i]}
but it didn't work. Instead, I got a warning
number of items to replace is not a multiple of replacement length
When I do
asksep1 <- ask[.indexmday(ask) == 1]
it works and I can get Sep-1st data. So I think there's something wrong with my loop.
How can I do that? Thanks for any help!