Skip to content

Conversation

UniversidadNacionalAsuncion

Hi @wch,

I added a conversion of the base R cars dataset into SI units and included the conversion script in my repository: https://github.com/UniversidadNacionalAsuncion/Modelos_Lineales_Generalizados/blob/main/Regresi%C3%B3n%20Lineal%20con%20R/mbayru-script.R

Summary of what the script does

  • Loads cars from datasets::cars.
  • Computes SI columns:
    • speed_ms = speed (mph) × 0.44704 → meters/second
    • dist_m = dist (ft) × 0.3048 → meters
  • Rounds converted values to 6 decimal places for reproducible precision.
  • Writes out a file mbay_ruguata.R that defines mbay_ruguata <- data.frame(...) with the SI columns.
  • Prints usage instructions: source('mbay_ruguata.R').

Why I recommend accepting this change

  • Teaching & reproducibility: Many textbooks and courses use SI units. Providing SI columns removes a common friction point for instructors and students, letting them run examples without adding conversion steps.
  • Interoperability: SI units make the dataset easier to use across modern workflows (including Python users), reducing unit-related errors and improving cross-language reproducibility.
  • Keeps R competitive: Python datasets and libraries often ship with preprocessed, well-documented examples. Small, low-risk improvements like this help keep R’s base datasets immediately useful for contemporary data science workflows.
  • Low risk: The change is non-intrusive — it adds new columns rather than overwriting originals, so existing code that expects the original speed and dist is unaffected.

Technical notes / transparency

  • Conversion constants used in the script:
    • mph_to_ms <- 0.44704 (1 mph = 0.44704 m/s)
    • ft_to_m <- 0.3048 (1 ft = 0.3048 m)
  • The current script generates the object mbay_ruguata and writes only the SI columns into mbay_ruguata.R. If you prefer:
    1. I can modify the script so the generated R file contains the full dataset (original columns + SI columns), or
    2. I can add the SI columns directly into the repo’s data/cars file so the dataset in-place contains both unit systems.
  • If you have a preferred naming convention (e.g., speed_m_s / dist_m vs speed_ms / dist_m or speed_si / dist_si), tell me which you prefer and I’ll update the PR accordingly.

Requested action

  • Please review the script and the generated data. If acceptable, I’d appreciate merging this change so cars users can immediately work in SI units without extra steps. If you want a different output format or naming convention, I can update the PR right away.

Thanks for maintaining this important resource — small improvements like this have a big impact for teaching and reproducible workflows.

Best,
Derlis Sosa

[email protected]

Hi @wch,

I added a conversion of the base R `cars` dataset into SI units and included the conversion script in my repository:
https://github.com/UniversidadNacionalAsuncion/Modelos_Lineales_Generalizados/blob/main/Regresi%C3%B3n%20Lineal%20con%20R/mbayru-script.R

Summary of what the script does
- Loads `cars` from `datasets::cars`.
- Computes SI columns:
  - `speed_ms` = speed (mph) × 0.44704 → meters/second
  - `dist_m`   = dist (ft)   × 0.3048  → meters
- Rounds converted values to 6 decimal places for reproducible precision.
- Writes out a file `mbay_ruguata.R` that defines `mbay_ruguata <- data.frame(...)` with the SI columns.
- Prints usage instructions: `source('mbay_ruguata.R')`.

Why I recommend accepting this change
- Teaching & reproducibility: Many textbooks and courses use SI units. Providing SI columns removes a common friction point for instructors and students, letting them run examples without adding conversion steps.
- Interoperability: SI units make the dataset easier to use across modern workflows (including Python users), reducing unit-related errors and improving cross-language reproducibility.
- Keeps R competitive: Python datasets and libraries often ship with preprocessed, well-documented examples. Small, low-risk improvements like this help keep R’s base datasets immediately useful for contemporary data science workflows.
- Low risk: The change is non-intrusive — it adds new columns rather than overwriting originals, so existing code that expects the original `speed` and `dist` is unaffected.

Technical notes / transparency
- Conversion constants used in the script:
  - `mph_to_ms <- 0.44704` (1 mph = 0.44704 m/s)
  - `ft_to_m   <- 0.3048`  (1 ft  = 0.3048 m)
- The current script generates the object `mbay_ruguata` and writes only the SI columns into `mbay_ruguata.R`. If you prefer:
  1. I can modify the script so the generated R file contains the full dataset (original columns + SI columns), or
  2. I can add the SI columns directly into the repo’s `data/cars` file so the dataset in-place contains both unit systems.
- If you have a preferred naming convention (e.g., `speed_m_s` / `dist_m` vs `speed_ms` / `dist_m` or `speed_si` / `dist_si`), tell me which you prefer and I’ll update the PR accordingly.

Requested action
- Please review the script and the generated data. If acceptable, I’d appreciate merging this change so `cars` users can immediately work in SI units without extra steps. If you want a different output format or naming convention, I can update the PR right away.

Thanks for maintaining this important resource — small improvements like this have a big impact for teaching and reproducible workflows.

Best,
Derlis Sosa

[email protected]
@gavinsimpson
Copy link

@UniversidadNacionalAsuncion You know this is a read only mirror of the R sources? Nothing is going to happen with this PR. You should file a bug on R's bug tracker if you want this looked at.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants