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 when parameterizing sites with a different number of vector species #15

Open
htopazian opened this issue May 17, 2023 · 0 comments

Comments

@htopazian
Copy link
Collaborator

htopazian commented May 17, 2023

It would be useful to eventually include all three vectors species in each site file, even if only two are represented in that setting with a proportion >0. The malariasimulation metapopulation model requires that each site have the same number of species. Not an urgent problem, just for this specific use. Here is my hacky way for now:

# pull in default vector species values from an example site
vectors <- site::single_site(foresite::"KEN", 1)$vector
vectors$prop <- rep(0, 3)
arabiensis <- vectors[1, 5:12]
funestus <- vectors[2, 5:12]
gambiae <- vectors[3, 5:12]
print(arabiensis); print(funestus); print(gambiae)

# pull in site to modify
site <- site::single_site(foresite::"ETH", 1)
print(site$vector) # only two species represented

if(!("arabiensis" %in% c(site$vectors$species))){
  add_row <- slice_tail(site$vectors, n = 1)
  add_row[, 5:12] <- arabiensis
  site$vectors <- bind_rows(site$vectors, add_row)
}

if(!("funestus" %in% c(site$vectors$species))){
  add_row <- slice_tail(site$vectors, n = 1)
  add_row[, 5:12] <- funestus
  site$vectors <- bind_rows(site$vectors, add_row)
}

if(!("gambiae" %in% c(site$vectors$species))){
  add_row <- slice_tail(site$vectors, n = 1)
  add_row[, 5:12] <- gambiae
  site$vectors <- bind_rows(site$vectors, add_row)
}

print(site$vectors) # three species now represented
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant