You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a correlation matrix with a lot of missing values. This causes the backend rearranging to fail when it tries to change the order. However, there's direct way of preventing the reordering attempt, which I would like to do. Using method = "Identity" still checks if the object is valid for seriation.
Reproducible example
library(corrr)
x<-matrix(1:20, nrow=5)
x[seq(1, 20, 2)] <-NAx<- as.data.frame(x)
x<- correlate(x)
#> Correlation computed with#> • Method: 'pearson'#> • Missing treated using: 'pairwise.complete.obs'x#> # A tibble: 4 × 5#> term V1 V2 V3 V4#> <chr> <dbl> <dbl> <dbl> <dbl>#> 1 V1 NA NA 1 NA#> 2 V2 NA NA NA 1#> 3 V3 1 NA NA NA#> 4 V4 NA 1 NA NA
try(autoplot(x))
#> Error in svd(x, nu = 0, nv = k) : infinite or missing values in 'x'
try(autoplot(x, method="Identity"))
#> Error in seriate.dist(dist(m), method = method) : #> NAs not allowed in distance matrix x!
try(rearrange(x))
#> Error in svd(x, nu = 0, nv = k) : infinite or missing values in 'x'
try(rearrange(x, method="Identity"))
#> Error in seriate.dist(dist(m), method = method) : #> NAs not allowed in distance matrix x!
class(x) <- c("foo", class(x))
rearrange.foo<-function(x, method=NA, absolute=TRUE) {
if (is.na(method)) {
return(x)
}
NextMethod()
}
try(rearrange(x, method=NA))
#> # A tibble: 4 × 5#> term V1 V2 V3 V4#> <chr> <dbl> <dbl> <dbl> <dbl>#> 1 V1 NA NA 1 NA#> 2 V2 NA NA NA 1#> 3 V3 1 NA NA NA#> 4 V4 NA 1 NA NA
try(autoplot(x, method=NA))
The problem
I have a correlation matrix with a lot of missing values. This causes the backend rearranging to fail when it tries to change the order. However, there's direct way of preventing the reordering attempt, which I would like to do. Using
method = "Identity"
still checks if the object is valid forseriation
.Reproducible example
Created on 2022-12-13 with reprex v2.0.2
The text was updated successfully, but these errors were encountered: