在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
1、方式1 test <- matrix(1:12, byrow = T, nrow = 3, ncol = 4) test c1 <- rep(1:nrow(test), times = ncol(test)) c2 <- rep(1:ncol(test), each = nrow(test)) c3 <- unlist(as.data.frame(test)) result <- data.frame(c1, c2, c3) result
2、方式2 test <- matrix(1:12, byrow = T, nrow = 3, ncol = 4) test c1 <- rep(1:nrow(test), each = ncol(test)) c2 <- rep(1:ncol(test), times = nrow(test)) c3 = unlist(as.data.frame(t(test))) result <- data.frame(c1, c2, c3) result
|
请发表评论