Home > OS >  How do I extract elements of a martix from a list in r?
How do I extract elements of a martix from a list in r?

Time:06-01

I have a list composed by a vector and a matrix. I want to extract the element (3,2) of the matrix from the list. How do I do that?

mymatr <- matrix(1:10 , nrow = 5) 
myvecto <- 1:5
mylist <- list(myvecto, mymatr)

CodePudding user response:

Code:

 > mylist[[2]][3,2]

Output:

8
  • Related