qar_to_usd(100)
usd_to_eur(50)
eur_to_qar(25)
qatarcars$price_eur <- qar_to_eur(qatarcars$price)
qatarcars$price_usd <- qar_to_usd(qatarcars$price)
qatarcars[, c("origin", "make", "model", "price", "price_eur", "price_usd")]
# Labels are updated automatically
str(qatarcars$price)
str(qatarcars$price_eur)
str(qatarcars$price_usd)
if (require("dplyr")) {
qatarcars |>
mutate(
price_eur = qar_to_eur(price),
price_usd = qar_to_usd(price)
) |>
select(origin, make, model, starts_with("price"))
}
Run the code above in your browser using DataLab