| Type: | Package |
| Title: | Data on Cars in Qatar |
| Version: | 1.1.0 |
| Date: | 2026-02-12 |
| 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>. |
| License: | CC BY 4.0 |
| Encoding: | UTF-8 |
| LazyData: | true |
| RoxygenNote: | 7.3.3.9000 |
| Depends: | R (≥ 4.1.0) |
| URL: | https://profmusgrave.github.io/qatarcars/, https://github.com/profmusgrave/qatarcars |
| BugReports: | https://github.com/profmusgrave/qatarcars/issues |
| Suggests: | altdoc, downlit, dplyr, ggplot2, scales, testthat (≥ 3.0.0), tibble, units, xml2 |
| Config/testthat/edition: | 3 |
| NeedsCompilation: | no |
| Packaged: | 2026-02-12 20:23:13 UTC; andrew |
| Author: | Paul Musgrave |
| Maintainer: | Paul Musgrave <rpm47@georgetown.edu> |
| Repository: | CRAN |
| Date/Publication: | 2026-02-13 09:40:08 UTC |
qatarcars: 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.
Author(s)
Maintainer: Paul Musgrave rpm47@georgetown.edu (ORCID) [copyright holder]
Authors:
Andrew Heiss andrew@andrewheiss.com (ORCID)
See Also
Useful links:
Report bugs at https://github.com/profmusgrave/qatarcars/issues
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()
}
Add a label attribute to an input value only if it already has a label attribute
Description
This is useful with conversion functions since columns in qatarcars have
labels already, and if a conversion function is used on them, that label
carries over.
Usage
set_label(value, original, label)