Skip to content

haihuilab/mapper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

74 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A wrapper of purrr and furrr packages for easy parallel mapping in R (mapper)

You just need to change map function to mapper function (and also other mapping functions) for parallel calculation

The goal of mapper is to using furrr map functions for parallel calculations and automated removing cache.

Installation

You can install the development version of mapper like so:

devtools::install_github("haihuilab/mapper")

Example

This is a basic example which shows you how to use mapper functions:

## basic example code
# devtools::install_github("haihuilab/mapper")
library(mapper)

# Compute normal distributions from an atomic vector
# map
1:10 |>
  map(rnorm, n = 10)
# mapper: default cores are total cores minus 2 for parallel calculation, you can change the cores by setting `workers=<num>`
1:10 |>
  mapper(rnorm, n = 10)

# Remove cache when using furrr:map functions
1:10 %>%
  future_mapper(rnorm, n = 10, .options = furrr_options(seed = 1233)) %>%
  future_mapper_dbl(mean, workers = 4)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages