├── _pkgdown.yml ├── po ├── LINGUAS ├── sk.po ├── cs.po ├── es.po ├── id.po ├── de.po ├── fr.po ├── ru.po ├── datefixR.pot ├── R-pt.po ├── R-datefixR.pot ├── R-cs.po ├── R-sk.po ├── R-id.po ├── R-es.po ├── R-de.po ├── R-fr.po └── R-ru.po ├── tests ├── testthat │ ├── test_zzz.R │ ├── _snaps │ │ ├── shiny │ │ │ ├── app_1.md │ │ │ └── app_1 │ │ │ │ ├── 001_.png │ │ │ │ ├── 003_.png │ │ │ │ ├── 002-fixed.csv │ │ │ │ ├── 001.json │ │ │ │ └── 003.json │ │ ├── mac-4.2 │ │ │ └── app_1.md │ │ ├── mac-4.3 │ │ │ └── app_1.md │ │ └── mac-4.5 │ │ │ ├── app_1.md │ │ │ └── app_1 │ │ │ ├── 001_.png │ │ │ ├── 003_.png │ │ │ ├── 002-fixed.csv │ │ │ ├── 001.json │ │ │ └── 003.json │ ├── test_roman.R │ ├── test_fix_date_app.R │ ├── test_app_1.R │ ├── test_fix_date_char.R │ └── test_languages.R ├── testthat.R ├── spelling.R └── test_zz.R ├── .github ├── .gitignore ├── workflows │ ├── hello-to-new-contributions.yml │ ├── deploy-shiny.yaml │ ├── update-citation-cff.yaml │ ├── pr-commands.yaml │ ├── update-docs.yaml │ └── R-CMD-check.yaml.backup ├── dependabot.yml └── CONTRIBUTING.md ├── codecov.yml ├── src ├── .gitignore ├── datefixR-win.def ├── rust │ ├── vendor.tar.xz │ ├── vendor-config.toml │ ├── .gitignore │ ├── Cargo.toml.backup │ ├── Cargo.toml │ └── Cargo.lock ├── entrypoint.c ├── Makevars.win.in └── Makevars.in ├── vignettes ├── .gitignore ├── shiny_app.Rmd └── internationalization.Rmd ├── app.R ├── inst ├── example.xlsx ├── po │ ├── cs │ │ └── LC_MESSAGES │ │ │ ├── datefixR.mo │ │ │ └── R-datefixR.mo │ ├── de │ │ └── LC_MESSAGES │ │ │ ├── datefixR.mo │ │ │ └── R-datefixR.mo │ ├── es │ │ └── LC_MESSAGES │ │ │ ├── datefixR.mo │ │ │ └── R-datefixR.mo │ ├── fr │ │ └── LC_MESSAGES │ │ │ ├── datefixR.mo │ │ │ └── R-datefixR.mo │ ├── id │ │ └── LC_MESSAGES │ │ │ ├── datefixR.mo │ │ │ └── R-datefixR.mo │ ├── ru │ │ └── LC_MESSAGES │ │ │ ├── datefixR.mo │ │ │ └── R-datefixR.mo │ ├── sk │ │ └── LC_MESSAGES │ │ │ ├── datefixR.mo │ │ │ └── R-datefixR.mo │ ├── pt │ │ └── LC_MESSAGES │ │ │ └── R-datefixR.mo │ └── en@quot │ │ └── LC_MESSAGES │ │ ├── datefixR.mo │ │ └── R-datefixR.mo ├── example.csv ├── CITATION └── WORDLIST ├── man ├── figures │ ├── logo.png │ ├── sticker.pdf │ ├── sticker.png │ ├── lifecycle-stable.svg │ ├── lifecycle-defunct.svg │ ├── lifecycle-archived.svg │ ├── lifecycle-maturing.svg │ ├── lifecycle-deprecated.svg │ ├── lifecycle-superseded.svg │ ├── lifecycle-experimental.svg │ └── lifecycle-questioning.svg ├── exampledates.Rd ├── fix_date_app.Rd ├── datefixR.Rd ├── fix_date_char.Rd └── fix_date_df.Rd ├── configure.win ├── data └── exampledates.rda ├── configure ├── pkgdown └── favicon │ ├── favicon.ico │ ├── favicon-16x16.png │ ├── favicon-32x32.png │ ├── apple-touch-icon.png │ ├── apple-touch-icon-60x60.png │ ├── apple-touch-icon-76x76.png │ ├── apple-touch-icon-120x120.png │ ├── apple-touch-icon-152x152.png │ └── apple-touch-icon-180x180.png ├── NAMESPACE ├── R ├── zzz.R ├── data.R ├── internal.R ├── extendr-wrappers.R ├── datefixR-package.R ├── fix_date_char.R └── fix_date_df.R ├── datefixR.Rproj ├── .Rbuildignore ├── cran-comments.md ├── .gitignore ├── DESCRIPTION ├── tools ├── config.R └── msrv.R └── NEWS.md /_pkgdown.yml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /po/LINGUAS: -------------------------------------------------------------------------------- 1 | fr de es pt ru -------------------------------------------------------------------------------- /tests/testthat/test_zzz.R: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.github/.gitignore: -------------------------------------------------------------------------------- 1 | *.html 2 | -------------------------------------------------------------------------------- /codecov.yml: -------------------------------------------------------------------------------- 1 | ignore: 2 | - "R/shinyapp.R" -------------------------------------------------------------------------------- /src/.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | *.so 3 | *.dll 4 | -------------------------------------------------------------------------------- /vignettes/.gitignore: -------------------------------------------------------------------------------- 1 | *.html 2 | *.R 3 | -------------------------------------------------------------------------------- /app.R: -------------------------------------------------------------------------------- 1 | pkgload::load_all(".") 2 | fix_date_app() 3 | -------------------------------------------------------------------------------- /src/datefixR-win.def: -------------------------------------------------------------------------------- 1 | EXPORTS 2 | R_init_datefixR 3 | -------------------------------------------------------------------------------- /inst/example.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ropensci/datefixR/HEAD/inst/example.xlsx -------------------------------------------------------------------------------- /man/figures/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ropensci/datefixR/HEAD/man/figures/logo.png -------------------------------------------------------------------------------- /tests/testthat.R: -------------------------------------------------------------------------------- 1 | library(testthat) 2 | library(datefixR) 3 | 4 | test_check("datefixR") 5 | -------------------------------------------------------------------------------- /configure.win: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | "${R_HOME}/bin${R_ARCH_BIN}/Rscript.exe" tools/config.R 3 | -------------------------------------------------------------------------------- /data/exampledates.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ropensci/datefixR/HEAD/data/exampledates.rda -------------------------------------------------------------------------------- /src/rust/vendor.tar.xz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ropensci/datefixR/HEAD/src/rust/vendor.tar.xz -------------------------------------------------------------------------------- /configure: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | : "${R_HOME=`R RHOME`}" 3 | "${R_HOME}/bin/Rscript" tools/config.R 4 | -------------------------------------------------------------------------------- /man/figures/sticker.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ropensci/datefixR/HEAD/man/figures/sticker.pdf -------------------------------------------------------------------------------- /man/figures/sticker.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ropensci/datefixR/HEAD/man/figures/sticker.png -------------------------------------------------------------------------------- /pkgdown/favicon/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ropensci/datefixR/HEAD/pkgdown/favicon/favicon.ico -------------------------------------------------------------------------------- /tests/testthat/_snaps/shiny/app_1.md: -------------------------------------------------------------------------------- 1 | # fix_date_app() works with shiny theme 2 | 3 | "fixed.csv" 4 | 5 | -------------------------------------------------------------------------------- /tests/testthat/_snaps/mac-4.2/app_1.md: -------------------------------------------------------------------------------- 1 | # fix_date_app() works with datefixR theme 2 | 3 | "fixed.csv" 4 | 5 | -------------------------------------------------------------------------------- /tests/testthat/_snaps/mac-4.3/app_1.md: -------------------------------------------------------------------------------- 1 | # fix_date_app() works with datefixR theme 2 | 3 | "fixed.csv" 4 | 5 | -------------------------------------------------------------------------------- /tests/testthat/_snaps/mac-4.5/app_1.md: -------------------------------------------------------------------------------- 1 | # fix_date_app() works with datefixR theme 2 | 3 | "fixed.csv" 4 | 5 | -------------------------------------------------------------------------------- /inst/po/cs/LC_MESSAGES/datefixR.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ropensci/datefixR/HEAD/inst/po/cs/LC_MESSAGES/datefixR.mo -------------------------------------------------------------------------------- /inst/po/de/LC_MESSAGES/datefixR.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ropensci/datefixR/HEAD/inst/po/de/LC_MESSAGES/datefixR.mo -------------------------------------------------------------------------------- /inst/po/es/LC_MESSAGES/datefixR.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ropensci/datefixR/HEAD/inst/po/es/LC_MESSAGES/datefixR.mo -------------------------------------------------------------------------------- /inst/po/fr/LC_MESSAGES/datefixR.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ropensci/datefixR/HEAD/inst/po/fr/LC_MESSAGES/datefixR.mo -------------------------------------------------------------------------------- /inst/po/id/LC_MESSAGES/datefixR.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ropensci/datefixR/HEAD/inst/po/id/LC_MESSAGES/datefixR.mo -------------------------------------------------------------------------------- /inst/po/ru/LC_MESSAGES/datefixR.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ropensci/datefixR/HEAD/inst/po/ru/LC_MESSAGES/datefixR.mo -------------------------------------------------------------------------------- /inst/po/sk/LC_MESSAGES/datefixR.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ropensci/datefixR/HEAD/inst/po/sk/LC_MESSAGES/datefixR.mo -------------------------------------------------------------------------------- /pkgdown/favicon/favicon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ropensci/datefixR/HEAD/pkgdown/favicon/favicon-16x16.png -------------------------------------------------------------------------------- /pkgdown/favicon/favicon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ropensci/datefixR/HEAD/pkgdown/favicon/favicon-32x32.png -------------------------------------------------------------------------------- /inst/po/cs/LC_MESSAGES/R-datefixR.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ropensci/datefixR/HEAD/inst/po/cs/LC_MESSAGES/R-datefixR.mo -------------------------------------------------------------------------------- /inst/po/de/LC_MESSAGES/R-datefixR.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ropensci/datefixR/HEAD/inst/po/de/LC_MESSAGES/R-datefixR.mo -------------------------------------------------------------------------------- /inst/po/es/LC_MESSAGES/R-datefixR.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ropensci/datefixR/HEAD/inst/po/es/LC_MESSAGES/R-datefixR.mo -------------------------------------------------------------------------------- /inst/po/fr/LC_MESSAGES/R-datefixR.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ropensci/datefixR/HEAD/inst/po/fr/LC_MESSAGES/R-datefixR.mo -------------------------------------------------------------------------------- /inst/po/id/LC_MESSAGES/R-datefixR.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ropensci/datefixR/HEAD/inst/po/id/LC_MESSAGES/R-datefixR.mo -------------------------------------------------------------------------------- /inst/po/pt/LC_MESSAGES/R-datefixR.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ropensci/datefixR/HEAD/inst/po/pt/LC_MESSAGES/R-datefixR.mo -------------------------------------------------------------------------------- /inst/po/ru/LC_MESSAGES/R-datefixR.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ropensci/datefixR/HEAD/inst/po/ru/LC_MESSAGES/R-datefixR.mo -------------------------------------------------------------------------------- /inst/po/sk/LC_MESSAGES/R-datefixR.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ropensci/datefixR/HEAD/inst/po/sk/LC_MESSAGES/R-datefixR.mo -------------------------------------------------------------------------------- /pkgdown/favicon/apple-touch-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ropensci/datefixR/HEAD/pkgdown/favicon/apple-touch-icon.png -------------------------------------------------------------------------------- /inst/po/en@quot/LC_MESSAGES/datefixR.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ropensci/datefixR/HEAD/inst/po/en@quot/LC_MESSAGES/datefixR.mo -------------------------------------------------------------------------------- /inst/po/en@quot/LC_MESSAGES/R-datefixR.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ropensci/datefixR/HEAD/inst/po/en@quot/LC_MESSAGES/R-datefixR.mo -------------------------------------------------------------------------------- /pkgdown/favicon/apple-touch-icon-60x60.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ropensci/datefixR/HEAD/pkgdown/favicon/apple-touch-icon-60x60.png -------------------------------------------------------------------------------- /pkgdown/favicon/apple-touch-icon-76x76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ropensci/datefixR/HEAD/pkgdown/favicon/apple-touch-icon-76x76.png -------------------------------------------------------------------------------- /tests/testthat/_snaps/shiny/app_1/001_.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ropensci/datefixR/HEAD/tests/testthat/_snaps/shiny/app_1/001_.png -------------------------------------------------------------------------------- /tests/testthat/_snaps/shiny/app_1/003_.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ropensci/datefixR/HEAD/tests/testthat/_snaps/shiny/app_1/003_.png -------------------------------------------------------------------------------- /pkgdown/favicon/apple-touch-icon-120x120.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ropensci/datefixR/HEAD/pkgdown/favicon/apple-touch-icon-120x120.png -------------------------------------------------------------------------------- /pkgdown/favicon/apple-touch-icon-152x152.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ropensci/datefixR/HEAD/pkgdown/favicon/apple-touch-icon-152x152.png -------------------------------------------------------------------------------- /pkgdown/favicon/apple-touch-icon-180x180.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ropensci/datefixR/HEAD/pkgdown/favicon/apple-touch-icon-180x180.png -------------------------------------------------------------------------------- /tests/testthat/_snaps/mac-4.5/app_1/001_.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ropensci/datefixR/HEAD/tests/testthat/_snaps/mac-4.5/app_1/001_.png -------------------------------------------------------------------------------- /tests/testthat/_snaps/mac-4.5/app_1/003_.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ropensci/datefixR/HEAD/tests/testthat/_snaps/mac-4.5/app_1/003_.png -------------------------------------------------------------------------------- /src/rust/vendor-config.toml: -------------------------------------------------------------------------------- 1 | [source.crates-io] 2 | replace-with = "vendored-sources" 3 | 4 | [source.vendored-sources] 5 | directory = "vendor" 6 | -------------------------------------------------------------------------------- /inst/example.csv: -------------------------------------------------------------------------------- 1 | Apple,Pear,Lemon 2 | 02-03-21,Jan 2000,1 1 2010 3 | 05 02 19,1990,2 Jan 1990 4 | April 2019,sept 1984,25 Mar 1975 5 | 12 1993,1990-05-01,December 2020 6 | -------------------------------------------------------------------------------- /tests/spelling.R: -------------------------------------------------------------------------------- 1 | if (requireNamespace("spelling", quietly = TRUE)) { 2 | spelling::spell_check_test( 3 | vignettes = TRUE, 4 | error = FALSE, 5 | skip_on_cran = TRUE 6 | ) 7 | } 8 | -------------------------------------------------------------------------------- /NAMESPACE: -------------------------------------------------------------------------------- 1 | # Generated by roxygen2: do not edit by hand 2 | 3 | export(fix_date_app) 4 | export(fix_date_char) 5 | export(fix_date_df) 6 | importFrom(lifecycle,deprecated) 7 | useDynLib(datefixR, .registration = TRUE) 8 | -------------------------------------------------------------------------------- /tests/testthat/_snaps/mac-4.5/app_1/002-fixed.csv: -------------------------------------------------------------------------------- 1 | "","Apple","Pear","Lemon" 2 | "1",2021-03-02,2000-01-01,"1 1 2010" 3 | "2",2019-02-05,1990-07-01,"2 Jan 1990" 4 | "3",2019-04-01,1984-09-01,"25 Mar 1975" 5 | "4",1993-12-01,1990-05-01,"December 2020" 6 | -------------------------------------------------------------------------------- /tests/testthat/_snaps/shiny/app_1/002-fixed.csv: -------------------------------------------------------------------------------- 1 | "","Apple","Pear","Lemon" 2 | "1",2021-03-02,2000-01-01,"1 1 2010" 3 | "2",2019-02-05,1990-07-01,"2 Jan 1990" 4 | "3",2019-04-01,1984-09-01,"25 Mar 1975" 5 | "4",1993-12-01,1990-05-01,"December 2020" 6 | -------------------------------------------------------------------------------- /src/entrypoint.c: -------------------------------------------------------------------------------- 1 | // We need to forward routine registration from C to Rust 2 | // to avoid the linker removing the static library. 3 | 4 | void R_init_datefixR_extendr(void *dll); 5 | 6 | void R_init_datefixR(void *dll) { 7 | R_init_datefixR_extendr(dll); 8 | } 9 | -------------------------------------------------------------------------------- /tests/testthat/test_roman.R: -------------------------------------------------------------------------------- 1 | test_that("check Roman numeral dates work", { 2 | messy.dates <- c("01 ii 2021", "2023-iv-02", "13/ix/1975") 3 | expect_equal( 4 | fix_date_char(messy.dates, roman.numeral = TRUE), 5 | as.Date(c("2021-02-01", "2023-04-02", "1975-09-13")) 6 | ) 7 | }) 8 | -------------------------------------------------------------------------------- /src/rust/.gitignore: -------------------------------------------------------------------------------- 1 | # Rust build artifacts 2 | /target/ 3 | **/*.rs.bk 4 | 5 | # Cargo files 6 | Cargo.lock 7 | 8 | # IDE files 9 | .vscode/ 10 | .idea/ 11 | *.swp 12 | *.swo 13 | *~ 14 | 15 | # OS files 16 | .DS_Store 17 | Thumbs.db 18 | 19 | # R integration files 20 | .cargo/ 21 | vendor/ 22 | -------------------------------------------------------------------------------- /R/zzz.R: -------------------------------------------------------------------------------- 1 | .onAttach <- function(libname, pkgname) { 2 | multi.byte <- l10n_info()$MBCS 3 | if (!multi.byte) { 4 | packageStartupMessage( 5 | "The current locale does not support multibyte characters. ", 6 | "You may run into difficulties if any months are given as ", 7 | "non-English language names. \n" 8 | ) 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/rust/Cargo.toml.backup: -------------------------------------------------------------------------------- 1 | [package] 2 | name = 'datefixR' 3 | publish = false 4 | version = '0.1.0' 5 | edition = '2021' 6 | rust-version = '1.65' 7 | 8 | [lib] 9 | crate-type = [ 'staticlib' ] 10 | name = 'datefixR' 11 | 12 | [dependencies] 13 | extendr-api = { version = "*", default-features = false, features = ["result_condition"] } 14 | regex = "1.5" 15 | chrono = "0.4" 16 | lazy_static = "1.4" 17 | -------------------------------------------------------------------------------- /R/data.R: -------------------------------------------------------------------------------- 1 | #' Example dataset of dates in different formats 2 | #' 3 | #' A toy dataset to use with datefixR functions. 4 | #' 5 | #' @format A data frame with 5 rows and 3 variables: 6 | #' \describe{ 7 | #' \item{id}{Row ID (numeric).} 8 | #' \item{some.dates}{Dates in different formats (character).} 9 | #' \item{some.more.dates}{Additional dates in different formats (character).} 10 | #' } 11 | "exampledates" 12 | -------------------------------------------------------------------------------- /inst/CITATION: -------------------------------------------------------------------------------- 1 | note <- sprintf("R package version %s", meta$Version) 2 | 3 | bibentry( 4 | bibtype = "Manual", 5 | title = "{datefixR}: Standardize Dates in Different Formats or with Missing Data", 6 | author = as.person("Nathan Constantine-Cooke"), 7 | year = 2025, 8 | note = note, 9 | doi = "10.5281/zenodo.5655311", 10 | url = "https://CRAN.R-project.org/package=datefixR" 11 | ) -------------------------------------------------------------------------------- /datefixR.Rproj: -------------------------------------------------------------------------------- 1 | Version: 1.0 2 | ProjectId: 522f1242-6eca-47c8-83dd-4b5288ca19fe 3 | 4 | RestoreWorkspace: Default 5 | SaveWorkspace: Default 6 | AlwaysSaveHistory: Default 7 | 8 | EnableCodeIndexing: Yes 9 | UseSpacesForTab: Yes 10 | NumSpacesForTab: 2 11 | Encoding: UTF-8 12 | 13 | RnwWeave: Sweave 14 | LaTeX: pdfLaTeX 15 | 16 | BuildType: Package 17 | PackageUseDevtools: Yes 18 | PackageInstallArgs: --no-multiarch --with-keep.source 19 | -------------------------------------------------------------------------------- /.Rbuildignore: -------------------------------------------------------------------------------- 1 | ^datefixR\.Rproj$ 2 | ^\.Rproj\.user$ 3 | ^LICENSE\.md$ 4 | ^\.github$ 5 | ^README\.Rmd$ 6 | ^README_files$ 7 | ^cran-comments\.md$ 8 | ^CRAN-RELEASE$ 9 | ^CRAN-SUBMISSION$ 10 | ^_pkgdown\.yml$ 11 | ^pkgdown$ 12 | ^codemeta\.json$ 13 | ^CITATION\.cff$ 14 | ^app\.R$ 15 | ^rsconnect$ 16 | ^src/\.cargo$ 17 | ^src/rust/vendor$ 18 | ^src/rust/target$ 19 | ^src/Makevars$ 20 | ^src/Makevars\.win$ 21 | ^doc$ 22 | ^Meta$ 23 | ^codecov\.yml$ 24 | ^WARP.md$ -------------------------------------------------------------------------------- /.github/workflows/hello-to-new-contributions.yml: -------------------------------------------------------------------------------- 1 | on: 2 | pull_request: 3 | issues: 4 | 5 | name: "Auto message for PR's and Issues" 6 | 7 | jobs: 8 | message: 9 | runs-on: ubuntu-latest 10 | steps: 11 | - uses: actions/first-interaction@v1 12 | with: 13 | repo-token: ${{ secrets.GITHUB_TOKEN }} 14 | issue-message: 'Thank you for opening your first issue for datefixR! @nathansam will reply as soon as possible' 15 | pr-message: 'Thank you for opening your first pull request! You will receive a response soon.' -------------------------------------------------------------------------------- /tests/test_zz.R: -------------------------------------------------------------------------------- 1 | library(testthat) 2 | if (Sys.info()[["sysname"]] == "Darwin") { 3 | test_that("Warning if multibyte support is not detected", { 4 | withr::with_locale(new = c("LC_CTYPE" = "en_US.US-ASCII"), code = { 5 | expect_message( 6 | library(datefixR), 7 | paste0( 8 | "The current locale does not support multibyte characters. ", 9 | "You may run into difficulties if any months are given as ", 10 | "non-English language names. \n" 11 | ) 12 | ) 13 | }) 14 | }) 15 | } 16 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # To get started with Dependabot version updates, you'll need to specify which 2 | # package ecosystems to update and where the package manifests are located. 3 | # Please see the documentation for all configuration options: 4 | # https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates 5 | 6 | version: 2 7 | updates: 8 | - package-ecosystem: "github-actions" # See documentation for possible values 9 | directory: "/" # Location of package manifests 10 | schedule: 11 | interval: "daily" 12 | -------------------------------------------------------------------------------- /R/internal.R: -------------------------------------------------------------------------------- 1 | #' @noRd 2 | .checkmonth <- function(month.impute) { 3 | if (!is.na(month.impute) && !is.null(month.impute)) { 4 | if (month.impute < 1 || month.impute > 12) { 5 | stop("month.impute should be an integer between 1 and 12\n") 6 | } 7 | if (!(month.impute %% 1 == 0)) { 8 | stop("month.impute should be an integer\n") 9 | } 10 | } 11 | return() 12 | } 13 | 14 | 15 | #' @noRd 16 | .checkformat <- function(format) { 17 | if (!(format %in% c("dmy", "mdy"))) { 18 | stop("format should be either 'dmy' or 'mdy' \n") 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/rust/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = 'datefixR' 3 | publish = false 4 | version = '0.1.0' 5 | edition = '2021' 6 | rust-version = '1.65' 7 | 8 | [lib] 9 | crate-type = [ 'staticlib', 'rlib' ] 10 | name = 'datefixR' 11 | 12 | [dependencies] 13 | extendr-api = { version = "0.8.1", default-features = false, features = ["result_condition"] } 14 | regex = "1.11" 15 | chrono = "0.4" 16 | lazy_static = "1.5" 17 | 18 | [profile.release] 19 | lto = true 20 | codegen-units = 1 21 | strip = "symbols" 22 | panic = "abort" 23 | 24 | # Specific profile for WASM builds 25 | [profile.release.package."*"] 26 | opt-level = "s" 27 | -------------------------------------------------------------------------------- /man/exampledates.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/data.R 3 | \docType{data} 4 | \name{exampledates} 5 | \alias{exampledates} 6 | \title{Example dataset of dates in different formats} 7 | \format{ 8 | A data frame with 5 rows and 3 variables: 9 | \describe{ 10 | \item{id}{Row ID (numeric).} 11 | \item{some.dates}{Dates in different formats (character).} 12 | \item{some.more.dates}{Additional dates in different formats (character).} 13 | } 14 | } 15 | \usage{ 16 | exampledates 17 | } 18 | \description{ 19 | A toy dataset to use with datefixR functions. 20 | } 21 | \keyword{datasets} 22 | -------------------------------------------------------------------------------- /inst/WORDLIST: -------------------------------------------------------------------------------- 1 | Ahmadgaid 2 | DMY 3 | DOI 4 | Deutsch 5 | Français 6 | Kaique 7 | Luque 8 | MDY 9 | ORCID 10 | POSIXct 11 | Pérez 12 | Pусский 13 | README 14 | RStudio 15 | Rtools 16 | Tidyverse 17 | XLSX 18 | YMD 19 | YYYY 20 | codecov 21 | csv 22 | datetime 23 | de 24 | del 25 | df 26 | ene 27 | ener 28 | español 29 | jan 30 | le 31 | nd 32 | priori 33 | rOpenSci 34 | ropensci 35 | sept 36 | septiembre 37 | styler 38 | th 39 | tibble 40 | Русский 41 | ’s 42 | Chitra 43 | Bahasa 44 | dmy 45 | du 46 | io 47 | mdy 48 | pre 49 | Pre 50 | shinyapps 51 | xls 52 | xlsx 53 | Fastpath 54 | Vendored 55 | behaviour 56 | extendr 57 | fastpath 58 | rustc 59 | toml 60 | datefixR's 61 | -------------------------------------------------------------------------------- /man/figures/lifecycle-stable.svg: -------------------------------------------------------------------------------- 1 | lifecyclelifecyclestablestable -------------------------------------------------------------------------------- /po/sk.po: -------------------------------------------------------------------------------- 1 | msgid "" 2 | msgstr "" 3 | "Project-Id-Version: datefixR 1.6.0\n" 4 | "Report-Msgid-Bugs-To: \n" 5 | "POT-Creation-Date: 2023-08-07 10:49+0100\n" 6 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 7 | "Last-Translator: FULL NAME \n" 8 | "Language-Team: None\n" 9 | "Language: sk\n" 10 | "MIME-Version: 1.0\n" 11 | "Content-Type: text/plain; charset=UTF-8\n" 12 | "Content-Transfer-Encoding: 8bit\n" 13 | 14 | #: code.cpp:27 15 | msgid "Missing month with no imputation value given \n" 16 | msgstr "Chýbajúci mesiac bez imputácie hodnoty \n" 17 | 18 | #: code.cpp:34 19 | msgid "Missing day with no imputation value given \n" 20 | msgstr "Chýbajúci deň bez imputácie hodnoty \n" 21 | 22 | #: code.cpp:45 23 | msgid "day.impute should be an integer between 1 and 31\n" 24 | msgstr "day.impute by malo byť celé číslo od 1 do 31\n" 25 | 26 | #: code.cpp:48 27 | msgid "day.impute should be an integer\n" 28 | msgstr "day.impute by malo byť celé číslo\n" 29 | -------------------------------------------------------------------------------- /.github/workflows/deploy-shiny.yaml: -------------------------------------------------------------------------------- 1 | on: 2 | push: 3 | branches: [master, main] 4 | 5 | name: deploy-shiny 6 | 7 | jobs: 8 | deploy-shiny: 9 | runs-on: ubuntu-latest 10 | env: 11 | R_REMOTES_NO_ERRORS_FROM_WARNINGS: true 12 | RSPM: "https://packagemanager.rstudio.com/cran/__linux__/noble/latest" 13 | steps: 14 | - uses: actions/checkout@v4 15 | - uses: r-lib/actions/setup-r@v2 16 | with: 17 | use-public-rspm: true 18 | - name: Install shiny 19 | run: | 20 | install.packages(c("curl", "shiny", "rsconnect", "remotes", "pkgbuild")); remotes::install_deps(dependencies = TRUE) 21 | shell: Rscript {0} 22 | - name: Push to shiny.io 23 | run: | 24 | rsconnect::setAccountInfo(name='nathansam', token=${{secrets.SHINYAPPS_TOKEN}}, secret=${{secrets.SHINYAPPS_SECRET}}); rsconnect::deployApp(appName = 'datefixr', forceUpdate = TRUE) 25 | shell: Rscript {0} -------------------------------------------------------------------------------- /man/figures/lifecycle-defunct.svg: -------------------------------------------------------------------------------- 1 | lifecyclelifecycledefunctdefunct -------------------------------------------------------------------------------- /po/cs.po: -------------------------------------------------------------------------------- 1 | msgid "" 2 | msgstr "" 3 | "Project-Id-Version: datefixR 1.6.0\n" 4 | "Report-Msgid-Bugs-To: \n" 5 | "POT-Creation-Date: 2023-08-07 10:49+0100\n" 6 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 7 | "Last-Translator: FULL NAME \n" 8 | "Language-Team: None\n" 9 | "Language: cs\n" 10 | "MIME-Version: 1.0\n" 11 | "Content-Type: text/plain; charset=UTF-8\n" 12 | "Content-Transfer-Encoding: 8bit\n" 13 | 14 | #: code.cpp:27 15 | msgid "Missing month with no imputation value given \n" 16 | msgstr "Chybějící měsíc bez uvedené imputační hodnoty \n" 17 | 18 | #: code.cpp:34 19 | msgid "Missing day with no imputation value given \n" 20 | msgstr "Chybějící den bez uvedené imputační hodnoty \n" 21 | 22 | #: code.cpp:45 23 | msgid "day.impute should be an integer between 1 and 31\n" 24 | msgstr "day.impute by mělo být číslo mezi 1 a 31 \n" 25 | 26 | #: code.cpp:48 27 | msgid "day.impute should be an integer\n" 28 | msgstr "day.impute by mělo být číslo \n" 29 | -------------------------------------------------------------------------------- /man/figures/lifecycle-archived.svg: -------------------------------------------------------------------------------- 1 | lifecyclelifecyclearchivedarchived -------------------------------------------------------------------------------- /man/figures/lifecycle-maturing.svg: -------------------------------------------------------------------------------- 1 | lifecyclelifecyclematuringmaturing -------------------------------------------------------------------------------- /man/figures/lifecycle-deprecated.svg: -------------------------------------------------------------------------------- 1 | lifecyclelifecycledeprecateddeprecated -------------------------------------------------------------------------------- /man/figures/lifecycle-superseded.svg: -------------------------------------------------------------------------------- 1 | lifecyclelifecyclesupersededsuperseded -------------------------------------------------------------------------------- /man/figures/lifecycle-experimental.svg: -------------------------------------------------------------------------------- 1 | lifecyclelifecycleexperimentalexperimental -------------------------------------------------------------------------------- /man/figures/lifecycle-questioning.svg: -------------------------------------------------------------------------------- 1 | lifecyclelifecyclequestioningquestioning -------------------------------------------------------------------------------- /po/es.po: -------------------------------------------------------------------------------- 1 | msgid "" 2 | msgstr "" 3 | "Project-Id-Version: datefixR 1.2.0\n" 4 | "Report-Msgid-Bugs-To: \n" 5 | "POT-Creation-Date: 2023-08-03 11:24+0100\n" 6 | "PO-Revision-Date: 2022-09-08 HO:MI+ZONE\n" 7 | "Last-Translator: Antonio J. Pérez-Luque \n" 8 | "Language-Team: None\n" 9 | "Language: es\n" 10 | "MIME-Version: 1.0\n" 11 | "Content-Type: text/plain; charset=UTF-8\n" 12 | "Content-Transfer-Encoding: 8bit\n" 13 | 14 | #: code.cpp:27 15 | msgid "Missing month with no imputation value given \n" 16 | msgstr "Mes faltante sin valor de imputación \n" 17 | 18 | #: code.cpp:34 19 | msgid "Missing day with no imputation value given \n" 20 | msgstr "Día faltante sin valor de imputación \n" 21 | 22 | #: code.cpp:45 23 | msgid "day.impute should be an integer between 1 and 31\n" 24 | msgstr "day.impute debe ser un número entero entre 1 y 31\n" 25 | 26 | #: code.cpp:48 27 | msgid "day.impute should be an integer\n" 28 | msgstr "day.impute debe ser un número entero\n" 29 | -------------------------------------------------------------------------------- /po/id.po: -------------------------------------------------------------------------------- 1 | msgid "" 2 | msgstr "" 3 | "Project-Id-Version: datefixR 1.7.0\n" 4 | "Report-Msgid-Bugs-To: \n" 5 | "POT-Creation-Date: 2023-08-07 10:49+0100\n" 6 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 7 | "Last-Translator: FULL NAME \n" 8 | "Language-Team: None\n" 9 | "Language: id\n" 10 | "MIME-Version: 1.0\n" 11 | "Content-Type: text/plain; charset=UTF-8\n" 12 | "Content-Transfer-Encoding: 8bit\n" 13 | 14 | #: code.cpp:27 15 | msgid "Missing month with no imputation value given \n" 16 | msgstr "Tidak ada bulan dan tidak ada nilai imputasi \n" 17 | 18 | #: code.cpp:34 19 | msgid "Missing day with no imputation value given \n" 20 | msgstr "Tidak ada hari dan tidak ada nilai imputasi \n" 21 | 22 | #: code.cpp:45 23 | msgid "day.impute should be an integer between 1 and 31\n" 24 | msgstr "day.impute harus berupa bilangan bulat antara 1 dan 31\n" 25 | 26 | #: code.cpp:48 27 | msgid "day.impute should be an integer\n" 28 | msgstr "day.impute harus berupa bilangan bulat\n" 29 | -------------------------------------------------------------------------------- /po/de.po: -------------------------------------------------------------------------------- 1 | msgid "" 2 | msgstr "" 3 | "Project-Id-Version: datefixR 1.2.0.9000\n" 4 | "Report-Msgid-Bugs-To: \n" 5 | "POT-Creation-Date: 2023-08-03 11:24+0100\n" 6 | "PO-Revision-Date: 2022-09-26 16:55+CEST\n" 7 | "Last-Translator: Daniel Possenriede \n" 8 | "Language-Team: None\n" 9 | "Language: de\n" 10 | "MIME-Version: 1.0\n" 11 | "Content-Type: text/plain; charset=UTF-8\n" 12 | "Content-Transfer-Encoding: 8bit\n" 13 | 14 | #: code.cpp:27 15 | msgid "Missing month with no imputation value given \n" 16 | msgstr "Fehlender Monat ohne angegebenen Imputationswert \n" 17 | 18 | #: code.cpp:34 19 | msgid "Missing day with no imputation value given \n" 20 | msgstr "Fehlender Tag ohne angegebenen Imputationswert \n" 21 | 22 | #: code.cpp:45 23 | msgid "day.impute should be an integer between 1 and 31\n" 24 | msgstr "day.impute sollte eine Ganzzahl zwischen 1 und 31 sein\n" 25 | 26 | #: code.cpp:48 27 | msgid "day.impute should be an integer\n" 28 | msgstr "day.impute sollte eine Ganzzahl sein\n" 29 | -------------------------------------------------------------------------------- /po/fr.po: -------------------------------------------------------------------------------- 1 | msgid "" 2 | msgstr "" 3 | "Project-Id-Version: datefixR 1.2.0\n" 4 | "Report-Msgid-Bugs-To: \n" 5 | "POT-Creation-Date: 2023-08-03 11:24+0100\n" 6 | "PO-Revision-Date: 2022-09-07 HO:MI+ZONE\n" 7 | "Last-Translator: Jonathan Kitt \n" 8 | "Language-Team: None\n" 9 | "Language: fr\n" 10 | "MIME-Version: 1.0\n" 11 | "Content-Type: text/plain; charset=UTF-8\n" 12 | "Content-Transfer-Encoding: 8bit\n" 13 | 14 | #: code.cpp:27 15 | msgid "Missing month with no imputation value given \n" 16 | msgstr "Le mois manquant n'a pas de valeur d'imputation \n" 17 | 18 | #: code.cpp:34 19 | msgid "Missing day with no imputation value given \n" 20 | msgstr "Le jour manquant n'a pas de valeur d'imputation \n" 21 | 22 | #: code.cpp:45 23 | msgid "day.impute should be an integer between 1 and 31\n" 24 | msgstr "day.impute doit tre un nombre entier compris entre 1 et 31\n" 25 | 26 | #: code.cpp:48 27 | msgid "day.impute should be an integer\n" 28 | msgstr "day.impute doit tre un nombre entier\n" 29 | -------------------------------------------------------------------------------- /po/ru.po: -------------------------------------------------------------------------------- 1 | msgid "" 2 | msgstr "" 3 | "Project-Id-Version: datefixR 1.4.1.9000\n" 4 | "Report-Msgid-Bugs-To: \n" 5 | "POT-Creation-Date: 2023-08-03 11:24+0100\n" 6 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 7 | "Last-Translator: FULL NAME \n" 8 | "Language-Team: None\n" 9 | "Language: ru\n" 10 | "MIME-Version: 1.0\n" 11 | "Content-Type: text/plain; charset=UTF-8\n" 12 | "Content-Transfer-Encoding: 8bit\n" 13 | 14 | #: code.cpp:27 15 | msgid "Missing month with no imputation value given \n" 16 | msgstr "Пропущен месяц без заданного значения присвоения \n" 17 | 18 | #: code.cpp:34 19 | msgid "Missing day with no imputation value given \n" 20 | msgstr "Пропущен день без заданного значения присвоения \n" 21 | 22 | #: code.cpp:45 23 | msgid "day.impute should be an integer between 1 and 31\n" 24 | msgstr "Переменная `day.impute` должна быть целым числом от 1 до 31\n" 25 | 26 | #: code.cpp:48 27 | msgid "day.impute should be an integer\n" 28 | msgstr "Переменная `day.impute` должна быть целым числом \n" 29 | -------------------------------------------------------------------------------- /cran-comments.md: -------------------------------------------------------------------------------- 1 | ## R CMD check results 2 | 3 | This is a resubmission. The Windows build failed in the previous submission. 4 | The problematic code has now been replaced with a thread-safe approach using 5 | a readers–writer lock lock which should satisfy the Rust compiler being used for 6 | Windows builds. Confirmed working with Win-builder. 7 | 8 | 0 errors | 0 warnings | 0 notes 9 | 10 | Please note this package now depends upon Rust code and therefore uses 11 | vendored dependencies. As such, an INFO statement may occur due to installed 12 | file size (5.3Mb total size of which 4.3Mb is attributable to libs on local 13 | machine). 14 | 15 | ## Test environments 16 | 17 | - windows-latest (R release) 18 | - macOS-15 (R release) 19 | - macOS-15 (R devel) 20 | - ubuntu-24.04 (R release) 21 | - ubuntu-24.04 (R oldrel-1) 22 | - ubuntu-24.04 (R oldrel-2) 23 | 24 | via GitHub actions https://github.com/ropensci/datefixR/actions 25 | 26 | ## Downstream dependencies 27 | 28 | This package has no downstream dependencies 29 | -------------------------------------------------------------------------------- /R/extendr-wrappers.R: -------------------------------------------------------------------------------- 1 | # Generated by extendr: Do not edit by hand 2 | 3 | # nolint start 4 | 5 | # 6 | # This file was created with the following call: 7 | # .Call("wrap__make_datefixR_wrappers", use_symbols = TRUE, package_name = "datefixR") 8 | 9 | #' @usage NULL 10 | #' @useDynLib datefixR, .registration = TRUE 11 | NULL 12 | 13 | #' Validate day imputation value range 14 | #' @noRd 15 | checkday <- function(day_impute) .Call(wrap__checkday, day_impute) 16 | 17 | #' Main date fixing function - Rust implementation of .fix_date 18 | #' @noRd 19 | fix_date <- function(date, day_impute, month_impute, subject, format, excel, roman_numeral) .Call(wrap__fix_date, date, day_impute, month_impute, subject, format, excel, roman_numeral) 20 | 21 | #' Analyze and fix date strings in a whole column of a DataFrame 22 | #' @noRd 23 | fix_date_column <- function(dates, day_impute, month_impute, subjects, format, excel, roman_numeral) .Call(wrap__fix_date_column, dates, day_impute, month_impute, subjects, format, excel, roman_numeral) 24 | 25 | 26 | # nolint end 27 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # History files 2 | .Rhistory 3 | .Rapp.history 4 | 5 | # Session Data files 6 | .RData 7 | 8 | # User-specific files 9 | .Ruserdata 10 | 11 | # Example code in package build process 12 | *-Ex.R 13 | 14 | # Output files from R CMD build 15 | /*.tar.gz 16 | 17 | # Output files from R CMD check 18 | /*.Rcheck/ 19 | 20 | # RStudio files 21 | .Rproj.user/ 22 | 23 | # produced vignettes 24 | vignettes/*.html 25 | vignettes/*.pdf 26 | 27 | # OAuth2 token, see https://github.com/hadley/httr/releases/tag/v0.3 28 | .httr-oauth 29 | 30 | # knitr and R markdown default cache directories 31 | *_cache/ 32 | /cache/ 33 | 34 | # Temporary files created by R markdown 35 | *.utf8.md 36 | *.knit.md 37 | 38 | # R Environment Variables 39 | .Renviron 40 | .Rproj.user 41 | *.DS_Store 42 | src/rust/vendor 43 | src/Makevars 44 | src/Makevars.win 45 | /doc/ 46 | /Meta/ 47 | 48 | # Code coverage files 49 | *.gcov 50 | *.gcda 51 | *.gcno 52 | cobertura*.xml 53 | rust-cobertura.xml 54 | test_coverage.R 55 | test_rust_coverage.sh 56 | .coverage_temp/ 57 | ci_coverage_fixes.md 58 | 59 | WARP.md -------------------------------------------------------------------------------- /src/Makevars.win.in: -------------------------------------------------------------------------------- 1 | TARGET = $(subst 64,x86_64,$(subst 32,i686,$(WIN)))-pc-windows-gnu 2 | 3 | TARGET_DIR = ./rust/target 4 | LIBDIR = $(TARGET_DIR)/$(TARGET)/@LIBDIR@ 5 | STATLIB = $(LIBDIR)/libdatefixR.a 6 | PKG_LIBS = -L$(LIBDIR) -ldatefixR -lws2_32 -ladvapi32 -luserenv -lbcrypt -lntdll 7 | 8 | all: $(SHLIB) rust_clean 9 | 10 | .PHONY: $(STATLIB) 11 | 12 | $(SHLIB): $(STATLIB) 13 | 14 | CARGOTMP = $(CURDIR)/.cargo 15 | VENDOR_DIR = vendor 16 | 17 | $(STATLIB): 18 | mkdir -p $(TARGET_DIR)/libgcc_mock 19 | touch $(TARGET_DIR)/libgcc_mock/libgcc_eh.a 20 | 21 | if [ -f ./rust/vendor.tar.xz ]; then \ 22 | tar xf rust/vendor.tar.xz && \ 23 | mkdir -p $(CARGOTMP) && \ 24 | cp rust/vendor-config.toml $(CARGOTMP)/config.toml; \ 25 | fi 26 | 27 | # Build the project using Cargo with additional flags 28 | export CARGO_HOME=$(CARGOTMP) && \ 29 | export LIBRARY_PATH="$(LIBRARY_PATH);$(CURDIR)/$(TARGET_DIR)/libgcc_mock" && \ 30 | RUSTFLAGS="$(RUSTFLAGS) --print=native-static-libs" cargo build @CRAN_FLAGS@ --target=$(TARGET) --lib @PROFILE@ --manifest-path=rust/Cargo.toml --target-dir=$(TARGET_DIR) 31 | 32 | # Always clean up CARGOTMP 33 | rm -Rf $(CARGOTMP); 34 | 35 | rust_clean: $(SHLIB) 36 | rm -Rf $(CARGOTMP) $(VENDOR_DIR) @CLEAN_TARGET@ 37 | 38 | clean: 39 | rm -Rf $(SHLIB) $(STATLIB) $(OBJECTS) $(TARGET_DIR) $(VENDOR_DIR) 40 | -------------------------------------------------------------------------------- /R/datefixR-package.R: -------------------------------------------------------------------------------- 1 | #' datefixR: Standardize Dates in Different Formats or with Missing Data 2 | #' 3 | #' @description There are many different formats dates are commonly represented 4 | #' with: the order of day, month, or year can differ, different separators 5 | #' ("-", "/", or whitespace) can be used, months can be numerical, names, or 6 | #' abbreviations and year given as two digits or four. `datefixR` takes dates 7 | #' in all these different formats and converts them to \R{}'s built-in date 8 | #' class. If `datefixR` cannot standardize a date, such as because it is too 9 | #' malformed, then the user is told which date cannot be standardized and the 10 | #' corresponding ID for the row. `datefixR` also allows the imputation of 11 | #' missing days and months with user-controlled behavior. 12 | #' 13 | #' Get started by reading \code{vignette("datefixR")} 14 | #' 15 | #' @seealso 16 | #' Useful links: 17 | #' * \url{https://docs.ropensci.org/datefixR/} 18 | #' * \url{https://github.com/ropensci/datefixR/} 19 | #' * Report bugs at \url{https://github.com/ropensci/datefixR/issues} 20 | ## usethis namespace: start 21 | #' @importFrom lifecycle deprecated 22 | #' @useDynLib datefixR, .registration = TRUE 23 | ## usethis namespace: end 24 | #' @docType package 25 | #' @name datefixR 26 | #' @keywords internal 27 | "_PACKAGE" 28 | -------------------------------------------------------------------------------- /src/Makevars.in: -------------------------------------------------------------------------------- 1 | TARGET_DIR = ./rust/target 2 | LIBDIR = $(TARGET_DIR)/@LIBDIR@ 3 | STATLIB = $(LIBDIR)/libdatefixR.a 4 | PKG_LIBS = -L$(LIBDIR) -ldatefixR 5 | 6 | all: $(SHLIB) rust_clean 7 | 8 | .PHONY: $(STATLIB) 9 | 10 | $(SHLIB): $(STATLIB) 11 | 12 | CARGOTMP = $(CURDIR)/.cargo 13 | VENDOR_DIR = $(CURDIR)/vendor 14 | 15 | 16 | # RUSTFLAGS appends --print=native-static-libs to ensure that 17 | # the correct linkers are used. Use this for debugging if need. 18 | # 19 | # CRAN note: Cargo and Rustc versions are reported during 20 | # configure via tools/msrv.R. 21 | # 22 | # vendor.tar.xz, if present, is unzipped and used for offline compilation. 23 | $(STATLIB): 24 | 25 | if [ -f ./rust/vendor.tar.xz ]; then \ 26 | tar xf rust/vendor.tar.xz && \ 27 | mkdir -p $(CARGOTMP) && \ 28 | cp rust/vendor-config.toml $(CARGOTMP)/config.toml; \ 29 | fi 30 | 31 | export CARGO_HOME=$(CARGOTMP) && \ 32 | export PATH="$(PATH):$(HOME)/.cargo/bin" && \ 33 | @PANIC_EXPORTS@RUSTFLAGS="$(RUSTFLAGS) --print=native-static-libs" cargo build @CRAN_FLAGS@ --lib @PROFILE@ --manifest-path=./rust/Cargo.toml --target-dir $(TARGET_DIR) @TARGET@ 34 | 35 | # Always clean up CARGOTMP 36 | rm -Rf $(CARGOTMP); 37 | 38 | rust_clean: $(SHLIB) 39 | rm -Rf $(CARGOTMP) $(VENDOR_DIR) @CLEAN_TARGET@ 40 | 41 | clean: 42 | rm -Rf $(SHLIB) $(STATLIB) $(OBJECTS) $(TARGET_DIR) $(VENDOR_DIR) 43 | -------------------------------------------------------------------------------- /man/fix_date_app.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/shinyapp.R 3 | \name{fix_date_app} 4 | \alias{fix_date_app} 5 | \title{Shiny application standardizing date data in csv or excel files} 6 | \usage{ 7 | fix_date_app(theme = "datefixR") 8 | } 9 | \arguments{ 10 | \item{theme}{Color theme for shiny app. Either \code{"datefixR"} 11 | (\code{datefixR} colors) or \code{"none"}(default shiny app styling).} 12 | } 13 | \value{ 14 | A shiny app. 15 | } 16 | \description{ 17 | A shiny application which allows users to standardize dates 18 | using a graphical user interface (GUI). Most features of \code{datefixR} 19 | are supported including imputing missing date data. Data can be provided as 20 | CSV (comma-separated value) or XLSX (Excel) files. Processed datasets can 21 | be downloaded as CSV files. Please note, the dependencies for this app 22 | (\code{DT}, \code{htmltools}, \code{readxl}, and \code{shiny}) are not 23 | installed alongside \code{datefixR}. This allows \code{datefixR} to be 24 | installed on secure systems where these packages may not be allowed. If one 25 | of these dependencies is not installed on the system when this function is 26 | called, then the user will be given the option of installing them. 27 | } 28 | \examples{ 29 | \dontrun{ 30 | fix_date_app() 31 | } 32 | } 33 | \seealso{ 34 | The \code{\link[shiny]{shiny}} package. 35 | } 36 | -------------------------------------------------------------------------------- /tests/testthat/test_fix_date_app.R: -------------------------------------------------------------------------------- 1 | test_that("unexpected theme raises error raises error", { 2 | expect_error( 3 | fix_date_app(theme = "test"), 4 | "theme should be 'datefixR' or 'none' \n" 5 | ) 6 | }) 7 | 8 | test_that(".read_data works for xlsx files", { 9 | upload <- list() 10 | upload$datapath <- system.file("example.xlsx", package = "datefixR") 11 | 12 | exp.data <- data.frame( 13 | Apple = c( 14 | "02-03-21", 15 | "05 02 19", 16 | "April 2019", 17 | "12 1993" 18 | ), 19 | Pear = c( 20 | "Jan 2000", 21 | "1990", 22 | "sept 1984", 23 | "1990-05-01" 24 | ), 25 | Lemon = c( 26 | "1 1 2010", 27 | "2 Jan 1990", 28 | "25 Mar 1975", 29 | "December 2020" 30 | ) 31 | ) 32 | expect_equal(datefixR:::.read_data(upload), exp.data) 33 | }) 34 | 35 | 36 | test_that(".read_data works for csv files", { 37 | upload <- list() 38 | upload$datapath <- system.file("example.xlsx", package = "datefixR") 39 | 40 | exp.data <- data.frame( 41 | Apple = c( 42 | "02-03-21", 43 | "05 02 19", 44 | "April 2019", 45 | "12 1993" 46 | ), 47 | Pear = c( 48 | "Jan 2000", 49 | "1990", 50 | "sept 1984", 51 | "1990-05-01" 52 | ), 53 | Lemon = c( 54 | "1 1 2010", 55 | "2 Jan 1990", 56 | "25 Mar 1975", 57 | "December 2020" 58 | ) 59 | ) 60 | expect_equal(datefixR:::.read_data(upload), exp.data) 61 | }) 62 | -------------------------------------------------------------------------------- /po/datefixR.pot: -------------------------------------------------------------------------------- 1 | # SOME DESCRIPTIVE TITLE. 2 | # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER 3 | # This file is distributed under the same license as the datefixR package. 4 | # FIRST AUTHOR , YEAR. 5 | # 6 | #, fuzzy 7 | msgid "" 8 | msgstr "" 9 | "Project-Id-Version: datefixR 1.6.1.9000\n" 10 | "Report-Msgid-Bugs-To: \n" 11 | "POT-Creation-Date: 2024-09-07 11:21+0200\n" 12 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 13 | "Last-Translator: FULL NAME \n" 14 | "Language-Team: LANGUAGE \n" 15 | "Language: \n" 16 | "MIME-Version: 1.0\n" 17 | "Content-Type: text/plain; charset=CHARSET\n" 18 | "Content-Transfer-Encoding: 8bit\n" 19 | 20 | #: code.cpp:27 21 | msgid "Missing month with no imputation value given \n" 22 | msgstr "" 23 | 24 | #: code.cpp:34 25 | msgid "Missing day with no imputation value given \n" 26 | msgstr "" 27 | 28 | #: code.cpp:45 29 | msgid "day.impute should be an integer between 1 and 31\n" 30 | msgstr "" 31 | 32 | #: code.cpp:48 33 | msgid "day.impute should be an integer\n" 34 | msgstr "" 35 | 36 | #: rust/src/lib.rs:281 37 | msgid "Month not in expected range" 38 | msgstr "" 39 | 40 | #: rust/src/lib.rs:290 41 | msgid "Day not in expected range" 42 | msgstr "" 43 | 44 | #: rust/src/lib.rs:602 45 | msgid "format should be either 'dmy' or 'mdy'" 46 | msgstr "" 47 | 48 | #: rust/src/lib.rs:513 49 | msgid "unable to tidy a date" 50 | msgstr "" 51 | 52 | #: rust/src/lib.rs:421 53 | msgid "date should be a character" 54 | msgstr "" 55 | -------------------------------------------------------------------------------- /po/R-pt.po: -------------------------------------------------------------------------------- 1 | msgid "" 2 | msgstr "" 3 | "Project-Id-Version: datefixR 1.1.0.9000\n" 4 | "POT-Creation-Date: 2023-08-03 11:24\n" 5 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 6 | "Last-Translator: FULL NAME \n" 7 | "Language-Team: LANGUAGE \n" 8 | "Language: pt\n" 9 | "MIME-Version: 1.0\n" 10 | "Content-Type: text/plain; charset=UTF-8\n" 11 | "Content-Transfer-Encoding: 8bit\n" 12 | 13 | msgid "df should be a dataframe object!" 14 | msgstr "" 15 | 16 | msgid "col.names should be a character vector!" 17 | msgstr "" 18 | 19 | msgid "Unable to resolve date for subject" 20 | msgstr "" 21 | 22 | msgid "(date:" 23 | msgstr "" 24 | 25 | msgid ")" 26 | msgstr ")" 27 | 28 | msgid "unable to tidy a date" 29 | msgstr "" 30 | 31 | msgid "month.impute should be an integer between 1 and 12" 32 | msgstr "" 33 | 34 | msgid "month.impute should be an integer" 35 | msgstr "" 36 | 37 | msgid "Month not in expected range" 38 | msgstr "" 39 | 40 | msgid "Day not in expected range" 41 | msgstr "" 42 | 43 | msgid "format should be either 'dmy' or 'mdy'" 44 | msgstr "" 45 | 46 | msgid "NA imputed (date:" 47 | msgstr "" 48 | 49 | msgid "NA imputed for subject" 50 | msgstr "" 51 | 52 | msgid "date should be a character" 53 | msgstr "" 54 | 55 | msgid "theme should be 'datefixR' or 'none'" 56 | msgstr "" 57 | 58 | msgid "The current locale does not support multibyte characters." 59 | msgstr "" 60 | 61 | msgid "You may run into difficulties if any months are given as" 62 | msgstr "" 63 | 64 | msgid "non-English language names." 65 | msgstr "" 66 | -------------------------------------------------------------------------------- /po/R-datefixR.pot: -------------------------------------------------------------------------------- 1 | msgid "" 2 | msgstr "" 3 | "Project-Id-Version: datefixR 1.6.1.9000\n" 4 | "POT-Creation-Date: 2024-09-07 11:21\n" 5 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 6 | "Last-Translator: FULL NAME \n" 7 | "Language-Team: LANGUAGE \n" 8 | "Language: \n" 9 | "MIME-Version: 1.0\n" 10 | "Content-Type: text/plain; charset=CHARSET\n" 11 | "Content-Transfer-Encoding: 8bit\n" 12 | 13 | msgid "df should be a dataframe object!" 14 | msgstr "" 15 | 16 | msgid "col.names should be a character vector!" 17 | msgstr "" 18 | 19 | msgid "Unable to resolve date for subject" 20 | msgstr "" 21 | 22 | msgid "(date:" 23 | msgstr "" 24 | 25 | msgid ")" 26 | msgstr "" 27 | 28 | msgid "unable to tidy a date" 29 | msgstr "" 30 | 31 | msgid "month.impute should be an integer between 1 and 12" 32 | msgstr "" 33 | 34 | msgid "month.impute should be an integer" 35 | msgstr "" 36 | 37 | msgid "Month not in expected range" 38 | msgstr "" 39 | 40 | msgid "Day not in expected range" 41 | msgstr "" 42 | 43 | msgid "format should be either 'dmy' or 'mdy'" 44 | msgstr "" 45 | 46 | msgid "NA imputed (date:" 47 | msgstr "" 48 | 49 | msgid "NA imputed for subject" 50 | msgstr "" 51 | 52 | msgid "date should be a character" 53 | msgstr "" 54 | 55 | msgid "theme should be 'datefixR' or 'none'" 56 | msgstr "" 57 | 58 | msgid "The current locale does not support multibyte characters." 59 | msgstr "" 60 | 61 | msgid "You may run into difficulties if any months are given as" 62 | msgstr "" 63 | 64 | msgid "non-English language names." 65 | msgstr "" 66 | -------------------------------------------------------------------------------- /.github/workflows/update-citation-cff.yaml: -------------------------------------------------------------------------------- 1 | # Workflow derived from https://github.com/r-lib/actions/tree/master/examples 2 | # The action runs when: 3 | # - A new release is published 4 | # - The DESCRIPTION or inst/CITATION are modified 5 | # - Can be run manually 6 | # For customizing the triggers, visit https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows 7 | on: 8 | release: 9 | types: [published] 10 | push: 11 | branches: [master, main] 12 | paths: 13 | - DESCRIPTION 14 | - inst/CITATION 15 | workflow_dispatch: 16 | 17 | name: Update CITATION.cff 18 | 19 | jobs: 20 | update-citation-cff: 21 | runs-on: ubuntu-latest 22 | env: 23 | GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} 24 | steps: 25 | - uses: actions/checkout@v4 26 | - uses: r-lib/actions/setup-r@v2 27 | with: 28 | use-public-rspm: true 29 | - uses: r-lib/actions/setup-r-dependencies@v2 30 | with: 31 | extra-packages: | 32 | any::cffr 33 | any::V8 34 | 35 | - name: Update CITATION.cff 36 | run: | 37 | 38 | library(cffr) 39 | 40 | # Customize with your own code 41 | # See https://docs.ropensci.org/cffr/articles/cffr.html 42 | 43 | # Write your own keys 44 | mykeys <- list() 45 | 46 | # Create your CITATION.cff file 47 | cff_write(keys = mykeys) 48 | 49 | shell: Rscript {0} 50 | 51 | - name: Commit results 52 | run: | 53 | git config --local user.name "$GITHUB_ACTOR" 54 | git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com" 55 | git add CITATION.cff 56 | git commit -m 'Update CITATION.cff' || echo "No changes to commit" 57 | git push origin || echo "No changes to commit" 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /po/R-cs.po: -------------------------------------------------------------------------------- 1 | msgid "" 2 | msgstr "" 3 | "Project-Id-Version: datefixR 1.6.0\n" 4 | "POT-Creation-Date: 2023-08-07 10:49\n" 5 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 6 | "Last-Translator: FULL NAME \n" 7 | "Language-Team: None\n" 8 | "Language: cs\n" 9 | "MIME-Version: 1.0\n" 10 | "Content-Type: text/plain; charset=UTF-8\n" 11 | "Content-Transfer-Encoding: 8bit\n" 12 | 13 | msgid "df should be a dataframe object!" 14 | msgstr "df by měl být objekt typu dataframe!" 15 | 16 | msgid "col.names should be a character vector!" 17 | msgstr "col.names by měl být vektor znaků!" 18 | 19 | msgid "Unable to resolve date for subject" 20 | msgstr "Pro subjekt se nepodařilo rozpoznat datum" 21 | 22 | msgid "(date:" 23 | msgstr "(datum:" 24 | 25 | msgid ")" 26 | msgstr ")" 27 | 28 | msgid "unable to tidy a date" 29 | msgstr "nepodařilo se normalizovat datum" 30 | 31 | msgid "month.impute should be an integer between 1 and 12" 32 | msgstr "month.impute by mělo být celé číslo mezi 1 a 12" 33 | 34 | msgid "month.impute should be an integer" 35 | msgstr "month.impute by mělo být celé číslo" 36 | 37 | msgid "Month not in expected range" 38 | msgstr "Měsíc není v očekávaném rozsahu" 39 | 40 | msgid "Day not in expected range" 41 | msgstr "Den není v očekávaném rozsahu" 42 | 43 | msgid "format should be either 'dmy' or 'mdy'" 44 | msgstr "Formát by měl být buď 'dmy' nebo 'mdy'" 45 | 46 | msgid "NA imputed (date:" 47 | msgstr "Imputované NA (datum:" 48 | 49 | msgid "NA imputed for subject" 50 | msgstr "Imputované NA pro subjekt" 51 | 52 | msgid "date should be a character" 53 | msgstr "datum by měl být text" 54 | 55 | msgid "theme should be 'datefixR' or 'none'" 56 | msgstr "theme by měl být 'datefixR' nebo 'none'" 57 | 58 | msgid "The current locale does not support multibyte characters." 59 | msgstr "Aktuální prostředí (locale) nepodporuje vícebajtové znaky." 60 | 61 | msgid "You may run into difficulties if any months are given as" 62 | msgstr "Mohou nastat potíže, pokud jsou nějaké měsíce uvedené jako" 63 | 64 | msgid "non-English language names." 65 | msgstr "Neanglická jména jazyků." 66 | -------------------------------------------------------------------------------- /po/R-sk.po: -------------------------------------------------------------------------------- 1 | msgid "" 2 | msgstr "" 3 | "Project-Id-Version: datefixR 1.6.0\n" 4 | "POT-Creation-Date: 2023-08-07 10:49\n" 5 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 6 | "Last-Translator: FULL NAME \n" 7 | "Language-Team: None\n" 8 | "Language: sk\n" 9 | "MIME-Version: 1.0\n" 10 | "Content-Type: text/plain; charset=UTF-8\n" 11 | "Content-Transfer-Encoding: 8bit\n" 12 | 13 | msgid "df should be a dataframe object!" 14 | msgstr "df by mal byť objekt typu dataframe!" 15 | 16 | msgid "col.names should be a character vector!" 17 | msgstr "col.names by mal byť vektor znakov!" 18 | 19 | msgid "Unable to resolve date for subject" 20 | msgstr "Dátum nemohol byť rozpoznaný pre daný subjekt" 21 | 22 | msgid "(date:" 23 | msgstr "(dátum:" 24 | 25 | msgid ")" 26 | msgstr ")" 27 | 28 | msgid "unable to tidy a date" 29 | msgstr "nepodarilo sa normalizovať dátum" 30 | 31 | msgid "month.impute should be an integer between 1 and 12" 32 | msgstr "month.impute by malo byť celé číslo od 1 do 12" 33 | 34 | msgid "month.impute should be an integer" 35 | msgstr "month.impute by malo byť celé číslo" 36 | 37 | msgid "Month not in expected range" 38 | msgstr "Mesiac nie je v očakávanom rozsahu" 39 | 40 | msgid "Day not in expected range" 41 | msgstr "Deň nie je v očakávanom rozsahu" 42 | 43 | msgid "format should be either 'dmy' or 'mdy'" 44 | msgstr "Formát by mal byť 'dmy' alebo 'mdy'." 45 | 46 | msgid "NA imputed (date:" 47 | msgstr "Imputované NA (dátum:" 48 | 49 | msgid "NA imputed for subject" 50 | msgstr "Imputované NA pre subjekt" 51 | 52 | msgid "date should be a character" 53 | msgstr "dátum by malo byť text" 54 | 55 | msgid "theme should be 'datefixR' or 'none'" 56 | msgstr "theme by mal byť 'datefixR' alebo 'none'" 57 | 58 | msgid "The current locale does not support multibyte characters." 59 | msgstr "Aktuálne prostredie (locale) nepodporuje viacbajtové znaky." 60 | 61 | msgid "You may run into difficulties if any months are given as" 62 | msgstr "Môžu nastať problémy, ak sú niektoré mesiace uvedené ako" 63 | 64 | msgid "non-English language names." 65 | msgstr "Neanglické názvy jazykov." 66 | -------------------------------------------------------------------------------- /po/R-id.po: -------------------------------------------------------------------------------- 1 | msgid "" 2 | msgstr "" 3 | "Project-Id-Version: datefixR 1.7.0\n" 4 | "POT-Creation-Date: 2023-08-07 10:49\n" 5 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 6 | "Last-Translator: FULL NAME \n" 7 | "Language-Team: LANGUAGE \n" 8 | "Language: \n" 9 | "MIME-Version: 1.0\n" 10 | "Content-Type: text/plain; charset=UTF-8\n" 11 | "Content-Transfer-Encoding: 8bit\n" 12 | 13 | msgid "df should be a dataframe object!" 14 | msgstr "df harus tipe objek dataframe!" 15 | 16 | msgid "col.names should be a character vector!" 17 | msgstr "col.names harus berupa character vector!" 18 | 19 | msgid "Unable to resolve date for subject" 20 | msgstr "Tidak dapat menuntaskan tanggal untuk subjek" 21 | 22 | msgid "(date:" 23 | msgstr "(tanggal:" 24 | 25 | msgid ")" 26 | msgstr ")" 27 | 28 | msgid "unable to tidy a date" 29 | msgstr "tanggal tidak dapat dirapihkan" 30 | 31 | msgid "month.impute should be an integer between 1 and 12" 32 | msgstr "month.impute harus berupa bilangan bulat antara 1 dan 12" 33 | 34 | msgid "month.impute should be an integer" 35 | msgstr "month.impute harus berupa bilangan bulat" 36 | 37 | msgid "Month not in expected range" 38 | msgstr "Bulan bukan dalam jangka yang di ekspektasi" 39 | 40 | msgid "Day not in expected range" 41 | msgstr "Hari bukan dalam jangka yang di ekspektasi" 42 | 43 | msgid "format should be either 'dmy' or 'mdy'" 44 | msgstr "format harus 'dmy' atau 'mdy'" 45 | 46 | msgid "NA imputed (date:" 47 | msgstr "NA diperhitungkan (tanggal:" 48 | 49 | msgid "NA imputed for subject" 50 | msgstr "NA diperhitungkan untuk subjek" 51 | 52 | msgid "date should be a character" 53 | msgstr "tanggal harus berupa karakter" 54 | 55 | msgid "theme should be 'datefixR' or 'none'" 56 | msgstr "tema harus berupa 'datefixR' atau 'none'" 57 | 58 | msgid "The current locale does not support multibyte characters." 59 | msgstr "Locale ini tidak mendukung karakter multibyte." 60 | 61 | msgid "You may run into difficulties if any months are given as" 62 | msgstr "Anda mungkin mengalami kesulitan jika ada bulan yang diberikan sebagai" 63 | 64 | msgid "non-English language names." 65 | msgstr "nama-nama bahasa bukan dalam Bahasa Inggris." 66 | -------------------------------------------------------------------------------- /po/R-es.po: -------------------------------------------------------------------------------- 1 | msgid "" 2 | msgstr "" 3 | "Project-Id-Version: datefixR 1.4.1.9000\n" 4 | "POT-Creation-Date: 2023-08-03 11:24\n" 5 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 6 | "Last-Translator: FULL NAME \n" 7 | "Language-Team: LANGUAGE \n" 8 | "Language: \n" 9 | "MIME-Version: 1.0\n" 10 | "Content-Type: text/plain; charset=UTF-8\n" 11 | "Content-Transfer-Encoding: 8bit\n" 12 | 13 | msgid "df should be a dataframe object!" 14 | msgstr "df debe ser un objeto de tipo dataframe!" 15 | 16 | msgid "col.names should be a character vector!" 17 | msgstr "col.names debe ser un vector de carácteres" 18 | 19 | msgid "Unable to resolve date for subject" 20 | msgstr "Imposible resolver la fecha para el sujeto" 21 | 22 | msgid "(date:" 23 | msgstr "(fecha:" 24 | 25 | msgid ")" 26 | msgstr ")" 27 | 28 | msgid "unable to tidy a date" 29 | msgstr "Imposible acomodar una fecha" 30 | 31 | msgid "month.impute should be an integer between 1 and 12" 32 | msgstr "month.impute debe ser un número entero entre 1 y 12" 33 | 34 | msgid "month.impute should be an integer" 35 | msgstr "month.impute debe ser un número entero" 36 | 37 | msgid "Month not in expected range" 38 | msgstr "Mes fuera del rango esperado" 39 | 40 | msgid "Day not in expected range" 41 | msgstr "Día fuera del rango esperado" 42 | 43 | msgid "format should be either 'dmy' or 'mdy'" 44 | msgstr "formato debe ser 'dma' o 'mda'" 45 | 46 | msgid "NA imputed (date:" 47 | msgstr "NA imputado (fecha:" 48 | 49 | msgid "NA imputed for subject" 50 | msgstr "NA imputado para el sujeto" 51 | 52 | msgid "date should be a character" 53 | msgstr "la fecha debe ser un carácter" 54 | 55 | msgid "theme should be 'datefixR' or 'none'" 56 | msgstr "el tema debe ser 'datefixR' o 'none'" 57 | 58 | msgid "The current locale does not support multibyte characters." 59 | msgstr "La configuración regional actual no admite caractéres multibyte" 60 | 61 | msgid "You may run into difficulties if any months are given as" 62 | msgstr "Puedes tener dificultades si algún mes es dado como" 63 | 64 | msgid "non-English language names." 65 | msgstr "nombres en idiomas distintos del inglés." 66 | 67 | #~ msgid "Day of the year not in expected range" 68 | #~ msgstr "Día del año fuera del rango esperado" 69 | -------------------------------------------------------------------------------- /po/R-de.po: -------------------------------------------------------------------------------- 1 | msgid "" 2 | msgstr "" 3 | "Project-Id-Version: datefixR 1.3.1\n" 4 | "POT-Creation-Date: 2023-08-03 11:24\n" 5 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 6 | "Last-Translator: FULL NAME \n" 7 | "Language-Team: LANGUAGE \n" 8 | "Language: \n" 9 | "MIME-Version: 1.0\n" 10 | "Content-Type: text/plain; charset=UTF-8\n" 11 | "Content-Transfer-Encoding: 8bit\n" 12 | 13 | msgid "df should be a dataframe object!" 14 | msgstr "df muss ein dataframe Objekt sein!" 15 | 16 | msgid "col.names should be a character vector!" 17 | msgstr "col.names muss ein character vector sein!" 18 | 19 | msgid "Unable to resolve date for subject" 20 | msgstr "Datum kann nicht aufgelöst werden für" 21 | 22 | msgid "(date:" 23 | msgstr "(Datum:" 24 | 25 | msgid ")" 26 | msgstr ")" 27 | 28 | msgid "unable to tidy a date" 29 | msgstr "Datum kann nicht bereinigt werden" 30 | 31 | msgid "month.impute should be an integer between 1 and 12" 32 | msgstr "month.impute sollte eine Ganzzahl zwischen 1 und 12 sein" 33 | 34 | msgid "month.impute should be an integer" 35 | msgstr "month.impute sollte eine Ganzzahl sein" 36 | 37 | msgid "Month not in expected range" 38 | msgstr "Monat nicht im erwarteten Bereich" 39 | 40 | msgid "Day not in expected range" 41 | msgstr "Tag nicht im erwarteten Bereich" 42 | 43 | msgid "format should be either 'dmy' or 'mdy'" 44 | msgstr "format sollte entweder 'dmy' oder 'mdy' sein" 45 | 46 | msgid "NA imputed (date:" 47 | msgstr "NA imputiert (Datum:" 48 | 49 | msgid "NA imputed for subject" 50 | msgstr "NA imputiert für" 51 | 52 | msgid "date should be a character" 53 | msgstr "date muss vom Typ character sein" 54 | 55 | msgid "theme should be 'datefixR' or 'none'" 56 | msgstr "theme muss 'datefixR' oder 'none' sein" 57 | 58 | msgid "The current locale does not support multibyte characters." 59 | msgstr "Das aktuelle Gebietsschema unterstützt keine Multibyte-Zeichen." 60 | 61 | msgid "You may run into difficulties if any months are given as" 62 | msgstr "Sie können auf Schwierigkeiten stoßen, wenn Monate angegeben sind als" 63 | 64 | msgid "non-English language names." 65 | msgstr "nicht englischsprachige Namen." 66 | 67 | #~ msgid "Day of the year not in expected range" 68 | #~ msgstr "Tag nicht im erwarteten Bereich" 69 | -------------------------------------------------------------------------------- /po/R-fr.po: -------------------------------------------------------------------------------- 1 | msgid "" 2 | msgstr "" 3 | "Project-Id-Version: datefixR 1.3.1\n" 4 | "POT-Creation-Date: 2023-08-03 11:24\n" 5 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 6 | "Last-Translator: FULL NAME \n" 7 | "Language-Team: LANGUAGE \n" 8 | "Language: \n" 9 | "MIME-Version: 1.0\n" 10 | "Content-Type: text/plain; charset=UTF-8\n" 11 | "Content-Transfer-Encoding: 8bit\n" 12 | 13 | msgid "df should be a dataframe object!" 14 | msgstr "df doit être un objet de type dataframe !" 15 | 16 | msgid "col.names should be a character vector!" 17 | msgstr "col.manes doit être un vecteur de caractères !" 18 | 19 | msgid "Unable to resolve date for subject" 20 | msgstr "Impossible de résoudre la date pour le sujet" 21 | 22 | msgid "(date:" 23 | msgstr "(date :" 24 | 25 | msgid ")" 26 | msgstr ")" 27 | 28 | msgid "unable to tidy a date" 29 | msgstr "impossible de nettoyer une date" 30 | 31 | msgid "month.impute should be an integer between 1 and 12" 32 | msgstr "month.impute doit être un nombre entier entre 1 et 12" 33 | 34 | msgid "month.impute should be an integer" 35 | msgstr "month.impute doit être un nombre entier" 36 | 37 | msgid "Month not in expected range" 38 | msgstr "Month ne se situe pas dans l'intervalle attendu " 39 | 40 | msgid "Day not in expected range" 41 | msgstr "Day ne se situe pas dans l'intervalle attendu " 42 | 43 | msgid "format should be either 'dmy' or 'mdy'" 44 | msgstr "le format doit être soit 'jma' ou 'mja'" 45 | 46 | msgid "NA imputed (date:" 47 | msgstr "NA imputé (date :" 48 | 49 | msgid "NA imputed for subject" 50 | msgstr "NA imputé pour le sujet" 51 | 52 | msgid "date should be a character" 53 | msgstr "la date doit être un caractère" 54 | 55 | msgid "theme should be 'datefixR' or 'none'" 56 | msgstr "le thème doit être 'datefixR' ou 'none'" 57 | 58 | msgid "The current locale does not support multibyte characters." 59 | msgstr "Les réglages régionaux actuels ne prennent pas en charge les caractères multioctets." 60 | 61 | msgid "You may run into difficulties if any months are given as" 62 | msgstr "Vous risquez de rencontrer des difficultés si des mois sont utilisés" 63 | 64 | msgid "non-English language names." 65 | msgstr "avec des noms dans une langue autre que l'anglais." 66 | 67 | #~ msgid "Day of the year not in expected range" 68 | #~ msgstr "Day of the year ne se situe pas dans l'intervalle attendu" 69 | -------------------------------------------------------------------------------- /po/R-ru.po: -------------------------------------------------------------------------------- 1 | msgid "" 2 | msgstr "" 3 | "Project-Id-Version: datefixR 1.4.1.9000\n" 4 | "POT-Creation-Date: 2023-08-03 11:24\n" 5 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 6 | "Last-Translator: FULL NAME \n" 7 | "Language-Team: LANGUAGE \n" 8 | "Language: \n" 9 | "MIME-Version: 1.0\n" 10 | "Content-Type: text/plain; charset=UTF-8\n" 11 | "Content-Transfer-Encoding: 8bit\n" 12 | 13 | msgid "df should be a dataframe object!" 14 | msgstr "`df` должен быть объектом класса `dataframe`!" 15 | 16 | msgid "col.names should be a character vector!" 17 | msgstr "`col.names` должен быть строковым вектором (т.е. класса 'character')" 18 | 19 | msgid "Unable to resolve date for subject" 20 | msgstr "Не удалось определить дату для предмета" 21 | 22 | msgid "(date:" 23 | msgstr "(дата:" 24 | 25 | msgid ")" 26 | msgstr ")" 27 | 28 | msgid "unable to tidy a date" 29 | msgstr "Не удалось почистить дату" 30 | 31 | msgid "month.impute should be an integer between 1 and 12" 32 | msgstr "`month.impute` должен быть целым числом (класса 'integer') от 1 до 12" 33 | 34 | msgid "month.impute should be an integer" 35 | msgstr "`month.impute` должен быть целым числом (класса 'integer')" 36 | 37 | msgid "Month not in expected range" 38 | msgstr "Месяц определен вне ожидаемого диапазона" 39 | 40 | msgid "Day not in expected range" 41 | msgstr "день определен вне ожидаемого диапазона" 42 | 43 | msgid "format should be either 'dmy' or 'mdy'" 44 | msgstr "переменная `format` должна быть либо 'dmy' (т.е., день-месяц-год), либо 'mdy' (т.е., месяц-день-год)" 45 | 46 | msgid "NA imputed (date:" 47 | msgstr "Н/Д (т.е. `NA`) присвоено (дата:" 48 | 49 | msgid "NA imputed for subject" 50 | msgstr "Н/Д (т.е. `NA`) присвоено для предмета" 51 | 52 | msgid "date should be a character" 53 | msgstr "Переменная `date` должна быть строкой" 54 | 55 | msgid "theme should be 'datefixR' or 'none'" 56 | msgstr "Переменная `theme` должна быть 'datefixR' или 'none'" 57 | 58 | msgid "The current locale does not support multibyte characters." 59 | msgstr "Текущая локаль не поддерживает многобайтовые символы." 60 | 61 | msgid "You may run into difficulties if any months are given as" 62 | msgstr "Вы можете столкнуться с трудностями, если какие-либо месяцы указаны как" 63 | 64 | msgid "non-English language names." 65 | msgstr "названия не на английском языке." 66 | 67 | 68 | 69 | #~ msgid "Day of the year not in expected range" 70 | #~ msgstr "День года определен вне ожидаемого диапазона" 71 | -------------------------------------------------------------------------------- /man/datefixR.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/datefixR-package.R 3 | \docType{package} 4 | \name{datefixR} 5 | \alias{datefixR-package} 6 | \alias{datefixR} 7 | \title{datefixR: Standardize Dates in Different Formats or with Missing Data} 8 | \description{ 9 | There are many different formats dates are commonly represented 10 | with: the order of day, month, or year can differ, different separators 11 | ("-", "/", or whitespace) can be used, months can be numerical, names, or 12 | abbreviations and year given as two digits or four. \code{datefixR} takes dates 13 | in all these different formats and converts them to \R{}'s built-in date 14 | class. If \code{datefixR} cannot standardize a date, such as because it is too 15 | malformed, then the user is told which date cannot be standardized and the 16 | corresponding ID for the row. \code{datefixR} also allows the imputation of 17 | missing days and months with user-controlled behavior. 18 | 19 | Get started by reading \code{vignette("datefixR")} 20 | } 21 | \seealso{ 22 | Useful links: 23 | \itemize{ 24 | \item \url{https://docs.ropensci.org/datefixR/} 25 | \item \url{https://github.com/ropensci/datefixR/} 26 | \item Report bugs at \url{https://github.com/ropensci/datefixR/issues} 27 | } 28 | } 29 | \author{ 30 | \strong{Maintainer}: Nathan Constantine-Cooke \email{nathan.constantine-cooke@ed.ac.uk} (\href{https://orcid.org/0000-0002-4437-8713}{ORCID}) 31 | 32 | Other contributors: 33 | \itemize{ 34 | \item Jonathan Kitt \email{jonathan.kitt@protonmail.com} [contributor, translator] 35 | \item Antonio J. Pérez-Luque \email{ajpelu@gmail.com} (\href{https://orcid.org/0000-0002-1747-0469}{ORCID}) [contributor, translator] 36 | \item Daniel Possenriede \email{possenriede+r@gmail.com} (\href{https://orcid.org/0000-0002-6738-9845}{ORCID}) [contributor, translator] 37 | \item Michal Lauer \email{michal.lauer.25@gmail.com} [contributor, translator] 38 | \item Kaique dos S. Alves \email{kaiquedsalves@gmail.com} (\href{https://orcid.org/0000-0001-9187-0252}{ORCID}) [reviewer] 39 | \item Al-Ahmadgaid B. Asaad \email{alahmadgaid@gmail.com} (\href{https://orcid.org/0000-0003-3784-8593}{ORCID}) [reviewer] 40 | \item Anatoly Tsyplenkov \email{atsyplenkov@gmail.com} (\href{https://orcid.org/0000-0003-4144-8402}{ORCID}) [contributor, translator] 41 | \item Chitra M. Saraswati \email{chitra.m.saraswati@gmail.com} (\href{https://orcid.org/0000-0002-8159-0414}{ORCID}) [contributor, translator] 42 | } 43 | 44 | } 45 | \keyword{internal} 46 | -------------------------------------------------------------------------------- /.github/workflows/pr-commands.yaml: -------------------------------------------------------------------------------- 1 | # Workflow derived from https://github.com/r-lib/actions/tree/master/examples 2 | # Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help 3 | on: 4 | issue_comment: 5 | types: [created] 6 | 7 | name: Commands 8 | 9 | jobs: 10 | document: 11 | if: ${{ github.event.issue.pull_request && (github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'OWNER') && startsWith(github.event.comment.body, '/document') }} 12 | name: document 13 | runs-on: ubuntu-latest 14 | env: 15 | GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} 16 | steps: 17 | - uses: actions/checkout@v4 18 | 19 | - uses: r-lib/actions/pr-fetch@v2 20 | with: 21 | repo-token: ${{ secrets.GITHUB_TOKEN }} 22 | 23 | - uses: r-lib/actions/setup-r@v2 24 | with: 25 | use-public-rspm: true 26 | 27 | - uses: r-lib/actions/setup-r-dependencies@v2 28 | with: 29 | extra-packages: roxygen2 30 | 31 | - name: Document 32 | run: Rscript -e 'roxygen2::roxygenise()' 33 | 34 | - name: commit 35 | run: | 36 | git config --local user.name "$GITHUB_ACTOR" 37 | git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com" 38 | git add man/\* NAMESPACE 39 | git commit -m 'Document' 40 | 41 | - uses: r-lib/actions/pr-push@v2 42 | with: 43 | repo-token: ${{ secrets.GITHUB_TOKEN }} 44 | 45 | style: 46 | if: ${{ github.event.issue.pull_request && (github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'OWNER') && startsWith(github.event.comment.body, '/style') }} 47 | name: style 48 | runs-on: ubuntu-latest 49 | env: 50 | GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} 51 | steps: 52 | - uses: actions/checkout@v4 53 | 54 | - uses: r-lib/actions/pr-fetch@v2 55 | with: 56 | repo-token: ${{ secrets.GITHUB_TOKEN }} 57 | 58 | - uses: r-lib/actions/setup-r@v2 59 | 60 | - name: Install dependencies 61 | run: Rscript -e 'install.packages("styler")' 62 | 63 | - name: Style 64 | run: Rscript -e 'styler::style_pkg()' 65 | 66 | - name: commit 67 | run: | 68 | git config --local user.name "$GITHUB_ACTOR" 69 | git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com" 70 | git add \*.R 71 | git commit -m 'Style' 72 | 73 | - uses: r-lib/actions/pr-push@v2 74 | with: 75 | repo-token: ${{ secrets.GITHUB_TOKEN }} 76 | -------------------------------------------------------------------------------- /.github/workflows/update-docs.yaml: -------------------------------------------------------------------------------- 1 | 2 | on: 3 | push: 4 | branches: [master, main] 5 | 6 | 7 | permissions: 8 | actions: read 9 | attestations: read 10 | checks: read 11 | contents: write 12 | deployments: write 13 | id-token: write 14 | issues: write 15 | discussions: none 16 | packages: none 17 | pages: none 18 | pull-requests: write 19 | repository-projects: none 20 | security-events: none 21 | statuses: write 22 | 23 | name: "Update README/lint package" 24 | jobs: 25 | Update-readme-md: 26 | runs-on: ubuntu-latest 27 | env: 28 | GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} 29 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} 30 | steps: 31 | - uses: actions/checkout@v4 32 | - uses: r-lib/actions/setup-r@v2 33 | with: 34 | use-public-rspm: true 35 | - uses: r-lib/actions/setup-pandoc@v2 36 | with: 37 | pandoc-version: '2.7.3' # The pandoc version to download (if necessary) and use. 38 | - uses: r-lib/actions/setup-r-dependencies@v2 39 | with: 40 | extra-packages: local::. 41 | 42 | - name: Render README 43 | run: rmarkdown::render("README.Rmd") 44 | shell: Rscript {0} 45 | - name: Commit and push changes 46 | run: | 47 | if [[ `git status --porcelain` ]]; then 48 | git config user.name 'github-actions[bot]' 49 | git config user.email 'github-actions[bot]@users.noreply.github.com' 50 | git checkout -b update-readme 51 | git add -A 52 | git commit -m "Re-render README" 53 | git push --set-upstream origin -f update-readme 54 | gh pr create -B main -H update-readme --title 'Merge update-readme into main' --body 'Created by Github action' 55 | fi 56 | 57 | lint-package: 58 | runs-on: ubuntu-latest 59 | env: 60 | GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} 61 | GH_TOKEN: ${{ github.token }} 62 | steps: 63 | - uses: actions/checkout@v4 64 | - uses: r-lib/actions/setup-r@v2 65 | with: 66 | use-public-rspm: true 67 | - uses: r-lib/actions/setup-r-dependencies@v2 68 | with: 69 | extra-packages: | 70 | any::styler 71 | any::roxygen2 72 | - name: Lint package 73 | run: styler::style_pkg() 74 | shell: Rscript {0} 75 | - name: Commit and push changes 76 | run: | 77 | if [[ `git status --porcelain` ]]; then 78 | git config user.name 'github-actions[bot]' 79 | git config user.email 'github-actions[bot]@users.noreply.github.com' 80 | git checkout -b update-lint 81 | git add -A 82 | git commit -m "Lint package" 83 | git push --set-upstream origin -f update-lint 84 | gh pr create -B main -H update-lint --title 'Merge update-lint into main' --body 'Created by Github action' 85 | fi -------------------------------------------------------------------------------- /DESCRIPTION: -------------------------------------------------------------------------------- 1 | Package: datefixR 2 | Title: Standardize Dates in Different Formats or with Missing Data 3 | Version: 2.0.0.9000 4 | Maintainer: Nathan Constantine-Cooke 5 | Authors@R: c( 6 | person("Nathan", "Constantine-Cooke", , "nathan.constantine-cooke@ed.ac.uk", role = c("aut", "cre"), 7 | comment = c(ORCID = "0000-0002-4437-8713")), 8 | person("Jonathan", "Kitt", , "jonathan.kitt@protonmail.com", role = c("ctb", "trl")), 9 | person("Antonio J.", "Pérez-Luque", , "ajpelu@gmail.com", role = c("ctb", "trl"), 10 | comment = c(ORCID = "0000-0002-1747-0469")), 11 | person("Daniel", "Possenriede", , "possenriede+r@gmail.com", role = c("ctb", "trl"), 12 | comment = c(ORCID = "0000-0002-6738-9845")), 13 | person("Michal", "Lauer", , "michal.lauer.25@gmail.com", role = c("ctb", "trl")), 14 | person("Kaique dos S.", "Alves", , "kaiquedsalves@gmail.com", role = "rev", 15 | comment = c(ORCID = "0000-0001-9187-0252")), 16 | person("Al-Ahmadgaid B.", "Asaad", , "alahmadgaid@gmail.com", role = "rev", 17 | comment = c(ORCID = "0000-0003-3784-8593")), 18 | person("Anatoly", "Tsyplenkov", , "atsyplenkov@gmail.com", role = c("ctb", "trl"), 19 | comment = c(ORCID = "0000-0003-4144-8402")), 20 | person("Chitra M.", "Saraswati", , "chitra.m.saraswati@gmail.com", role = c("ctb", "trl"), 21 | comment = c(ORCID = "0000-0002-8159-0414")) 22 | ) 23 | Description: There are many different formats dates are commonly 24 | represented with: the order of day, month, or year can differ, 25 | different separators ("-", "/", or whitespace) can be used, months can 26 | be numerical, names, or abbreviations and year given as two digits or 27 | four. 'datefixR' takes dates in all these different formats and 28 | converts them to R's built-in date class. If 'datefixR' cannot 29 | standardize a date, such as because it is too malformed, then the user 30 | is told which date cannot be standardized and the corresponding ID for 31 | the row. 'datefixR' also allows the imputation of missing days and 32 | months with user-controlled behavior. 33 | License: GPL (>= 3) 34 | URL: https://docs.ropensci.org/datefixR/, 35 | https://github.com/ropensci/datefixR 36 | BugReports: https://github.com/ropensci/datefixR/issues 37 | Depends: 38 | R (>= 4.2) 39 | Imports: 40 | lifecycle, 41 | rlang 42 | Suggests: 43 | anytime, 44 | DT, 45 | future, 46 | future.apply, 47 | htmltools, 48 | knitr, 49 | parsedate, 50 | pkgbuild, 51 | png, 52 | readr, 53 | readxl, 54 | rmarkdown, 55 | shiny, 56 | shinytest2, 57 | spelling, 58 | testthat (>= 3.0.0), 59 | withr 60 | VignetteBuilder: 61 | knitr 62 | Config/testthat/edition: 3 63 | Config/testthat/parallel: true 64 | Encoding: UTF-8 65 | Language: en-US 66 | LazyData: true 67 | Roxygen: list(markdown = TRUE) 68 | RoxygenNote: 7.3.2 69 | Config/rextendr/version: 0.4.2 70 | SystemRequirements: Cargo (Rust's package manager), rustc, xz 71 | -------------------------------------------------------------------------------- /tools/config.R: -------------------------------------------------------------------------------- 1 | # Note: Any variables prefixed with `.` are used for text 2 | # replacement in the Makevars.in and Makevars.win.in 3 | 4 | # check the packages MSRV first 5 | source("tools/msrv.R") 6 | 7 | # check DEBUG and NOT_CRAN environment variables 8 | env_debug <- Sys.getenv("DEBUG") 9 | env_not_cran <- Sys.getenv("NOT_CRAN") 10 | 11 | # check if the vendored zip file exists 12 | vendor_exists <- file.exists("src/rust/vendor.tar.xz") 13 | 14 | is_not_cran <- env_not_cran != "" 15 | is_debug <- env_debug != "" 16 | 17 | if (is_debug) { 18 | # if we have DEBUG then we set not cran to true 19 | # CRAN is always release build 20 | is_not_cran <- TRUE 21 | message("Creating DEBUG build.") 22 | } 23 | 24 | if (!is_not_cran) { 25 | message("Building for CRAN.") 26 | } 27 | 28 | # we set cran flags only if NOT_CRAN is empty and if 29 | # the vendored crates are present. 30 | .cran_flags <- ifelse( 31 | !is_not_cran && vendor_exists, 32 | "-j 2 --offline", 33 | "" 34 | ) 35 | 36 | # when DEBUG env var is present we use `--debug` build 37 | .profile <- ifelse(is_debug, "", "--release") 38 | .clean_targets <- ifelse(is_debug, "", "$(TARGET_DIR)") 39 | 40 | # We specify this target when building for webR 41 | webr_target <- "wasm32-unknown-emscripten" 42 | 43 | # here we check if the platform we are building for is webr 44 | is_wasm <- identical(R.version$platform, webr_target) 45 | 46 | # print to terminal to inform we are building for webr 47 | if (is_wasm) { 48 | message("Building for WebR") 49 | } 50 | 51 | # we check if we are making a debug build or not 52 | # if so, the LIBDIR environment variable becomes: 53 | # LIBDIR = $(TARGET_DIR)/{wasm32-unknown-emscripten}/debug 54 | # this will be used to fill out the LIBDIR env var for Makevars.in 55 | target_libpath <- if (is_wasm) "wasm32-unknown-emscripten" else NULL 56 | cfg <- if (is_debug) "debug" else "release" 57 | 58 | # used to replace @LIBDIR@ 59 | .libdir <- paste(c(target_libpath, cfg), collapse = "/") 60 | 61 | # use this to replace @TARGET@ 62 | # we specify the target _only_ on webR 63 | # there may be use cases later where this can be adapted or expanded 64 | .target <- ifelse(is_wasm, paste0("--target=", webr_target), "") 65 | 66 | # add panic exports and symbol optimization flags only for WASM builds via RUSTFLAGS 67 | .panic_exports <- ifelse( 68 | is_wasm, 69 | "RUSTFLAGS=\"$RUSTFLAGS -C panic=abort -C opt-level=s -C lto=fat -C codegen-units=1 -C strip=symbols\" ", 70 | "" 71 | ) 72 | 73 | # read in the Makevars.in file checking 74 | is_windows <- .Platform[["OS.type"]] == "windows" 75 | 76 | # if windows we replace in the Makevars.win.in 77 | mv_fp <- ifelse( 78 | is_windows, 79 | "src/Makevars.win.in", 80 | "src/Makevars.in" 81 | ) 82 | 83 | # set the output file 84 | mv_ofp <- ifelse( 85 | is_windows, 86 | "src/Makevars.win", 87 | "src/Makevars" 88 | ) 89 | 90 | # delete the existing Makevars{.win/.wasm} 91 | if (file.exists(mv_ofp)) { 92 | message("Cleaning previous `", mv_ofp, "`.") 93 | invisible(file.remove(mv_ofp)) 94 | } 95 | 96 | # read as a single string 97 | mv_txt <- readLines(mv_fp) 98 | 99 | # replace placeholder values 100 | new_txt <- gsub("@CRAN_FLAGS@", .cran_flags, mv_txt) |> 101 | gsub("@PROFILE@", .profile, x = _) |> 102 | gsub("@CLEAN_TARGET@", .clean_targets, x = _) |> 103 | gsub("@LIBDIR@", .libdir, x = _) |> 104 | gsub("@TARGET@", .target, x = _) |> 105 | gsub("@PANIC_EXPORTS@", .panic_exports, x = _) 106 | 107 | message("Writing `", mv_ofp, "`.") 108 | con <- file(mv_ofp, open = "wb") 109 | writeLines(new_txt, con, sep = "\n") 110 | close(con) 111 | 112 | message("`tools/config.R` has finished.") 113 | -------------------------------------------------------------------------------- /tools/msrv.R: -------------------------------------------------------------------------------- 1 | # read the DESCRIPTION file 2 | desc <- read.dcf("DESCRIPTION") 3 | 4 | if (!"SystemRequirements" %in% colnames(desc)) { 5 | fmt <- c( 6 | "`SystemRequirements` not found in `DESCRIPTION`.", 7 | "Please specify `SystemRequirements: Cargo (Rust's package manager), rustc`" 8 | ) 9 | stop(paste(fmt, collapse = "\n")) 10 | } 11 | 12 | # extract system requirements 13 | sysreqs <- desc[, "SystemRequirements"] 14 | 15 | # check that cargo and rustc is found 16 | if (!grepl("cargo", sysreqs, ignore.case = TRUE)) { 17 | stop("You must specify `Cargo (Rust's package manager)` in your `SystemRequirements`") 18 | } 19 | 20 | if (!grepl("rustc", sysreqs, ignore.case = TRUE)) { 21 | stop("You must specify `Cargo (Rust's package manager), rustc` in your `SystemRequirements`") 22 | } 23 | 24 | # split into parts 25 | parts <- strsplit(sysreqs, ", ")[[1]] 26 | 27 | # identify which is the rustc 28 | rustc_ver <- parts[grepl("rustc", parts)] 29 | 30 | # perform checks for the presence of rustc and cargo on the OS 31 | no_cargo_msg <- c( 32 | "----------------------- [CARGO NOT FOUND]--------------------------", 33 | "The 'cargo' command was not found on the PATH. Please install Cargo", 34 | "from: https://www.rust-lang.org/tools/install", 35 | "", 36 | "Alternatively, you may install Cargo from your OS package manager:", 37 | " - Debian/Ubuntu: apt-get install cargo", 38 | " - Fedora/CentOS: dnf install cargo", 39 | " - macOS: brew install rust", 40 | "-------------------------------------------------------------------" 41 | ) 42 | 43 | no_rustc_msg <- c( 44 | "----------------------- [RUST NOT FOUND]---------------------------", 45 | "The 'rustc' compiler was not found on the PATH. Please install", 46 | paste(rustc_ver, "or higher from:"), 47 | "https://www.rust-lang.org/tools/install", 48 | "", 49 | "Alternatively, you may install Rust from your OS package manager:", 50 | " - Debian/Ubuntu: apt-get install rustc", 51 | " - Fedora/CentOS: dnf install rustc", 52 | " - macOS: brew install rust", 53 | "-------------------------------------------------------------------" 54 | ) 55 | 56 | # Add {user}/.cargo/bin to path before checking 57 | new_path <- paste0( 58 | Sys.getenv("PATH"), 59 | ":", 60 | paste0(Sys.getenv("HOME"), "/.cargo/bin") 61 | ) 62 | 63 | # set the path with the new path 64 | Sys.setenv("PATH" = new_path) 65 | 66 | # check for rustc installation 67 | rustc_version <- tryCatch( 68 | system("rustc --version", intern = TRUE), 69 | error = function(e) { 70 | stop(paste(no_rustc_msg, collapse = "\n")) 71 | } 72 | ) 73 | 74 | # check for cargo installation 75 | cargo_version <- tryCatch( 76 | system("cargo --version", intern = TRUE), 77 | error = function(e) { 78 | stop(paste(no_cargo_msg, collapse = "\n")) 79 | } 80 | ) 81 | 82 | # helper function to extract versions 83 | extract_semver <- function(ver) { 84 | if (grepl("\\d+\\.\\d+(\\.\\d+)?", ver)) { 85 | sub(".*?(\\d+\\.\\d+(\\.\\d+)?).*", "\\1", ver) 86 | } else { 87 | NA 88 | } 89 | } 90 | 91 | # get the MSRV 92 | msrv <- extract_semver(rustc_ver) 93 | 94 | # extract current version 95 | current_rust_version <- extract_semver(rustc_version) 96 | 97 | # perform check 98 | if (!is.na(msrv)) { 99 | # -1 when current version is later 100 | # 0 when they are the same 101 | # 1 when MSRV is newer than current 102 | is_msrv <- utils::compareVersion(msrv, current_rust_version) 103 | if (is_msrv == 1) { 104 | fmt <- paste0( 105 | "\n------------------ [UNSUPPORTED RUST VERSION]------------------\n", 106 | "- Minimum supported Rust version is %s.\n", 107 | "- Installed Rust version is %s.\n", 108 | "---------------------------------------------------------------" 109 | ) 110 | stop(sprintf(fmt, msrv, current_rust_version)) 111 | } 112 | } 113 | 114 | # print the versions 115 | versions_fmt <- "Using %s\nUsing %s" 116 | message(sprintf(versions_fmt, cargo_version, rustc_version)) 117 | -------------------------------------------------------------------------------- /tests/testthat/_snaps/shiny/app_1/001.json: -------------------------------------------------------------------------------- 1 | { 2 | "output": { 3 | "columns": { 4 | "html": "
\n