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

Potential Hang Up for Other Species #21

Open
nthaydt opened this issue Sep 16, 2019 · 2 comments
Open

Potential Hang Up for Other Species #21

nthaydt opened this issue Sep 16, 2019 · 2 comments
Assignees

Comments

@nthaydt
Copy link
Member

nthaydt commented Sep 16, 2019

This is where I ran in to some issue running an early version of the SCR model with species other than CPIC...
MultiSessionModel_NHedits.R

EM_CPIC <- EDF_CPIC %>%
  group_by(site_num, ind, trap_id_edited, day) %>%
  select(site_num, ind, trap_id_edited, day) %>%
  mutate(count = 1) %>%
  summarise_all(sum) %>%
  #spread(trap_id_edited, count, fill = 0) %>%
  ungroup() %>%
  mutate(id = as.integer(as.factor(ind)))

EM_CPIC$site_trap <- ave(EM_CPIC$trap_id_edited, EM_CPIC$site_num, FUN = function(x) as.numeric(factor(x)))
@djhocking
Copy link
Member

I think the code

EDF_PRUB$trap_id_edited <- ifelse(EDF_PRUB$trap_id >= 61, EDF_PRUB$trap_id - 6, EDF_PRUB$trap_id - 0)
EDF_PRUB$site_num <- as.integer(as.factor(EDF_PRUB$site))

summary(EDF_PRUB)

is a place where there will be a problem with species that weren't catch at each site. Don't use as.factor. Manually set the site numbers using the mutate function in dplyr or better yet, make a conversion file. Just a csv with the site names in one column and the corresponding site number in the other column. If there are sites that you will not be using ("H" and "I"?) then don't include those in the first 12 numbers because we will want to loop through site numbers 1-12. This file can then be joined with a left_join() so the site number is added to each row in the original EDF data.

After that is fixed then we can look at what the issue is with the code you initially posted with the issue.

@nthaydt
Copy link
Member Author

nthaydt commented Sep 28, 2019 via email

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

2 participants