Open
Conversation
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 derlisdev@gmail.com
|
@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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi @wch,
I added a conversion of the base R
carsdataset 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.RSummary of what the script does
carsfromdatasets::cars.speed_ms= speed (mph) × 0.44704 → meters/seconddist_m= dist (ft) × 0.3048 → metersmbay_ruguata.Rthat definesmbay_ruguata <- data.frame(...)with the SI columns.source('mbay_ruguata.R').Why I recommend accepting this change
speedanddistis unaffected.Technical notes / transparency
mph_to_ms <- 0.44704(1 mph = 0.44704 m/s)ft_to_m <- 0.3048(1 ft = 0.3048 m)mbay_ruguataand writes only the SI columns intombay_ruguata.R. If you prefer:data/carsfile so the dataset in-place contains both unit systems.speed_m_s/dist_mvsspeed_ms/dist_morspeed_si/dist_si), tell me which you prefer and I’ll update the PR accordingly.Requested action
carsusers 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
derlisdev@gmail.com