-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dpasta() fails with error invalid 'times' value
#140
Comments
Agreed. I think for dates it fails. Here's another reprex. dst_issue = structure(list(id = c("OCEANS_018", "OCEANS_018", "OCEANS_018",
"OCEANS_018", "OCEANS_018", "OCEANS_018", "OCEANS_018", "OCEANS_018",
"OCEANS_018", "OCEANS_018", "OCEANS_018", "OCEANS_018", "OCEANS_018",
"OCEANS_018", "OCEANS_018", "OCEANS_018", "OCEANS_018", "OCEANS_018",
"OCEANS_018", "OCEANS_018", "OCEANS_018", "OCEANS_018", "OCEANS_018",
"OCEANS_018", "OCEANS_018", "OCEANS_018", "OCEANS_018", "OCEANS_018",
"OCEANS_018", "OCEANS_018", "OCEANS_018", "OCEANS_018", "OCEANS_018",
"OCEANS_018", "OCEANS_018", "OCEANS_018", "OCEANS_018", "OCEANS_018",
"OCEANS_018", "OCEANS_018", "OCEANS_018", "OCEANS_018", "OCEANS_018",
"OCEANS_018", "OCEANS_018", "OCEANS_018", "OCEANS_018", "OCEANS_018",
"OCEANS_018", "OCEANS_018", "OCEANS_018", "OCEANS_018", "OCEANS_018",
"OCEANS_018", "OCEANS_018", "OCEANS_018", "OCEANS_018", "OCEANS_018",
"OCEANS_018", "OCEANS_018", "OCEANS_019", "OCEANS_019", "OCEANS_019",
"OCEANS_019", "OCEANS_019", "OCEANS_019", "OCEANS_019", "OCEANS_019",
"OCEANS_019", "OCEANS_019", "OCEANS_019", "OCEANS_019", "OCEANS_019",
"OCEANS_019", "OCEANS_019", "OCEANS_019", "OCEANS_019", "OCEANS_019",
"OCEANS_019", "OCEANS_019", "OCEANS_019", "OCEANS_019", "OCEANS_019",
"OCEANS_019", "OCEANS_019", "OCEANS_019", "OCEANS_019", "OCEANS_019",
"OCEANS_019", "OCEANS_019", "OCEANS_019", "OCEANS_019", "OCEANS_019",
"OCEANS_019", "OCEANS_019", "OCEANS_019", "OCEANS_019", "OCEANS_019",
"OCEANS_019", "OCEANS_019", "OCEANS_019", "OCEANS_019", "OCEANS_019",
"OCEANS_019", "OCEANS_019", "OCEANS_019", "OCEANS_019", "OCEANS_019",
"OCEANS_019", "OCEANS_019", "OCEANS_019", "OCEANS_019", "OCEANS_019",
"OCEANS_019", "OCEANS_019", "OCEANS_019", "OCEANS_019", "OCEANS_019",
"OCEANS_019", "OCEANS_019"), id_followup = c("BL", "BL", "BL",
"BL", "BL", "BL", "BL", "BL", "BL", "BL", "BL", "BL", "BL", "BL",
"BL", "BL", "BL", "BL", "BL", "BL", "BL", "BL", "BL", "BL", "BL",
"BL", "BL", "BL", "BL", "BL", "BL", "BL", "BL", "BL", "BL", "BL",
"BL", "BL", "BL", "BL", "BL", "BL", "BL", "BL", "BL", "BL", "BL",
"BL", "BL", "BL", "BL", "BL", "BL", "BL", "BL", "BL", "BL", "BL",
"BL", "BL", "BL", "BL", "BL", "BL", "BL", "BL", "BL", "BL", "BL",
"BL", "BL", "BL", "BL", "BL", "BL", "BL", "BL", "BL", "BL", "BL",
"BL", "BL", "BL", "BL", "BL", "BL", "BL", "BL", "BL", "BL", "BL",
"BL", "BL", "BL", "BL", "BL", "BL", "BL", "BL", "BL", "BL", "BL",
"BL", "BL", "BL", "BL", "BL", "BL", "BL", "BL", "BL", "BL", "BL",
"BL", "BL", "BL", "BL", "BL", "BL", "BL"), time = structure(c(1710036000,
1710036060, 1710036120, 1710036180, 1710036240, 1710036300, 1710036360,
1710036420, 1710036480, 1710036540, 1710036600, 1710036660, 1710036720,
1710036780, 1710036840, 1710036900, 1710036960, 1710037020, 1710037080,
1710037140, 1710037200, 1710037260, 1710037320, 1710037380, 1710037440,
1710037500, 1710037560, 1710037620, 1710037680, 1710037740, 1710037800,
1710037860, 1710037920, 1710037980, 1710038040, 1710038100, 1710038160,
1710038220, 1710038280, 1710038340, 1710038400, 1710038460, 1710038520,
1710038580, 1710038640, 1710038700, 1710038760, 1710038820, 1710038880,
1710038940, 1710039000, 1710039060, 1710039120, 1710039180, 1710039240,
1710039300, 1710039360, 1710039420, 1710039480, 1710039540, 1710036000,
1710036060, 1710036120, 1710036180, 1710036240, 1710036300, 1710036360,
1710036420, 1710036480, 1710036540, 1710036600, 1710036660, 1710036720,
1710036780, 1710036840, 1710036900, 1710036960, 1710037020, 1710037080,
1710037140, 1710037200, 1710037260, 1710037320, 1710037380, 1710037440,
1710037500, 1710037560, 1710037620, 1710037680, 1710037740, 1710037800,
1710037860, 1710037920, 1710037980, 1710038040, 1710038100, 1710038160,
1710038220, 1710038280, 1710038340, 1710038400, 1710038460, 1710038520,
1710038580, 1710038640, 1710038700, 1710038760, 1710038820, 1710038880,
1710038940, 1710039000, 1710039060, 1710039120, 1710039180, 1710039240,
1710039300, 1710039360, 1710039420, 1710039480, 1710039540), tzone = "GMT", class = c("POSIXct",
"POSIXt")), date = structure(c(19792, 19792, 19792, 19792, 19792,
19792, 19792, 19792, 19792, 19792, 19792, 19792, 19792, 19792,
19792, 19792, 19792, 19792, 19792, 19792, 19792, 19792, 19792,
19792, 19792, 19792, 19792, 19792, 19792, 19792, 19792, 19792,
19792, 19792, 19792, 19792, 19792, 19792, 19792, 19792, 19792,
19792, 19792, 19792, 19792, 19792, 19792, 19792, 19792, 19792,
19792, 19792, 19792, 19792, 19792, 19792, 19792, 19792, 19792,
19792, 19792, 19792, 19792, 19792, 19792, 19792, 19792, 19792,
19792, 19792, 19792, 19792, 19792, 19792, 19792, 19792, 19792,
19792, 19792, 19792, 19792, 19792, 19792, 19792, 19792, 19792,
19792, 19792, 19792, 19792, 19792, 19792, 19792, 19792, 19792,
19792, 19792, 19792, 19792, 19792, 19792, 19792, 19792, 19792,
19792, 19792, 19792, 19792, 19792, 19792, 19792, 19792, 19792,
19792, 19792, 19792, 19792, 19792, 19792, 19792), class = "Date"),
hour = structure(c(7200, 7200, 7200, 7200, 7200, 7200, 7200,
7200, 7200, 7200, 7200, 7200, 7200, 7200, 7200, 7200, 7200,
7200, 7200, 7200, 7200, 7200, 7200, 7200, 7200, 7200, 7200,
7200, 7200, 7200, 7200, 7200, 7200, 7200, 7200, 7200, 7200,
7200, 7200, 7200, 7200, 7200, 7200, 7200, 7200, 7200, 7200,
7200, 7200, 7200, 7200, 7200, 7200, 7200, 7200, 7200, 7200,
7200, 7200, 7200, 7200, 7200, 7200, 7200, 7200, 7200, 7200,
7200, 7200, 7200, 7200, 7200, 7200, 7200, 7200, 7200, 7200,
7200, 7200, 7200, 7200, 7200, 7200, 7200, 7200, 7200, 7200,
7200, 7200, 7200, 7200, 7200, 7200, 7200, 7200, 7200, 7200,
7200, 7200, 7200, 7200, 7200, 7200, 7200, 7200, 7200, 7200,
7200, 7200, 7200, 7200, 7200, 7200, 7200, 7200, 7200, 7200,
7200, 7200, 7200), class = c("hms", "difftime"), units = "secs"),
lat = c(NA_real_, NA_real_, NA_real_, NA_real_, NA_real_,
NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_,
NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_,
NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_,
NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_,
NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_,
NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_,
NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_,
NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_,
NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_,
NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_,
NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_,
NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_,
NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_,
NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_,
NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_,
NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_,
NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_,
NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_,
NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_,
NA_real_), lon = c(NA_real_, NA_real_, NA_real_, NA_real_,
NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_,
NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_,
NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_,
NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_,
NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_,
NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_,
NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_,
NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_,
NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_,
NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_,
NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_,
NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_,
NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_,
NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_,
NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_,
NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_,
NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_,
NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_,
NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_,
NA_real_, NA_real_)), row.names = c(NA, -120L), class = c("tbl_df",
"tbl", "data.frame"))
dst_issue = dplyr::as_tibble(dst_issue)
dst_issue
#> # A tibble: 120 × 7
#> id id_followup time date hour lat lon
#> <chr> <chr> <dttm> <date> <hms> <dbl> <dbl>
#> 1 OCEANS_018 BL 2024-03-10 02:00:00 2024-03-10 7200 secs NA NA
#> 2 OCEANS_018 BL 2024-03-10 02:01:00 2024-03-10 7200 secs NA NA
#> 3 OCEANS_018 BL 2024-03-10 02:02:00 2024-03-10 7200 secs NA NA
#> 4 OCEANS_018 BL 2024-03-10 02:03:00 2024-03-10 7200 secs NA NA
#> 5 OCEANS_018 BL 2024-03-10 02:04:00 2024-03-10 7200 secs NA NA
#> 6 OCEANS_018 BL 2024-03-10 02:05:00 2024-03-10 7200 secs NA NA
#> 7 OCEANS_018 BL 2024-03-10 02:06:00 2024-03-10 7200 secs NA NA
#> 8 OCEANS_018 BL 2024-03-10 02:07:00 2024-03-10 7200 secs NA NA
#> 9 OCEANS_018 BL 2024-03-10 02:08:00 2024-03-10 7200 secs NA NA
#> 10 OCEANS_018 BL 2024-03-10 02:09:00 2024-03-10 7200 secs NA NA
#> # ℹ 110 more rows
library(hms)
dst_issue
#> # A tibble: 120 × 7
#> id id_followup time date hour lat lon
#> <chr> <chr> <dttm> <date> <time> <dbl> <dbl>
#> 1 OCEANS_018 BL 2024-03-10 02:00:00 2024-03-10 02:00 NA NA
#> 2 OCEANS_018 BL 2024-03-10 02:01:00 2024-03-10 02:00 NA NA
#> 3 OCEANS_018 BL 2024-03-10 02:02:00 2024-03-10 02:00 NA NA
#> 4 OCEANS_018 BL 2024-03-10 02:03:00 2024-03-10 02:00 NA NA
#> 5 OCEANS_018 BL 2024-03-10 02:04:00 2024-03-10 02:00 NA NA
#> 6 OCEANS_018 BL 2024-03-10 02:05:00 2024-03-10 02:00 NA NA
#> 7 OCEANS_018 BL 2024-03-10 02:06:00 2024-03-10 02:00 NA NA
#> 8 OCEANS_018 BL 2024-03-10 02:07:00 2024-03-10 02:00 NA NA
#> 9 OCEANS_018 BL 2024-03-10 02:08:00 2024-03-10 02:00 NA NA
#> 10 OCEANS_018 BL 2024-03-10 02:09:00 2024-03-10 02:00 NA NA
#> # ℹ 110 more rows
datapasta::tribble_paste(dst_issue)
#> Error in strrep(" ", char_length - nchar(char_vec)): invalid 'times' value
char_vec = "2024-03-10"
nchar(char_vec)
#> [1] 10
char_type = "Date"
char_length = 10
value = datapasta:::render_type(char_vec, char_type)
value
#> [1] "\"2024-03-10\""
datapasta:::pad_to(value, char_length)
#> Error in strrep(" ", char_length - nchar(char_vec)): invalid 'times' value
strrep(" ", pmax(0, char_length - nchar(char_vec)))
#> [1] "" Created on 2024-10-13 with reprex v2.1.1 Session infosessioninfo::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#> setting value
#> version R version 4.4.0 (2024-04-24)
#> os macOS Sonoma 14.4.1
#> system x86_64, darwin20
#> ui X11
#> language (EN)
#> collate en_US.UTF-8
#> ctype en_US.UTF-8
#> tz America/New_York
#> date 2024-10-13
#> pandoc 3.2 @ /Applications/RStudio.app/Contents/Resources/app/quarto/bin/tools/x86_64/ (via rmarkdown)
#>
#> ─ Packages ───────────────────────────────────────────────────────────────────
#> package * version date (UTC) lib source
#> cli 3.6.3 2024-06-21 [1] CRAN (R 4.4.0)
#> crayon 1.5.3 2024-06-20 [1] CRAN (R 4.4.0)
#> datapasta 3.1.0 2020-01-17 [1] CRAN (R 4.4.0)
#> digest 0.6.37 2024-08-19 [1] CRAN (R 4.4.1)
#> dplyr 1.1.4 2023-11-17 [1] CRAN (R 4.4.0)
#> evaluate 1.0.0 2024-09-17 [1] CRAN (R 4.4.1)
#> fansi 1.0.6 2023-12-08 [1] CRAN (R 4.4.0)
#> fastmap 1.2.0 2024-05-15 [1] CRAN (R 4.4.0)
#> fs 1.6.4 2024-04-25 [1] CRAN (R 4.4.0)
#> generics 0.1.3 2022-07-05 [1] CRAN (R 4.4.0)
#> glue 1.7.0 2024-01-09 [1] CRAN (R 4.4.0)
#> hms * 1.1.3 2023-03-21 [1] CRAN (R 4.4.0)
#> htmltools 0.5.8.1 2024-04-04 [1] CRAN (R 4.4.0)
#> knitr 1.48 2024-07-07 [1] CRAN (R 4.4.0)
#> lifecycle 1.0.4 2023-11-07 [1] CRAN (R 4.4.0)
#> magrittr 2.0.3 2022-03-30 [1] CRAN (R 4.4.0)
#> pillar 1.9.0 2023-03-22 [1] CRAN (R 4.4.0)
#> pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 4.4.0)
#> R6 2.5.1 2021-08-19 [1] CRAN (R 4.4.0)
#> reprex 2.1.1 2024-07-06 [1] CRAN (R 4.4.0)
#> rlang 1.1.4 2024-06-04 [1] CRAN (R 4.4.0)
#> rmarkdown 2.28 2024-08-17 [1] CRAN (R 4.4.1)
#> rstudioapi 0.16.0 2024-03-24 [1] CRAN (R 4.4.0)
#> sessioninfo 1.2.2 2021-12-06 [1] CRAN (R 4.4.0)
#> tibble 3.2.1 2023-03-20 [1] CRAN (R 4.4.0)
#> tidyselect 1.2.1 2024-03-11 [1] CRAN (R 4.4.0)
#> utf8 1.2.4 2023-10-22 [1] CRAN (R 4.4.0)
#> vctrs 0.6.5 2023-12-01 [1] CRAN (R 4.4.0)
#> withr 3.0.0 2024-01-16 [1] CRAN (R 4.4.0)
#> xfun 0.47 2024-08-17 [1] CRAN (R 4.4.1)
#> yaml 2.3.10 2024-07-26 [1] CRAN (R 4.4.0)
#>
#> [1] /Library/Frameworks/R.framework/Versions/4.4-x86_64/Resources/library
#>
#> ────────────────────────────────────────────────────────────────────────────── |
muschellij2
added a commit
to muschellij2/datapasta
that referenced
this issue
Oct 13, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I read in data from StackOverflow, hence the
read_table()
command. The resultingdf
looks innocuous but for some reasondpasta()
cannot handle it:Created on 2023-11-10 with reprex v2.0.2
The text was updated successfully, but these errors were encountered: