[R] Manipulating DataSets

Charles C. Berry cberry at tajo.ucsd.edu
Fri Jun 6 19:14:12 CEST 2008


On Fri, 6 Jun 2008, Neil Gupta wrote:

> Hello R-users,
>
> I have a very simple problem I wanted to solve. I have a large dataset as
> such:
>   Lag  X.Symbol     Time TickType ReferenceNumber  Price Size  X.Symbol.1
> Time.1 TickType.1 ReferenceNumber.1
> 1  ES 3:ESZ7.GB 08:30:00        B        74390987 151075   44
> 3:ESZ7.GB08:30:00          A          74390988
> 2  ES 3:YMZ7.EC 08:30:00        B        74390993  13686   17
> 3:YMZ7.EC08:30:00          A          74390994
> 3  YM 3:ESZ7.GB 08:30:00        B        74391135 151075   49
> 3:ESZ7.GB08:30:00          A          74391136
> 4  YM 3:YMZ7.EC 08:30:00        B        74390998  13686   17
> 3:YMZ7.EC08:30:00          A          74390999
> 5  YM 3:ESZ7.GB 08:30:00        B        74391135 151075   49
> 3:ESZ7.GB08:30:00          A          74391136
> 6  YM 3:YMZ7.EC 08:30:00        B        74391000  13686   14
> 3:YMZ7.EC08:30:00          A          74391001
>  Price.1 Size.1  LeadTime MidPoint Spread
> 1  151100     22  08:30:00 *151087.5*     25
> 2   13688     27  08:30:00  13687.0      2
> 3  151100     22  08:30:00 *151087.5*     25
> 4   13688     27  08:30:00  13687.0      2
> 5  151100     22  08:30:00 151087.5     25
> 6   13688     27  08:30:00  13687.0      2
>
>
> All I wanted to do was take the Log(MidPoint[2]) - Log(MidPoint[1]) for a
> symbol "3:ESZ7.GB"
> So the first one would be log(151087.5) - log(151087.5). I wanted to do this
> throughout the data set and add that in another column. I would appreciate
> any help.


See

 	example( split )

Note the "### data frame variation", which should serve as a template for 
your problem.

HTH,

Chuck


>
> Regards,
>
> Neil Gupta
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

Charles C. Berry                            (858) 534-2098
                                             Dept of Family/Preventive Medicine
E mailto:cberry at tajo.ucsd.edu	            UC San Diego
http://famprevmed.ucsd.edu/faculty/cberry/  La Jolla, San Diego 92093-0901



More information about the R-help mailing list