X <- matrix(c(2.8, 5.3, 4.9, 7.4,
2.3, 5.7, 4.3, 7.2,
2.5, 5.1, 4.4, 7.6), nrow = 3, byrow = TRUE)
W <- matrix(c(0.8, 1.0, 0.3, 0.4,
0.3, 0.5, 0.9, 0.5,
1.0, 0.6, 0, 0.7), nrow = 3, byrow = TRUE)
rownames(X) <- rownames(W) <- c("A", "B", "C")
colnames(X) <- colnames(W) <- c("V1", "V2", "V3", "V4")
X
W
out <- unpack(X, W)
cbind(out$U, out$v)
# For more examples, we refer to the vignette:
if (FALSE) {
vignette("cellwise_weights_examples")
}
Run the code above in your browser using DataLab