Category "purrr"

Calculating Highest In, First Out on trades

I am trying to use the Highest In, First Out accounting method on trades. Highest In, First Out means that when you sell, you sell your most expensive shares fi

map2 equivalent apply family

I'd like to iterate between two vectors applying the following function to a dataframe. Since the dataframe is huge and I know that the apply family functions

Calculate changes in totals of subgroups in R

I have the following dataframe: # A tibble: 8 x 5 Year Group Unit Profit Sales <dbl> <chr> <chr> <dbl> <dbl> 1 2021 One

Creating a purrr map equivalent

I have a list of files like so: dput(files) list(ped_cv_outcomes_in_hospital_code_v20.csv = structure(list( icd_10_cm_code = c("I2101", "I2102", "I2109", "I

How do I assign group level value - based on row level values - to df using dplyr

I have the following decision rules: RELIABILITY LEVEL DESCRIPTION LEVEL I Multiple regression LEVEL II Multiple regression + mec

Purrr::pmap using a named list of columns with '~' function doesn't respect names from .l?

This is my first time posting, so bear with me. I'm using purrr::pmap() to map a function over 3 columns of a tibble(), to create a 4th column library(tidyverse

Error in converting Matlab code to R code using tidyverse and matconv

I am using a piece of R code which was provided as a response to the previous question Using tidyverse and matconv to convert Matlab code to R code. The code su

map function based on a column value of dataframes stored in a list

I am trying to use the map function to do something complex - I'd like to use the values of the Result column per each dataframe I have in a list ( these are m

Native pipe with purrr::map_dfr()

I'd like to use the new native pipe,|>, with purrr::map_dfr(). (To make it reproducible, I'm passing the datasets as strings instead of paths, but that shou

How I can Speed up code built using purrr- Why is Furrr slower than purrr

I'd like to know if there is a way to speed up a code built with purrr package. I tried to convert it into furr and use the multisession option, but it is even

Nested list to dataframe [using purrr + map]

I've looked at a lot of posts so I'm sorry if this is redundant, but was hoping to get some help flattening a nested list: test <- list() test <- c( li

Multi-level list to data frame in R

I'd like to convert the below list to a data frame but I'm failing at doing it. The list is taken from Microsoft Azure's API listing all resource types with tec

Using purrr::possibly to catch dynamic error messages

I've written a custom function that does a number of checks and throws a different error when a check fails. Below is a simple example function that takes a dat

How to delay evaluation of function passed as argument to purrr::pmap

I'm trying to use the nested dataframe (https://r4ds.had.co.nz/many-models.html) approach to fit multiple latent class growth curves using lcmm::lcmm() and purr