Comparison: subset and filter

A detailed introduction on subsetting is seen in Hadley Wickham’s Advanced R.

  • The three subsetting operators.
  • The six types of subsetting.
  • Important differences in behaviour for different objects (e.g., vectors, lists, factors, matrices, and data frames).

Benjamin on Stack Overflow answered the question 1 of the comparison between subset() and dplyr::filter().

  • They are, indeed, producing the same result, and they are very similar in concept.
  • As the data sets grow, filter seems gains the upper hand in efficiency.

  1. The use of subsetting in conjunction with assignment. Stack Overflow

Related