[R] Calcuting returns

Amelia Vettori amelia_vettori at yahoo.co.nz
Thu Jan 6 19:07:33 CET 2011


Dear R forum helpers,I have following datatrans <- data.frame(currency_transacted = c("EURO", "USD", "USD", "GBP", "USD", "AUD"), position_amt = c(10000, 25000, 20000, 15000, 22000, 30000))date <- c("12/31/2010", "12/30/2010", "12/29/2010", "12/28/2010", "12/27/2010", "12/24/2010", "12/23/2010", "12/22/2010", "12/21/2010", "12/20/2010")USD  <- c(112.05, 112.9, 110.85, 109.63, 108.08, 111.23, 112.49, 108.87, 109.33, 111.88)GBP  <- c(171.52, 168.27,169.03, 169.64, 169.29, 169.47, 170.9, 168.69, 170.9, 169.96)EURO <- c(42.71, 42.68, 41.86, 44.71, 44.14, 44.58, 41.07, 42.23, 44.55, 41.12)CHF  <- c(41.5, 41.47, 42.84, 43.44, 43.69, 42.3, 42.05, 41.23, 42.76, 43.79)AUD  <- c(109.55, 102.52, 114.91, 122.48, 122.12, 123.96, 100.36, 110.19, 121.58, 103.46)These are the exchange rates and I am trying calculating the returns. I am giving only a small portion of actual data as I can't send this as an attachment.Actually, I have stored these as csv files (i.e. as
 transactions.csv and currency.csv files respectively) in my






More information about the R-help mailing list