Save results - type: Output
Posted: Mon Jul 17, 2023 12:47 pm
Dear jamovi developers,
I'm trying to save results from two different functions: 1. results from a PCA 2. results from clustering based on the dimensions of the previous PCA.
In the first case, this code works perfectly well:
for (i in 1:(nFactors)) {
scores <- as.numeric(self$PCAResult$ind$coord[, i])
self$results$newvar$setValues(index=i, scores)
}
self$results$newvar$setRowNums(rownames(self$data))
in the sense that each time I change the input of the PCA, the results of the PCA I want to save are also changing.
In the second case:
I am running the PCA before running the clustering function (HCPC):
res <- FactoMineR::HCPC(self$PCAResult,nb.clust=self$options$nbclust,graph=F)
scores <- as.factor(res$data.clust$clust[])
self$results$newvar2$setValues(index=1, scores)
When I change the number of clusters (nbclust) the results are not changing...I have to uncheck my save box in the interface and to check it again to make them change.
Any ideas?
Thanks a lot for your help.
Sébastien
I'm trying to save results from two different functions: 1. results from a PCA 2. results from clustering based on the dimensions of the previous PCA.
In the first case, this code works perfectly well:
for (i in 1:(nFactors)) {
scores <- as.numeric(self$PCAResult$ind$coord[, i])
self$results$newvar$setValues(index=i, scores)
}
self$results$newvar$setRowNums(rownames(self$data))
in the sense that each time I change the input of the PCA, the results of the PCA I want to save are also changing.
In the second case:
I am running the PCA before running the clustering function (HCPC):
res <- FactoMineR::HCPC(self$PCAResult,nb.clust=self$options$nbclust,graph=F)
scores <- as.factor(res$data.clust$clust[])
self$results$newvar2$setValues(index=1, scores)
When I change the number of clusters (nbclust) the results are not changing...I have to uncheck my save box in the interface and to check it again to make them change.
Any ideas?
Thanks a lot for your help.
Sébastien