Skip to content

Error in rep in matrix - Windows 8- R 3.2.1

2 messages · Nikita Dinger, David Winsemius

#
y <- matrix(rep(10,4),2,2)
[,1] [,2]
[1,]   10   10
[2,]   10   10



I expected an output of
[,1] [,2]
[1,]   10   4
[2,]   10   4



Thanks and Regards.
#
On Aug 8, 2015, at 1:44 PM, Nikita Dinger wrote:

            
When you get something you don't expect, you should start by examining the arguments. Type this at your console:

rep(10,4)

It should then be obvious that you need to read the help page for `rep`.