ScotGovAnalysis / opendatascot

An R package to pull data from statistics.gov.scot into R
https://scotgovanalysis.github.io/opendatascot/
MIT License
47 stars 6 forks source link

ods_dataset returns error with for arguments used in testing #93

Closed konradzdeb closed 3 years ago

konradzdeb commented 4 years ago

So this line:

ods_dataset(dataset = "average-household-size", geography = "la")

returns the following error:

Error in ods_error_message(warn, dataset) : An unknown error has occurred. The original error message was: Error message: simpleWarning in rep(as.integer(len), length = length(str)): partial argument match of 'length' to 'length.out'.

I reckon this used to work as it's used in tests: https://github.com/DataScienceScotland/opendatascot/blob/d33f065d3ad730648f12947ee26a9864eba9c3c2/tests/testthat/test_ods_dataset.R#L3-L6

Solution :)

The problem is with handling warnings, with those options

options(warnPartialMatchAttr = TRUE,
        warnPartialMatchDollar = TRUE,
        warnPartialMatchArgs = TRUE)

the code will work with no errors. I reckon we could temporarily modify those options to pass the tests; however, likely warnings shouldn't translate to errors and break the code, plus I'm not sure what's the best practice for modifying options for the purpose of package testing.

GordonBryden commented 3 years ago

ods_dataset(dataset = "average-household-size", geography = "la") seems to be working, so I'll be mark this as closed for now. I'm working on the testthat tests at the moment to get a good set.