Open mpaya opened 9 months ago
It seems like something similar is happening with NaN values breaking bc4Squares:
> bc4Squares(bc, idents = "bc_clusters_res.0.2", lvl = "4")
Error in quantile.default(as.numeric(res$residuals.mean), prob = seq(from = 0, :
missing values and NaN's not allowed if 'na.rm' is FALSE
In line 950 of Visualization.R, na.rm =TRUE
, so not sure how to fix this one. Manually plugging this line seems to work fine:
> ranks<- as.data.frame(bc@ranks)
> quantile(as.numeric(ranks$bc_clusters_res.0.2.residuals.mean.0), na.rm = TRUE,
prob = seq(from = 0, to = 1, length = 11))
0% 10% 20% 30% 40% 50% 60% 70% 80% 90% 100%
-5.000 -1.151 -0.660 -0.383 -0.210 -0.095 0.050 0.233 0.452 0.904 9.850
> quantile(as.numeric(ranks$bc_clusters_res.0.2.residuals.mean.1), na.rm = TRUE,
prob = seq(from = 0, to = 1, length = 11))
0% 10% 20% 30% 40% 50% 60% 70% 80% 90% 100%
-4.390 -1.886 -1.176 -0.750 -0.432 -0.070 0.310 0.620 1.102 1.720 4.590
> quantile(as.numeric(ranks$bc_clusters_res.0.2.residuals.mean.2), na.rm = TRUE,
prob = seq(from = 0, to = 1, length = 11))
0% 10% 20% 30% 40% 50% 60% 70% 80% 90% 100%
-6.390 -2.576 -1.940 -1.352 -0.874 -0.390 0.080 0.640 1.740 2.302 6.460
> quantile(as.numeric(ranks$bc_clusters_res.0.2.residuals.mean.3), na.rm = TRUE,
prob = seq(from = 0, to = 1, length = 11))
0% 10% 20% 30% 40% 50% 60% 70% 80% 90% 100%
-2.230 -0.901 -0.632 -0.410 -0.230 -0.050 0.090 0.263 0.492 0.790 2.500
> quantile(as.numeric(ranks$bc_clusters_res.0.2.residuals.mean.4), na.rm = TRUE,
prob = seq(from = 0, to = 1, length = 11))
0% 10% 20% 30% 40% 50% 60% 70% 80% 90%
-24.890 -3.524 -2.100 -0.956 0.044 0.890 1.600 2.420 3.394 5.110
100%
13.380
When computing the step of
bcRanks()
to obtain the ranked table, all mean values were NA. In script Ranks.R, line 148, themean()
function usesna.omit = TRUE
instead ofna.rm = TRUE
as in following statistical functions. With this modification, the issue is solved.