Answers for "matrix in r"

1

create matrix in r

matrix(c(3:8), nrow = 2)
#Returns
#>
      [,1] [,2] [,3]
[1,]    3    5    7
[2,]    4    6    8

matrix(c(3:8), ncol = 2)
#Returns
#>
      [,1] [,2] 
[1,]    3    6    
[2,]    4    7    
[3,]    5    8
Posted by: Guest on September-21-2021
3

matrix in r

newMatrix = cbind(c(1,2,3),c(4,5,6))
Posted by: Guest on October-23-2020
0

how to write a 10x10 matrix in rstudio

ranVal= sample(1:10,100,replace =T) #creating 10X10 with random values

M=matrix(ranVal,nrow=10)

print (M)
Posted by: Guest on November-05-2020

Browse Popular Code Answers by Language