在R语言中可以使用matrix()函数来创建矩阵,其语法格式如下:
matrix(data=NA,nrow=1,ncol=1,byrow=FALSE,dimnames=NULL)。
rep函数是R语言中重复操作的函数。
R语言吗?rep replicates the values in x. It is a generic function, and the (internal) default method is described here.repx复制的值。它是一个通用的功能,这里所描述的(内部)的默认方法。
rep.int is a faster simplified version for the most common case.
rep.int是最常见的情况更快的简化版本。
a1 <- seq(0, 3, by = 1)a2 <- rep(a1, each = 4)
b1 <- seq(1, 4, by = 1)
b2 <- rep(b1, 4)
x <- a2 + b2
x就是你要的。
觉得对请采纳我的答案。