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

Ordered factors not supported in xray::distributions() #9

Closed
bgrich opened this issue Dec 15, 2017 · 2 comments
Closed

Ordered factors not supported in xray::distributions() #9

bgrich opened this issue Dec 15, 2017 · 2 comments

Comments

@bgrich
Copy link

bgrich commented Dec 15, 2017

When an ordered factor is included as a variable in xray::distributions() it returns the following warning:

In eval(xpr, envir = envir) : Ignoring variable ord_dat: Unsupported type for visualization.

df_1 <- data.frame(numeric_dat = c(1, 2, 2), 
                   ord_dat = factor(c("a", "b", "b"), levels = c("a", "b"), ordered = TRUE))
xray::distributions(df_1)

This appears to be because the ordered factor has been assigned the class "Unknown" by xray::anomalies() when it is called within xray::distributions(). When checking the class of an ordered factor, it returns a vector of length 2.

class(df_1$ord_dat)
[1] "ordered" "factor"

Since xray::anomalies() only looks at the first element of the class of the variable, it classifies the ordered factor as "Unknown".

xray::anomalies()
 Variable q qNA pNA qZero pZero qBlank pBlank qInf pInf qDistinct    type anomalous_percent
1 numeric_dat 3   0   -     0     -      0      -    0    -         2 Numeric                 -
2     ord_dat 3   0   -     0     -      0      -    0    -         2 Unknown                 -

Thanks for the work you've put into this package! I am quite enjoying it and look forward to using it more often.

@sicarul
Copy link
Owner

sicarul commented Dec 23, 2017

Sorry, had never heard of the Ordered factor, i'll add it in. I prefer to add new types one by one to avoid plotting wrongly

@sicarul
Copy link
Owner

sicarul commented Dec 23, 2017

Fixed in 945e9c6 - Thanks for reporting with reproducible examples!

@sicarul sicarul closed this as completed Dec 23, 2017
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