Top "Purrr" questions

purrr enhances R’s functional programming toolkit by providing a complete and consistent set of tools for working with functions and vectors, such as map() and reduce().

Why use purrr::map instead of lapply?

Is there any reason why I should use map(<list-like-object>, function(x) <do stuff>) instead of …

r purrr
Error in bind_rows_(x, .id) : Argument 1 must have names using map_df in purrr

I'm using the spotifyr package to scrape spotify audio features for every song of specific albums in my dataset. My …

r error-handling dplyr purrr
Row-wise iteration like apply with purrr

How do I achieve row-wise iteration using purrr::map? Here's how I'd do it with a standard row-wise apply. df &…

r apply purrr
Parse Error: "Trailing Garbage" while trying to parse JSON column in data frame

I have a log file that look like this. I'm trying to parse the JSON in the Message column by: …

json r jsonlite purrr
How to use map from purrr with dplyr::mutate to create multiple new columns based on column pairs

I have to following issue using R. In short I want to create multiple new columns in a data frame …

r dplyr purrr mutate
Adding column if it does not exist

I have a bunch of data frames with different variables. I want to read them into R and add columns …

r dataframe dplyr purrr
Use purrr::map to apply multiple arguments to a function

I have a data frame like this df <- data.frame(tiny = rep(letters[1:3], 20), block = rnorm(60), tray = runif(60, min=0.4, …

r ggplot2 dplyr magrittr purrr
Multiple condition if-else using dplyr, custom function, or purr

I have a data frame that has similar structure to the following: set.seed(123) df<-data_frame(SectionName = rep(…

r dplyr purrr
R purrr:::pmap: how to refer to input arguments by name?

I am using R purrr:::pmap with three inputs. It is not clear how I can refer explicitly to these …

r purrr tidyverse
Use input of purrr's map function to create a named list as output in R

I am using the map function of the purrr package in R which gives as output a list. Now I …

r list named purrr