×
[PR]上記の広告は3ヶ月以上新規記事投稿のないブログに表示されています。新しい記事を書く事で広告が消えます。
dat <- data.frame(
a1b1 = rnorm(10),
a1b2 = rnorm(10),
a1b3 = rnorm(10, 100, 10),
a1b4 = rnorm(10, 10, 1),
a2b1 = rnorm(10),
a2b2 = rnorm(10),
a2b3 = rnorm(10, 100, 10),
a2b4 = rnorm(10, 10, 1),
a3b1 = rnorm(10),
a3b2 = rnorm(10),
a3b3 = rnorm(10, 100, 10),
a4b4 = rnorm(10, 10, 1)
)
dat
nlva <- 3 # 自分で入力
nlvb <- 4 # 自分で入力
anms <- c("a1", "a2", "a3") # 自分で入力
bnms <- c("b1", "b2", "b3", "b4") # 自分で入力
ncl <- ncol(dat)
clnm <- 1:ncl
clmt <- matrix(clnm, nlvb)
adatlist <- list()
bdatlist <- list()
for (i in 1:nlva) {
x <- dat[clmt[,i]] ; names(x) <- bnms
adatlist[[i]] <- x
}
names(adatlist) <- anms
for (i in 1:nlvb) {
x <- dat[clmt[i,]] ; names(x) <- anms
bdatlist[[i]] <- x
}
names(bdatlist) <- bnms
adatlist
bdatlist
PR
Comment
Trackback
Trackback URL
Comment form