I have a price dataframe dat
and a second dataframe with currencies cur
. What i want to do is to transform every non-EUR price in dat
into
I think this would be much easier as a merge/join operation. Using tidy verse you can do
library(tidyverse)
dat <- read_table("Nation Price
AT 10
AT 12
BE 15
BG 30
BG 40
CZ 200")
cur <- read_table("Nation Rate
BG 0.51
CZ 0.03918")
dat %>% left_join(cur) %>%
mutate(Rate=coalesce(Rate, 1)) %>%
mutate(EPrice = Price * Rate)
The only trick here is to change the Rate for those nations not in the cur
table to 1.