Convert between QAR, USD, and EUR

Description

Functions to convert between Qatari Riyals (QAR), US Dollars (USD), and Euros (EUR) using exchange rates from the time of data collection in January 2025.

Usage

qar_to_usd(qar)

qar_to_eur(qar)

usd_to_qar(usd)

usd_to_eur(usd)

eur_to_qar(eur)

eur_to_usd(eur)

Arguments

qar numeric vector of values in Qatari Riyals
usd numeric vector of values in US Dollars
eur numeric vector of values in Euros

Details

Exchange rates in January 2025:

  • 1 USD = 3.64 QAR

  • 1 EUR = 4.15 QAR

Value

Numeric vector of converted currency amounts

Examples

[1] 27.47253
[1] 43.85542
[1] 103.75
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")]
# A tibble: 105 × 6
   origin  make     model            price price_eur price_usd
   <fct>   <fct>    <fct>            <dbl>     <dbl>     <dbl>
 1 Germany BMW      3 Series Sedan  164257    39580     45126.
 2 Germany BMW      X1              264000    63614.    72527.
 3 Germany Audi     RS Q8           630000   151807.   173077.
 4 Germany Audi     RS3             310000    74699.    85165.
 5 Germany Audi     A3              165000    39759.    45330.
 6 Germany Mercedes Maybach        1281000   308675.   351923.
 7 Germany Mercedes G-Wagon        1011500   243735.   277885.
 8 Germany Mercedes EQS             564500   136024.   155082.
 9 Germany Mercedes GLA             209500    50482.    57555.
10 Germany Mercedes GLB 200         168997    40722.    46428.
# ℹ 95 more rows
# Labels are updated automatically
str(qatarcars$price)
 num [1:105] 164257 264000 630000 310000 165000 ...
 - attr(*, "label")= chr "Price (QAR)"
str(qatarcars$price_eur)
 num [1:105] 39580 63614 151807 74699 39759 ...
 - attr(*, "label")= chr "Price (EUR)"
str(qatarcars$price_usd)
 num [1:105] 45126 72527 173077 85165 45330 ...
 - attr(*, "label")= chr "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"))
}
# A tibble: 105 × 6
   origin  make     model            price price_eur price_usd
   <fct>   <fct>    <fct>            <dbl>     <dbl>     <dbl>
 1 Germany BMW      3 Series Sedan  164257    39580     45126.
 2 Germany BMW      X1              264000    63614.    72527.
 3 Germany Audi     RS Q8           630000   151807.   173077.
 4 Germany Audi     RS3             310000    74699.    85165.
 5 Germany Audi     A3              165000    39759.    45330.
 6 Germany Mercedes Maybach        1281000   308675.   351923.
 7 Germany Mercedes G-Wagon        1011500   243735.   277885.
 8 Germany Mercedes EQS             564500   136024.   155082.
 9 Germany Mercedes GLA             209500    50482.    57555.
10 Germany Mercedes GLB 200         168997    40722.    46428.
# ℹ 95 more rows