稀疏矩阵——创建和可视化

m1 <- matrix(200+100*rnorm(750),nrow = 25,byrow = TRUE)


m2 <- matrix(sample(c(0,1),750,replace = TRUE,prob=c(0.95,0.05)),nrow = 25,byrow = TRUE)


m <- m1*m2


ss <- which(m !=0, arr.ind=TRUE)


plot(ss,pch = 22)

你可能感兴趣的:(稀疏矩阵——创建和可视化)