split up a matrix in matrices by value of column nodes in R -


i have matrix in r:

          [,1]        [,2]        [,3]         [,4]            [,5]    19992    -33.54971    23.35746    0.0000000    2.107680e+01    19980219 19993    -33.54203    23.40079    0.0000000    2.107696e+01    19980219 19994    -33.53453    23.44445    0.0000000    2.107713e+01    19980219 19995    -33.52719    23.48840    0.0000000    2.107730e+01    19980219 19996    -33.51965    23.53200    0.0000000    2.107746e+01    19980219 19997    -33.51183    23.57565    0.0000000    2.107763e+01    19980219 19998    -33.50446    23.61958    0.0000000    2.107780e+01    19980219 19999    -33.49678    23.66313    0.0000000    2.107796e+01    19980219  

its lot bigger (2.000.000 rows) think example question.

i want extract rows have value between e.g. -33.52... , -33.55... in first column , create new matrix of these extracted rows.

the output matrix example:

19992    -33.54971    23.35746    0.0000000    2.107680e+01    19980219 19993    -33.54203    23.40079    0.0000000    2.107696e+01    19980219 19994    -33.53453    23.44445    0.0000000    2.107713e+01    19980219 19995    -33.52719    23.48840    0.0000000    2.107730e+01    19980219 

some tips great!

using data, can this

txt <-  " -33.54971    23.35746    0.0000000    2.107680e+01    19980219  -33.54203    23.40079    0.0000000    2.107696e+01    19980219  -33.53453    23.44445    0.0000000    2.107713e+01    19980219  -33.52719    23.48840    0.0000000    2.107730e+01    19980219  -33.51965    23.53200    0.0000000    2.107746e+01    19980219  -33.51183    23.57565    0.0000000    2.107763e+01    19980219  -33.50446    23.61958    0.0000000    2.107780e+01    19980219  -33.49678    23.66313    0.0000000    2.107796e+01    19980219"  mat <- matrix(scan(text = txt), ncol = 5, byrow = true) cond <- mat[,1] < -33.52 & mat[,1] > -33.55 mat[cond, ]  ##         [,1]   [,2] [,3]   [,4]     [,5] ## [1,] -33.550 23.357    0 21.077 19980219 ## [2,] -33.542 23.401    0 21.077 19980219 ## [3,] -33.535 23.444    0 21.077 19980219 ## [4,] -33.527 23.488    0 21.077 19980219 

Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -