ggobi / ggally

R package that extends ggplot2
http://ggobi.github.io/ggally/
588 stars 118 forks source link

`order = "anyClass"` argument of `ggparcoord()` function doesn't work when the dataset has missing values #497

Open ShanikaLW opened 6 months ago

ShanikaLW commented 6 months ago

If I set order = "anyClass in the ggparcoord() function when the dataset has missing values, the function doesn't work. Below is a MWE.

library(palmerpenguins)
#> Warning: package 'palmerpenguins' was built under R version 4.3.3
library(GGally)
#> Warning: package 'GGally' was built under R version 4.3.3
#> Loading required package: ggplot2
#> Warning: package 'ggplot2' was built under R version 4.3.3
#> Registered S3 method overwritten by 'GGally':
#>   method from   
#>   +.gg   ggplot2

penguins %>% 
  ggparcoord(columns = 3:4, groupColumn = "species", order = "anyClass")
#> Error in model.frame.default(formula = x ~ as.factor(classVar == class.names[i]), : variable lengths differ (found for 'as.factor(classVar == class.names[i])')

Created on 2024-04-22 with reprex v2.1.0 `

It is inherited from the singleClassOrder() function. It has two arguments, classVar, and axisVars. Indices corresponding to classVar are removed, however they are not removed from axisVars.