Displaying 2 results from an estimated 2 matches for "usd_o_n".
2013 Apr 16
3
Splitting the Elements of character vector
Dear R forum
I have a data.frame
df = data.frame(currency_type = c("EURO_o_n", "EURO_o_n", "EURO_1w", "EURO_1w", "USD_o_n", "USD_o_n", "USD_1w", "USD_1w"), rates = c(0.47, 0.475, 0.461, 0.464, 1.21, 1.19, 1.41, 1.43))
currency_type rates
1 EURO_o_n 0.470
2 EURO_o_n 0.475
3 EURO_1w 0.461
4 EURO_1w 0.464
5 USD_o_n 1.210
6 USD_o_n 1...
2013 Apr 03
4
Better way of writing R code
..._________________________________________
Depending on the maturity period, I have defined discount rates as
# FOR USD
if
(as.character(currency) ==
"USD")
{
if
(as.character(other_currency) == "GBP" & days_to_maturity <= 1)
{
libor_rate1 = df_LIBOR_rates$USD_o_n
libor_rate2 = df_LIBOR_rates$GBP_o_n
}
else if (as.character(other_currency) == "EURO" & days_to_maturity <= 1)
{
libor_rate1 = df_LIBOR_rates$USD_o_n
libor_rate2 = df_LIBOR_rates$EUR_o_n
}
......................
......................
if
(as.character(other_...