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

bug in function parser when results are NaN #78

Open
famuvie opened this issue Feb 10, 2017 · 1 comment
Open

bug in function parser when results are NaN #78

famuvie opened this issue Feb 10, 2017 · 1 comment

Comments

@famuvie
Copy link
Owner

famuvie commented Feb 10, 2017

Within parse_functions(), which is defined within parse_results() there is this function parser:

    parse_function <- function(x) {
      pick_nmbr <- function(x) {
        conv <- suppressWarnings(as.numeric(x))
        stopifnot(sum(idx <- !is.na(conv)) == 1)
        return(conv[idx])
      }
      structure(sapply(strsplit(x, ' '), pick_nmbr),
                names = c('mean', 'sample mean', 'sample sd'))
    }

Which usually takes character vectors of the form:

c("  Mean:   0.28419    ", "  Sample Mean:   0.28229    ", "  Sample SD:   0.10392    ")

However, when any one of the numbers is NaN, the defensive condition is fired.

I have seen this happening whenever some of the relevant variances are small, leading to numerical issues.

@famuvie
Copy link
Owner Author

famuvie commented Feb 10, 2017

  • Make a generic parser (or borrow one) for inputs of the form: label: value, in multiple lines that does not rely on value being a number

  • issue a condition (warning, error?) about the numerical issues

  • call this function while capturing conditions, and issue an informative warning

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