32I have several zoo ordered observations that contain data indexed by date. For example (HTML used for spacing):
A B
2014-10-5 60.272 84.019
2014-10-6 61.183 84.024
2014-10-7 61.611 84.010
A B
2014-10-5 61.376 84.028
2014-10-6 61.761 84.032
2014-10-7 62.210 84.025
A B
2014-10-5 61.159 84.006
2014-10-6 61.550 84.029
2014-10-7 61.996 84.024
I have 3 of these objects, say, x, y, and z, with different data in each.
I want to extract data (from last row) from these and put them into a non-zoo data frame because I no longer want the date indexing. Here is what I tried to do:
main.result <- data.frame(x[nrow(x),])
main.result <- data.frame(rbind(main.result, y[nrow(y),]))
main.result <- data.frame(rbind(main.result, z[nrow(z),]))
What is get is not what I expected in main.result:
A B
main.result 61.61163, 62.21080 84.02096, 84.02505
61.99627 84.02423
I should have gotten:
A B
61.611 84.010
62.210 84.025
61.996 84.024
I want to continue to add rows to the main.result matrix. Where am I jumping the track here?
SOLVED: Sorry, the formatting of the output for ‘main.result’ threw me off. The answer I am getting is correct. Please disregard this post!!