Dear R helpers,

I have two separate data frames. In one data frame the transaction data is 
stored and the other data frame has exchange rates stored say rate_A and rate_B 
where rate_A and rate_B are series of rates. 

rate_A and rate_B are properly defined and I am reading them through the 
appropriate dataframe. (Actually I have a different datasets and to try to keep 
things simple, I am defining it as above).

I have BUY or SELL transaction (defined under the column head Type in 
transactions dataframe) and depending on the type of transaction, I need to 
define the rates. 

So if the type is BUY, rate_1 = rate_A and rate_2 = rate_B and if the type is 
SELL, rate_1 = rate_B and rate_2 = rate_A.

To begin with I have only one transaction in my data frame (I am not aware if 
it is BUY or SELL transaction)


Thus, I tried


if(Type == "Buy") 

{rate_1 = rate_A & rate_2 = rate_B} else {rate_1 = rate_B & rate_2 = rate_A}    
   

I get following error
    
Error in rate_A & rate_2 = rate_B 
  could not find function "&<-"
    
How do I define multiple conditional statements?

Kindly guide.

Vincy     
    

        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to