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

Feature Request: Allow assignment of NA to Errors #30

Closed
billdenney opened this issue Aug 28, 2018 · 1 comment
Closed

Feature Request: Allow assignment of NA to Errors #30

billdenney opened this issue Aug 28, 2018 · 1 comment

Comments

@billdenney
Copy link

I need to represent a change from baseline and change from placebo in the same table. Generally, I'd like to see values that look like the following:

> change_from_baseline_change_from_placebo <- set_errors(1:3, 1:3)
> change_from_baseline_change_from_placebo[1] <- NA
Error in UseMethod("errors") : 
  no applicable method for 'errors' applied to an object of class "logical"
> change_from_baseline_change_from_placebo[1] <- set_errors(x=NA_real_, value=NA)
> change_from_baseline_change_from_placebo
Errors: NA  2  3
[1] NA  2  3
> 

It would be handy to have a function for errors.logical like:

errors.logical <- function(x) {
  if (all(is.na(x))) {
    set_errors(as.real(x), NA)
  } else {
    stop("logical vectors must be `NA` to be coerced into errors")
  }
}
@Enchufa2
Copy link
Member

Thanks!

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

2 participants