Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: 'create_cluster' #40

Closed
zhengjiji456 opened this issue Sep 1, 2020 · 1 comment
Closed

Error: 'create_cluster' #40

zhengjiji456 opened this issue Sep 1, 2020 · 1 comment
Assignees
Labels
help wanted Extra attention is needed

Comments

@zhengjiji456
Copy link

I prepared the codes below

multidplyr::create_cluster() %>%
cluster_library(c('r3PG', 'purrr', 'dplyr', 'tidyr')) %>%
cluster_copy( r3pg_grid ) %>%
cluster_copy( species.grid ) %>%
cluster_copy( thinn.grid ) %>%
cluster_copy( param.draw )

However, I got an error message
Error: 'create_cluster' is not an exported object from 'namespace:multidplyr'

Was this function creat_cluster removed? (https://www.rdocumentation.org/packages/multidplyr/versions/0.0.0.9000/topics/create_cluster)

@trotsiuk
Copy link
Owner

trotsiuk commented Sep 1, 2020

Hi @zhengjiji456 .

I think you are using a never version of multidplyr, installed from GitHub. In this version they have changed the syntax for cluster partitioning.

Here would be a correct syntax for the version of multidplyr()

cl_in <- new_cluster(n = 7) %>% # where `n` is a number of clusters
  cluster_library(c('r3PG', 'purrr', 'dplyr', 'tidyr')) %>%
  cluster_copy( 'r3pg_grid' ) %>%
  cluster_copy( 'species.grid' ) %>%
  cluster_copy( 'thinn.grid' ) %>%
  cluster_copy( 'param.draw' )

#' `hide the sample_n`
sim.grid <- inner_join(site.grid, climate.grid, by = 'grid_id')  %>%
  sample_n(10) %>% # remove this for full simulation
  partition( cluster = cl_in) %>%
  mutate( out = map2(site, forc, ~r3pg_grid(.x, .y))) %>%
  select( grid_id, out) %>%
  collect() %>%
  unnest_legacy() %>%
  ungroup()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants