Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Fix 235 #245

Merged
merged 7 commits into from
Jul 29, 2024
Merged

Fix 235 #245

merged 7 commits into from
Jul 29, 2024

Conversation

layik
Copy link
Member

@layik layik commented Jul 27, 2024

  • Change variable csv for only few variables setting them to integer classes
  • Add few lines of code to feed readr::read_csv with stats19_variables$type classes on read
  • Prevent format function changing column types of the tibble/df's read in

Checks?
Does this work with all types of objects supported by stats19?

closes #235

@layik layik requested a review from Robinlovelace July 27, 2024 20:08
@layik layik marked this pull request as draft July 27, 2024 20:12
@layik layik removed the request for review from Robinlovelace July 27, 2024 20:12
@layik
Copy link
Member Author

layik commented Jul 27, 2024

ToDo:

  • make Windows happy with vignettes as above
  • Address Update format.R #220 where if age_of_casualty is -1 or -3 then it should not be converted to "Data out of range" like text. Perhaps part of Update format.R #220 should come here or the two should be combined. Change of plan: leave Update format.R #220 out and for now introduce NAs where coded values are amongst integer values.

I believe that is all needed to press "Ready for review"

@Robinlovelace
Copy link
Member

Looking really good. Many thanks Layik 🙏

@layik layik mentioned this pull request Jul 28, 2024
@layik
Copy link
Member Author

layik commented Jul 29, 2024

On a Win instance the issue seems to be at a simple get_stats19 call, Windows complains about invalid parameter type which makes no sense.

Any help would be appreciated as the CI gives nothing to work with.
EDIT:
Windows R does not like

9. readr::cols(!!!col_types)

Quitting from lines 131-132 [dl2022-read] (stats19.Rmd)
Execution halted

Session

sessionInfo()
#> R version 4.4.1 (2024-06-14 ucrt)
#> Platform: x86_64-w64-mingw32/x64
#> Running under: Windows 10 x64 (build 19045)
#> 
#> Matrix products: default
#> 
#> 
#> locale:
#> [1] LC_COLLATE=English_United Kingdom.utf8 
#> [2] LC_CTYPE=English_United Kingdom.utf8   
#> [3] LC_MONETARY=English_United Kingdom.utf8
#> [4] LC_NUMERIC=C                           
#> [5] LC_TIME=English_United Kingdom.utf8    
#> 
#> time zone: Europe/London
#> tzcode source: internal
#> 
#> attached base packages:
#> [1] stats     graphics  grDevices utils     datasets  methods   base     
#> 
#> loaded via a namespace (and not attached):
#>  [1] digest_0.6.36     fastmap_1.2.0     xfun_0.46         glue_1.7.0       
#>  [5] knitr_1.48        htmltools_0.5.8.1 rmarkdown_2.27    lifecycle_1.0.4  
#>  [9] cli_3.6.3         reprex_2.1.1      withr_3.0.0       compiler_4.4.1   
#> [13] rstudioapi_0.16.0 tools_4.4.1       evaluate_0.24.0   yaml_2.3.9       
#> [17] rlang_1.1.4       fs_1.6.4

Created on 2024-07-29 with reprex v2.1.1

@layik layik marked this pull request as ready for review July 29, 2024 08:27
@layik layik requested a review from Robinlovelace July 29, 2024 08:28
Copy link
Member

@Robinlovelace Robinlovelace left a comment

Choose a reason for hiding this comment

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

Minor suggestion in the review, let's get this merged!

@@ -43,7 +43,7 @@ Casualty,accident_index,unique value for each accident. The accident_index combi
Casualty,accident_reference,"In year id used by the police to reference a collision. It is not unique outside of the year, use accident_index for linking to other years",accident_reference,character
Casualty,accident_year,NA,accident_year,numeric
Casualty,age_band_of_casualty,NA,age_band_of_casualty,character
Casualty,age_of_casualty,NA,age_of_casualty,character
Casualty,age_of_casualty,NA,age_of_casualty,numeric
Copy link
Member

Choose a reason for hiding this comment

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

👍

R/read.R Outdated Show resolved Hide resolved
@layik layik merged commit 9db2235 into master Jul 29, 2024
6 checks passed
@layik layik deleted the fix-235 branch July 29, 2024 16:42
@Robinlovelace
Copy link
Member

Awesome, thank you Layik!

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

Successfully merging this pull request may close these issues.

format_vehicle and format_casualty
2 participants