Displaying 2 results from an estimated 2 matches for "currency_transact".
Did you mean:
currency_transacted
2011 Jan 06
1
Calcuting returns
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"...
2011 Jan 07
1
Calculating Returns : (Extremely sorry for earlier incomplete mail)
...currency_rate_returns[i] = log(rate[i]/rate[i+1])
}
currency_rate_returns
return(data.frame(returns = currency_rate_returns))
}
# _______________________________________________
spot_returns_table <- lapply(1:nrow(trans), function(z) with(trans[z, ], spot_trans(currency_trans=trans$currency_transacted)))
spot_returns_table
This generates the output as given below with 30 warnings. Also, as there are six transactions, 6 outputs are generated but the output in all pertains only to the first transacations i.e. 6 times returns are generated for the first transaction "EURO"
> warnin...