[R-sig-Finance] Data management question
Gabor Grothendieck
ggrothendieck at gmail.com
Tue Jul 4 15:43:44 CEST 2006
This will create a zoo object. Replace textConnection(Lines), which
I have used here to keep it self contained, with your file name, e.g.
"myfile.dat"
# test data
Lines <- "Date ticker price
06/1/06 A 1
06/2/06 A 2
06/1/06 B 1
06/2/06 B 2
06/1/06 C 1
06/2/06 C 2
"
library(zoo)
z <- read.zoo(textConnection(Lines), header = TRUE, format = "%m/%d/%y")
do.call(merge, split(z[,2], z[,1]))
On 6/30/06, Daye, Wilfred <wilfred.daye at dbzco.com> wrote:
> I have a text file data that looks like this
>
> Date ticker price
> 06/1/06 A x1
> 06/2/06 A x2
> ;; ;; ;;
> 06/1/06 B y1
> 06/2/06 B y2
> ;; ;; ;;
> 06/1/06 C z1
> 06/2/06 C z2
> ;; ;; ;;
>
> So on
>
> I want to arrange tickers as column fields and match the time series
> price by date.
> To be
>
> Date A B C
> 06/1/06 x1 y1 z1
>
>
> The time series per ticker does not necessarily equal to those of others
>
> Thx in advance
>
>
>
>
> This e-mail message is intended only for the named recipient(s) above. It may contain confidential information. If you are not the intended recipient, you are hereby notified that any use, dissemination, distribution or copying of this e-mail and any attachment(s) is strictly prohibited. D.B. Zwirn & Co., L.P. reserves the right to archive and monitor all e-mail communications through its networks. If you have received this e-mail in error, please immediately notify the sender by replying to this e-mail and delete the message and any attachment(s) from your system. Thank you.
>
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> R-SIG-Finance at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
>
More information about the R-SIG-Finance
mailing list