Why dplyr?


dplyr is an R package that allow you to manipulate data stored in data frames. It helps order, rearrange, sort, count, summarize, simplify, reduce or expand its contents (among others). dplyr offers a set of functions in the form of verbs which are easy to understand, to remember and to apply.
 
Of course, all of this could be done with base R (the base package in R). However dplyr introduces a “grammar of data manipulation” that (once understood) makes things simpler for you. It is in a way comparable to ggplot2, which allows you to draw plots and figures in R in a more intuitive way than with base R. And again, it is a matter of debate whether dplyr is actually better than base R…
 
Here we will not try to compare the efficiency of dplyr versus base R, but rather review the most interesting and useful functions and the syntax to use.
 
One final note is that dplyr expects the data frames you work with to be “tidy”. This means that variables are organized in columns (one variable per column) and observations or cases are organised in rows (one case per row).

  Fant du det du lette etter? Did you find this helpful?
[Average: 0]