简体   繁体   中英

R: Data layout of 2^4 Factorial Design

I can at most read the data of a 3-way factorial design in R. But when the number of factors is more than 3, i can't read the data in R.

 #2^3 design 
 trt=c("000","100","010","110","001","101","011","111")
 m=array(trt,dim=c(2,2,2))
 m

How can i read the data of 2^4 Factorial Design in R ?

Of course it depends how you will proceed with your data afterwards, but from my point of view a simple 2 dimensional data.frame should be very convenient to process afterwards plus you can generate the factorial designs rather easily:

expand.grid(a = 0:1, b = 0:1, c = 0:1, d = 0:1)
#    a b c d
# 1  0 0 0 0
# 2  1 0 0 0
# 3  0 1 0 0
# 4  1 1 0 0
# 5  0 0 1 0
# 6  1 0 1 0
# 7  0 1 1 0
# 8  1 1 1 0
# 9  0 0 0 1
# 10 1 0 0 1
# 11 0 1 0 1
# 12 1 1 0 1
# 13 0 0 1 1
# 14 1 0 1 1
# 15 0 1 1 1
# 16 1 1 1 1

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM