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

va conversion from ETDRS fails with mixed vectors #29

Closed
tjebo opened this issue Mar 8, 2021 · 1 comment
Closed

va conversion from ETDRS fails with mixed vectors #29

tjebo opened this issue Mar 8, 2021 · 1 comment

Comments

@tjebo
Copy link
Owner

tjebo commented Mar 8, 2021

Seems to happen only with mixed vectors of logmar / ETDRS. Current workaround use sapply

library(eye)

x <-  c(0.2, 0.1, 75)
y <-  c("20/60", "6/5", 75)

va_mixed(x, to = "logmar")
#> [1] 0.2 0.1  NA
va_mixed(y, to = "logmar")
#> [1]  0.5 -0.1  0.2

to_logmar(x, from = "etdrs")
#> This doesn't look like etdrs. Could be logmar, snellendec. Picking logmar
#> 1x NA introduced for: 75
#> [1] 0.2 0.1  NA

# workaround for the time being:
sapply(x, to_logmar)
#> From logmar. Could be logmar, snellendec
#> From logmar. Could be logmar, snellendec
#> From etdrs
#> [1] 0.2 0.1 0.2

Created on 2021-03-08 by the reprex package (v1.0.0)

@tjebo
Copy link
Owner Author

tjebo commented Mar 8, 2021

library(eye)
x <-  c(0.2, 0.1, 75)
y <-  c("20/60", "6/5", 75)
va_mixed(x, to = "logmar")
#> [1] 0.2 0.1 0.2
va_mixed(y, to = "logmar")
#> [1]  0.5 -0.1  0.2
to_logmar(x, from = "etdrs")
#> 2x NA introduced for: 0.2, 0.1
#> [1]  NA  NA 0.2
to_logmar(x, from = "logmar")
#> 1x NA introduced for: 75
#> [1] 0.2 0.1  NA

Created on 2021-03-08 by the reprex package (v1.0.0)

tjebo added a commit that referenced this issue Mar 8, 2021
@tjebo tjebo closed this as completed Mar 8, 2021
tjebo added a commit that referenced this issue Mar 8, 2021
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