Package 'qatarcars'

Title: Data on Cars in Qatar
Description: Fuel economy, size, performance, and price data for cars in Qatar in 2025. Mirrors many of the columns in mtcars, but uses (1) non-US-centric makes and models, (2) 2025 prices, and (3) metric measurements, making it more appropriate for use as an example dataset outside the United States. For more details see Musgrave (2025) <doi:10.1080/15512169.2025.2572320>.
Authors: Paul Musgrave [aut, cre, cph] (ORCID: <https://orcid.org/0000-0002-8984-4992>), Andrew Heiss [aut] (ORCID: <https://orcid.org/0000-0002-3948-3914>)
Maintainer: Paul Musgrave <[email protected]>
License: CC BY 4.0
Version: 1.1.0
Built: 2026-05-14 05:13:24 UTC
Source: https://github.com/profmusgrave/qatarcars

Help Index


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

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"))
}

Qatar maroon color

Description

The official colors of the Qatari flag are white and Pantone 1955 C, or "Qatar maroon." The hex representation of this color is ⁠#8A1538⁠.

Usage

qatar_maroon

Format

A character string containing a hex color code.

Source

https://en.wikipedia.org/wiki/Flag_of_Qatar

Examples

qatar_maroon

hist(qatarcars$length, breaks = 15, col = qatar_maroon, border = "white")

if (require("ggplot2")) {
  ggplot(qatarcars, aes(x = length)) +
    geom_histogram(bins = 15, fill = qatar_maroon, color = "white")
}

Fuel economy, size, performance, and price data for cars in Qatar

Description

Includes prices and other specifications taken from YallaMotors Qatar between January to August 2025

Usage

qatarcars

Format

A tibble with 105 rows and 15 variables:

origin

a factor denoting car country of origin

make

a factor denoting car make

model

a factor denoting car model

length

a number denoting car length (meters)

width

a number denoting car width (meters)

height

a number denoting car height (meters)

seating

a number denoting number of seats in car

trunk

a number denoting volume of trunk (liters)

economy

a number denoting car fuel economy (L/100km)

horsepower

a number denoting car horsepower

price

a number denoting car price (2025 Qatari riyals (QAR))

mass

a number denoting car mass (kilograms)

performance

a number denoting car performance (Time 0-100 km/h (seconds))

type

a factor denoting car type

enginetype

a factor denoting car engine type

Source

https://github.com/profmusgrave/qatarcars

https://open.substack.com/pub/musgrave/p/introducing-the-qatar-cars-dataset

Yalla Motors Qatar

Examples

str(qatarcars)
head(qatarcars)
summary(qatarcars)
table(qatarcars$origin)
aggregate(price ~ enginetype, qatarcars, mean)
barplot(table(factor(
  qatarcars$seating,
  levels = min(qatarcars$seating):max(qatarcars$seating)
)))
plot(economy ~ mass, qatarcars)
plot(price ~ performance, qatarcars, log = "y")

if (require("dplyr")) {
  glimpse(qatarcars)
}

if (require("dplyr")) {
  qatarcars |> 
    count(origin)
}

if (require("dplyr")) {
  qatarcars |> 
    group_by(enginetype) |> 
    summarize(avg_price = mean(price))
}

if (require("ggplot2")) {
  ggplot(qatarcars, aes(x = seating)) + 
    geom_bar()
}

if (require("ggplot2")) {
  ggplot(qatarcars, aes(x = mass, y = economy)) + 
    geom_point()
}

if (require("ggplot2")) {
  ggplot(qatarcars, aes(x = performance, y = price)) +
    geom_point() + 
    scale_y_log10()
}