Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Add silent parameter to get_stats19 #149

Merged
merged 1 commit into from
Jan 29, 2020
Merged

Conversation

agila5
Copy link
Collaborator

@agila5 agila5 commented Jan 29, 2020

As we discussed in #140, I added a silent parameter to get_stats19. For example:

res <- stats19::get_stats19(2018)
#> Files identified: dftRoadSafetyData_Accidents_2018.csv
#>    http://data.dft.gov.uk.s3.amazonaws.com/road-accidents-safety-data/dftRoadSafetyData_Accidents_2018.csv
#> Attempt downloading from:
#> Data saved at /tmp/Rtmp9K14gT/dftRoadSafetyData_Accidents_2018.csv
#> Reading in:
#> /tmp/Rtmp9K14gT/dftRoadSafetyData_Accidents_2018.csv
#> date and time columns present, creating formatted datetime column

Created on 2020-01-29 by the reprex package (v0.3.0)

and

res <- stats19::get_stats19(2018, silent = TRUE)
#> date and time columns present, creating formatted datetime column

Created on 2020-01-29 by the reprex package (v0.3.0)

I choose not to silent in any case the new date/time message but it's really easy to add that.

@codecov-io
Copy link

codecov-io commented Jan 29, 2020

Codecov Report

Merging #149 into master will increase coverage by 0.41%.
The diff coverage is 94.73%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #149      +/-   ##
==========================================
+ Coverage    69.6%   70.02%   +0.41%     
==========================================
  Files           7        7              
  Lines         408      417       +9     
==========================================
+ Hits          284      292       +8     
- Misses        124      125       +1
Impacted Files Coverage Δ
R/get.R 97.56% <100%> (+0.12%) ⬆️
R/read.R 98.48% <100%> (+0.02%) ⬆️
R/dl.R 80.85% <91.66%> (+0.36%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 15f1c4e...f01d8a2. Read the comment docs.

@@ -74,7 +82,9 @@ dl_stats19 = function(year = NULL,
}
data_already_exists = file.exists(destfile)
if(data_already_exists) {
message("Data already exists in data_dir, not downloading")
if (isFALSE(silent)) {
Copy link
Member

Choose a reason for hiding this comment

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

Interesting, only just realised there is an 'isFALSE()` function in base R, more elegant that !silent!

@Robinlovelace Robinlovelace merged commit f58b527 into master Jan 29, 2020
@Robinlovelace Robinlovelace deleted the add_silent_parameter branch January 29, 2020 08:26
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.

3 participants