R: Extract matrix entries by condition
chris September 30, 2012 #R #matrix #condition #extractToday I was wondering how I could extract certain entries (≥0.95) from a huge matrix in R containing about 1.5 billion float values.
I had this simple condition on the values, and I wanted to iterate over all entries that satisfied that condition and write them to a file.
After some fiddling I found I quick way of doing so:
We make use of the which-function, which is capable of extracting indices from matrices that fulfill certain conditions and then use the apply function:
trueIndices <-