Define many subset sequence in R -


assume have dataframe called data contains column called col contains numbers 0 10'000.

how create following subset function subset in r can called sub

  • numbers 999 1200 and
  • numbers 1500 1599

edit: i've tried sub<- subset(data, col >= 999 & col <= 1200 | col >= 1500& col <= 1599) i'm not sure i'm right doing so.

the problem in logic - need use parentheses keep relevant statements together:

sub<- subset(data, (col >= 999 & col <= 1200) | (col >= 1500& col <= 1599)) 

although honest, think way did technically work.


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -