[R] switch function

2010-05-27 Thread arnaud Gaboury
Dear group, Here is my df : trades - structure(list(Trade.Status = c(DEL, INS, INS), Instrument.Long.Name = c(SUGAR NO.11, CORN, CORN), Delivery.Prompt.Date = c(Jul/10, Jul/10, Jul/10), Buy.Sell..Cleared. = c(Sell, Buy, Buy), Volume = c(1L, 2L, 1L), Price = c(15.2500, 368., 368.5000),

Re: [R] switch function

2010-05-27 Thread arnaud Gaboury
Maybe should I be more precise. Here is what I have : trades - structure(list(Trade.Status = c(DEL, INS, INS), Instrument.Long.Name = c(SUGAR NO.11, CORN, CORN), Delivery.Prompt.Date = c(Jul/10, Jul/10, Jul/10), Buy.Sell..Cleared. = c(Sell, Buy, Buy), Volume = c(1L, 2L, 1L), Price = c(15.2500,

Re: [R] switch function

2010-05-27 Thread jim holtman
try this: toBuy - trades$Trade.Status == DEL trades$Buy.Sell..Cleared. == Sell toSell - trades$Trade.Status == DEL trades$Buy.Sell..Cleared. == Buy x - trades # make a copy to change x$Buy.Sell..Cleared.[toBuy] - Buy x$Buy.Sell..Cleared.[toSell] - Sell x Trade.Status

Re: [R] switch function

2010-05-27 Thread arnaud Gaboury
: Thursday, May 27, 2010 2:34 PM To: arnaud Gaboury Cc: r-help@r-project.org Subject: Re: [R] switch function try this: toBuy - trades$Trade.Status == DEL trades$Buy.Sell..Cleared. == Sell toSell - trades$Trade.Status == DEL trades$Buy.Sell..Cleared. == Buy x - trades # make a copy