> From: jim holtman [mailto:jholt...@gmail.com]
> Sent: 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.Sel
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.S
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, 1
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", "
4 matches
Mail list logo