Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add a function to cite package, data, methodology in different formats #134

Merged

Conversation

e-kotov
Copy link
Member

@e-kotov e-kotov commented Jan 28, 2025

Preview:

> spod_cite("data", "bibtex")

BibTeX citations:
-----------------
@Misc{mitms_mobility_web,
  title = {Estudio de la movilidad con Big Data (Study of mobility with Big Data)},
  author = {{Ministerio de Transportes y Movilidad Sostenible (MITMS)}},
  year = {2024},
  url = {[https://www.transportes.gob.es/ministerio/proyectos-singulares/estudio-de-movilidad-con-big-data](vscode-file://vscode-app/Applications/Positron.app/Contents/Resources/app/out/vs/code/electron-sandbox/workbench/workbench.html#)},
}
> spod_cite("package", "markdown")

Markdown citations:
-------------------
Kotov E, Lovelace R, Vidal-Tortosa E (2024). _spanishoddata_. doi:10.32614/CRAN.package.spanishoddata [https://doi.org/10.32614/CRAN.package.spanishoddata,](vscode-file://vscode-app/Applications/Positron.app/Contents/Resources/app/out/vs/code/electron-sandbox/workbench/workbench.html#)
[https://github.com/rOpenSpain/spanishoddata.](vscode-file://vscode-app/Applications/Positron.app/Contents/Resources/app/out/vs/code/electron-sandbox/workbench/workbench.html#) 
> spod_cite("package", "text")

Plain text citations:
---------------------
Kotov E, Lovelace R, Vidal-Tortosa E (2024). spanishoddata. doi:10.32614/CRAN.package.spanishoddata [https://doi.org/10.32614/CRAN.package.spanishoddata,](vscode-file://vscode-app/Applications/Positron.app/Contents/Resources/app/out/vs/code/electron-sandbox/workbench/workbench.html#)
[https://github.com/rOpenSpain/spanishoddata.](vscode-file://vscode-app/Applications/Positron.app/Contents/Resources/app/out/vs/code/electron-sandbox/workbench/workbench.html#) 

This will cite everything in all formats:

> spod_cite()

Plain text citations:
---------------------
Kotov E, Lovelace R, Vidal-Tortosa E (2024). spanishoddata. doi:10.32614/CRAN.package.spanishoddata [https://doi.org/10.32614/CRAN.package.spanishoddata,](vscode-file://vscode-app/Applications/Positron.app/Contents/Resources/app/out/vs/code/electron-sandbox/workbench/workbench.html#)
[https://github.com/rOpenSpain/spanishoddata.](vscode-file://vscode-app/Applications/Positron.app/Contents/Resources/app/out/vs/code/electron-sandbox/workbench/workbench.html#) 

Ministerio de Transportes y Movilidad Sostenible (MITMS) (2024). “Estudio de la movilidad con Big Data (Study of mobility with Big Data).”
[https://www.transportes.gob.es/ministerio/proyectos-singulares/estudio-de-movilidad-con-big-data.](vscode-file://vscode-app/Applications/Positron.app/Contents/Resources/app/out/vs/code/electron-sandbox/workbench/workbench.html#) 

Ministerio de Transportes, Movilidad y Agenda Urbana (MITMA) (2021). Análisis de la movilidad en España con tecnología Big Data durante el estado de alarma para la gestión de la crisis del
COVID-19 (Analysis of mobility in Spain with Big Data technology during the state of alarm for COVID-19 crisis management).
[https://cdn.mitma.gob.es/portal-web-drupal/covid-19/bigdata/mitma-estudiomovilidadcovid-19informemetodologico_v3.pdf.](vscode-file://vscode-app/Applications/Positron.app/Contents/Resources/app/out/vs/code/electron-sandbox/workbench/workbench.html#) 

Ministerio de Transportes y Movilidad Sostenible (MITMS) (2024). Estudio de movilidad de viajeros de ámbito nacional aplicando la tecnología Big Data. Informe metodológico (Study of National
Traveler mobility Using Big Data Technology. Methodological Report).
[https://www.transportes.gob.es/recursosmfom/paginabasica/recursos/a3informemetodologicoestudiomovilidadmitms_v8.pdf.](vscode-file://vscode-app/Applications/Positron.app/Contents/Resources/app/out/vs/code/electron-sandbox/workbench/workbench.html#) 


Markdown citations:
-------------------
Kotov E, Lovelace R, Vidal-Tortosa E (2024). _spanishoddata_. doi:10.32614/CRAN.package.spanishoddata [https://doi.org/10.32614/CRAN.package.spanishoddata,](vscode-file://vscode-app/Applications/Positron.app/Contents/Resources/app/out/vs/code/electron-sandbox/workbench/workbench.html#)
[https://github.com/rOpenSpain/spanishoddata.](vscode-file://vscode-app/Applications/Positron.app/Contents/Resources/app/out/vs/code/electron-sandbox/workbench/workbench.html#) 

Ministerio de Transportes y Movilidad Sostenible (MITMS) (2024). “Estudio de la movilidad con Big Data (Study of mobility with Big Data).”
[https://www.transportes.gob.es/ministerio/proyectos-singulares/estudio-de-movilidad-con-big-data.](vscode-file://vscode-app/Applications/Positron.app/Contents/Resources/app/out/vs/code/electron-sandbox/workbench/workbench.html#) 

Ministerio de Transportes, Movilidad y Agenda Urbana (MITMA) (2021). _Análisis de la movilidad en España con tecnología Big Data durante el estado de alarma para la gestión de la crisis del
COVID-19 (Analysis of mobility in Spain with Big Data technology during the state of alarm for COVID-19 crisis management)_.
[https://cdn.mitma.gob.es/portal-web-drupal/covid-19/bigdata/mitma_-_estudio_movilidad_covid-19_informe_metodologico_v3.pdf.](vscode-file://vscode-app/Applications/Positron.app/Contents/Resources/app/out/vs/code/electron-sandbox/workbench/workbench.html#) 

Ministerio de Transportes y Movilidad Sostenible (MITMS) (2024). _Estudio de movilidad de viajeros de ámbito nacional aplicando la tecnología Big Data. Informe metodológico (Study of National
Traveler mobility Using Big Data Technology. Methodological Report)_.
[https://www.transportes.gob.es/recursos_mfom/paginabasica/recursos/a3_informe_metodologico_estudio_movilidad_mitms_v8.pdf.](vscode-file://vscode-app/Applications/Positron.app/Contents/Resources/app/out/vs/code/electron-sandbox/workbench/workbench.html#) 


BibTeX citations:
-----------------
@Manual{r-spanishoddata,
  title = {spanishoddata},
  author = {Egor Kotov and Robin Lovelace and Eugeni Vidal-Tortosa},
  year = {2024},
  url = {[https://github.com/rOpenSpain/spanishoddata](vscode-file://vscode-app/Applications/Positron.app/Contents/Resources/app/out/vs/code/electron-sandbox/workbench/workbench.html#)},
  doi = {10.32614/CRAN.package.spanishoddata},
}

@Misc{mitms_mobility_web,
  title = {Estudio de la movilidad con Big Data (Study of mobility with Big Data)},
  author = {{Ministerio de Transportes y Movilidad Sostenible (MITMS)}},
  year = {2024},
  url = {[https://www.transportes.gob.es/ministerio/proyectos-singulares/estudio-de-movilidad-con-big-data](vscode-file://vscode-app/Applications/Positron.app/Contents/Resources/app/out/vs/code/electron-sandbox/workbench/workbench.html#)},
}

@Manual{mitma_methodology_2020_v3,
  title = {Análisis de la movilidad en España con tecnología Big Data durante el estado de alarma para la gestión de la crisis del COVID-19 (Analysis of mobility in Spain with Big Data technology during the state of alarm for COVID-19 crisis management)},
  author = {{Ministerio de Transportes, Movilidad y Agenda Urbana (MITMA)}},
  year = {2021},
  url = {[https://cdn.mitma.gob.es/portal-web-drupal/covid-19/bigdata/mitma_-_estudio_movilidad_covid-19_informe_metodologico_v3.pdf](vscode-file://vscode-app/Applications/Positron.app/Contents/Resources/app/out/vs/code/electron-sandbox/workbench/workbench.html#)},
}

@Manual{mitms_methodology_2022_v8,
  title = {Estudio de movilidad de viajeros de ámbito nacional aplicando la tecnología Big Data. Informe metodológico (Study of National Traveler mobility Using Big Data Technology. Methodological Report)},
  author = {{Ministerio de Transportes y Movilidad Sostenible (MITMS)}},
  year = {2024},
  url = {[https://www.transportes.gob.es/recursos_mfom/paginabasica/recursos/a3_informe_metodologico_estudio_movilidad_mitms_v8.pdf](vscode-file://vscode-app/Applications/Positron.app/Contents/Resources/app/out/vs/code/electron-sandbox/workbench/workbench.html#)},
}

@e-kotov e-kotov linked an issue Jan 28, 2025 that may be closed by this pull request
@e-kotov e-kotov requested a review from Robinlovelace January 28, 2025 15:26
@e-kotov
Copy link
Member Author

e-kotov commented Jan 28, 2025

Error ('test-quick-get.R:31:3'): spod_quick_get_od fails out of range dates ──
Error in UseMethod("mutate"): no applicable method for 'mutate' applied to an object of class "NULL"
Backtrace:

  1. ├─testthat::expect_error(...) at test-quick-get.R:31:3
  2. │ └─testthat:::expect_condition_matching(...)
  3. │ └─testthat:::quasi_capture(...)
  4. │ ├─testthat (local) .capture(...)
  5. │ │ └─base::withCallingHandlers(...)
  6. │ └─rlang::eval_bare(quo_get_expr(.quo), quo_get_env(.quo))
  7. └─spanishoddata::spod_quick_get_od(date = "2021-12-31", )
  8. └─spanishoddata:::spod_graphql_valid_dates() at spanishoddata/R/quick-get.R:109:3
  9. └─dplyr::mutate(...) at spanishoddata/R/internal-utils.R:433:3
    

this can be ignored for now, it fails sometimes as this test calls an API. I should probably prevent this test from running under certain conditions, as it might fail on CRAN too when we submit the next version.

@Robinlovelace
Copy link
Collaborator

I really appreciate these detailed summaries of before/after. Best practice in software development, if more people learned these code collaboration tricks-of-the-trade early the world would be a better place (planning to teach some of them at the EIT Summer School in summer)!

#' Cite the package and the data
#'
#' @param what Character vector specifying what to cite.
#' Can include "package", "data", "methodology_v1", "methodology_v2", or "all".
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So many options! It's good that users can now decide which aspect of the data to cite, 👍 to flexibility and etiquette. This is respectful to the data owners.

@e-kotov
Copy link
Member Author

e-kotov commented Jan 28, 2025

(vscode-file://vscode-app/Applications/Positron.app/Contents/Resources/app/out/vs/code/electron-sandbox/workbench/workbench.html#)

whoops, this should not be there ) will fix

@e-kotov e-kotov marked this pull request as draft January 28, 2025 16:00
@e-kotov
Copy link
Member Author

e-kotov commented Jan 28, 2025

(vscode-file://vscode-app/Applications/Positron.app/Contents/Resources/app/out/vs/code/electron-sandbox/workbench/workbench.html#)

whoops, this should not be there ) will fix

oh, it's actually fine, it's just that I copy and pasted rich text from Positron console

But need to fix the commas and periods after urls to prevent them being part of URLs

@e-kotov
Copy link
Member Author

e-kotov commented Jan 28, 2025

But need to fix the commas and periods after urls to prevent them being part of URLs

Decided not to fix, as this will not comply with any citation standard and not all consoles misinterpret the commas and dots at the end of the URL during parsing.

@e-kotov e-kotov marked this pull request as ready for review January 28, 2025 16:55
@e-kotov e-kotov merged commit d725c3d into main Jan 28, 2025
3 of 5 checks passed
@e-kotov e-kotov deleted the 130-make-data-and-package-citation-easier-and-more-obvious branch January 28, 2025 16:56
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.

make data and package citation easier and more obvious
2 participants