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

tfd/tfb constructor edge cases #107

Open
fabian-s opened this issue Aug 1, 2024 · 1 comment
Open

tfd/tfb constructor edge cases #107

fabian-s opened this issue Aug 1, 2024 · 1 comment

Comments

@fabian-s
Copy link
Contributor

fabian-s commented Aug 1, 2024

from #104

calling tf::tfd() with no args I wouldn't throw a message and just return the empty vector like it already does or just throw an error. For non-numeric I would just throw an error since numeric is required for the vectors and the NULL case I would probably also throw an error, but package handle this differently, see for reference:

# blob package
blob::blob()
#> <blob[0]>
blob::blob(NULL)
#> <blob[1]>
#> [1] <NA>
blob::blob(NA)
#> Error: `x` must be a list of raw vectors

# pillar package
pillar::num()
#> Error in pillar::num(): argument "x" is missing, with no default
pillar::num(NULL)
#> Error in pillar::num(NULL): is.numeric(x) is not TRUE
pillar::num("")
#> Error in pillar::num(""): is.numeric(x) is not TRUE
pillar::num(NA)
#> Error in pillar::num(NA): is.numeric(x) is not TRUE

# haven package
haven::labelled()
#> <labelled<double>[0]>
haven::labelled(NULL)
#> Error in `vec_data()`:
#> ! `x` must be a vector, not `NULL`.
haven::labelled(NA)
#> Error in `new_labelled()`:
#> ! `x` must be a numeric or a character vector.

# hms package
hms::hms()
#> hms()
hms::hms(NULL)
#> hms()
hms::hms("")
#> Error: All arguments must be numeric or NA
hms::hms(NA)
#> NA
``
@fabian-s
Copy link
Contributor Author

another edge case: tfb will warn about lack of fit/preserved variance for constant input functions (= zero variance)!

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

No branches or pull requests

1 participant