Top "Dplyr" questions

Use this tag for questions relating to functions from the dplyr package, such as group_by, summarize, filter, and select.

How to add a cumulative column to an R dataframe using dplyr?

I have the same question as this post, but I want to use dplyr: With an R dataframe, eg: df &…

r dataframe dplyr
Error message when running simple 'rename' function in R

Below a very simple data frame example I found in the internet. Running this in RStudio on my machine turns …

r rename dplyr
Find duplicated elements with dplyr

I tried using the code presented here to find ALL duplicated elements with dplyr like this: library(dplyr) mtcars %>% …

r dplyr
Correct syntax for mutate_if

I would like to replace NA values with zeros via mutate_if in dplyr. The syntax below: set.seed(1) mtcars[…

r dplyr na
Applying group_by and summarise on data while keeping all the columns' info

I have a large dataset with 22000 rows and 25 columns. I am trying to group my dataset based on one of …

r dplyr
dplyr mutate rowSums calculations or custom functions

I'm trying to mutate a new variable from sort of row calculation, say rowSums as below iris %>% mutate_(sumVar = …

r dplyr
Conditionally Count in dplyr

I have some member order data that I would like to aggregate by week of order. This is what the …

r dplyr
Using functions of multiple columns in a dplyr mutate_at call

I'd like to use dplyr's mutate_at function to apply a function to several columns in a dataframe, where the …

r dplyr
dplyr filter: Get rows with minimum of variable, but only the first if multiple minima

I want to make a grouped filter using dplyr, in a way that within each group only that row is …

r dplyr
Using dplyr window functions to calculate percentiles

I have a working solution but am looking for a cleaner, more readable solution that perhaps takes advantage of some …

r dplyr tidyr