Clark Johnston wrote:
Is there a way to create a new matrix from and existing matrix with

A
          [,1]     [,2]
[1,]      1        13
[2.] 2 18 [3,] 3 14
[4,]      4        20

if(A[,2] > 15)
B [,1] [,2] [1,] 2 18
[2,]   4      20



It's easiest to get help if you give your objects as the output from ?dput.

This is just simple indexing:

B <- A[A[, 2] > 15, ]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to