Edmond Ng
2003-Mar-24 19:40 UTC
[R] how to show a section of a matrix neatly (or row by row) that satisfies some condition
Hi all, I want to show the rows of a matrix (100x3) of which some of its elements satisfy a certain condition. In particular, how can I display the 2 rows of my matrix one after the other and not all all elements of column 1 first, then column 2 and so on. See the following.> finest[finest[,1] > 10^3][1] 4.960632e+13 3.612619e+04 7.668204e+12 1.001911e+04 8.886153e-01 [6] 6.130777e-01> dim(finest)[1] 100 3 Many thanks in advance. Edmond
Spencer Graves
2003-Mar-24 20:02 UTC
[R] how to show a section of a matrix neatly (or row by row) that satisfies some condition
I think you need a comma after "10^3", e.g.,: tst <- array(1:9, dim=c(3,3)) tst[tst[,1]>1,] Spencer Graves Edmond Ng wrote:> Hi all, > > I want to show the rows of a matrix (100x3) of which some of its elements satisfy a certain condition. In particular, how can I display the 2 rows of my matrix one after the > other and not all all elements of column 1 first, then column 2 and so on. See the following. > > >>finest[finest[,1] > 10^3] > > [1] 4.960632e+13 3.612619e+04 7.668204e+12 1.001911e+04 8.886153e-01 > [6] 6.130777e-01 > > >>dim(finest) > > [1] 100 3 > > > Many thanks in advance. > > Edmond > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Seemingly Similar Threads
- how to show a section of a matrix neatly (or row by row ) that satisfies some condition
- get current window (device) size
- reading in tab delimited data in a loop
- [Bug 28107] New: [NV31]
- For Your Own Info: Rails 2.3.2 is incompatible with Cucumber (0.8.5), Capybara (0.3.9) and Selenium-webdriver (0.0.17)