Reputation: 69
I have a n x 3 matrix. My column headings are longitude, latitude, and energy value.
I am trying to set an upper and limit for my 3rd column ('energy value' column) only. How do I ensure only values between 1 and 90,000 remain in that column?
Thanks!
Upvotes: 0
Views: 452
Reputation: 887213
We could also do
library(dplyr)
m %>%
as.data.frame %>%
filter(between(V3, 1, 90000))
Upvotes: 0
Reputation: 101663
Other options in addition to the answer by @Edo
subset(m, data.table::between(m[,3],1,90000))
or
subset(m, m[,3] >= 1 & m[,3] <= 90000)
Upvotes: 1