Not sure it would be any smarter, but what about:
a <- c(5.78, 5.79,5.86)
n <- 10
matrix(rep(a,each=n), nrow=n)
That way, it would be easy to build a function with 'a' and 'n' as
arguments.
HTH,
Ivan
--
Ivan Calandra, PhD
Scientific Mediator
University of Reims Champagne-Ardenne
GEGENAA - EA
Dear r-users,
I have a set of numbers that I would like to repeat for let say 10 times
and each number is repeated by vertically.
I tried this:
a <- c(5.78, 5.79,5.86)
tran_a <- t(matrix(rep.int(a, 10),3))
dput(tran_a)
structure(c(5.78, 5.78, 5.78, 5.78, 5.78, 5.78, 5.78, 5.78, 5.78,
5.78, 5.7
2 matches
Mail list logo