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),
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,
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
: 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
4 matches
Mail list logo