如何在R中以不同的方式复制向量中的字符串?
我有这个向量:如何在R中以不同的方式复制向量中的字符串?,r,repeat,replicate,R,Repeat,Replicate,我有这个向量: Photoperiod <- c("Day","Sunset","Night","Sunrise") Photoperiod关于: rep(rep(c("Day","Sunset","Night","Sunrise"), c(12, 2, 8, 2)), length.out = 168) 另一个选择是使用一个r
Photoperiod <- c("Day","Sunset","Night","Sunrise")
Photoperiod关于:
rep(rep(c("Day","Sunset","Night","Sunrise"), c(12, 2, 8, 2)), length.out = 168)
另一个选择是使用一个rep
和回收技术
x <- character(168)
x[] <- rep(Photoperiod, c(12, 2, 8, 2))
x