Let's consider the data set iris.
>iris
Sepal.Length Sepal.Width Petal.Length Petal.Width Species
1 5.1 3.5 1.4 0.2 setosa
2 4.9 3.0 1.4 0.2 setosa
3 4.7 3.2 1.3 0.2 setosa
How can we replicate each of the COLUMNS of this data set 12 times?
您可以使用rep
和each
参数复制列。
iris[rep(1:ncol(iris), each = 12)]
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.