bcgov / bccamtrap

Managing camera trap data
https://bcgov.github.io/bccamtrap/
Apache License 2.0
2 stars 0 forks source link

Image Data QA Error: Could not find function "select" #25

Closed btitaro closed 5 months ago

btitaro commented 6 months ago

Within the Image Data QA section, after I run the image_data_qa function, I cannot successfully run the select function: select(image_data_qa, root_folder, file, startswith("QA")) as the code is currently written.

I installed the package install.packages("dplyr") which resulted in R restarting. Once I got back to this step and loaded the library library(dplyr) I was able to successfully run the select function. I also retired and loaded this library at the very start along with bccamptrap and devtools and it worked.

This may be a user error on my end. Is there another way around this? Should the select function already be available or do we need to make note that dplyr needs to be installed and loaded as well?

ateucher commented 6 months ago

Hey @btitaro thanks for the report! That was an oversight in the README. dplyr does need to be loaded via library(dplyr). Because it is a dependency of the bccamtrap package, it will be installed on your system when you install bccamtrap, so you won't need to install it explicitly, just load it. I've added a bit of explanation and the library(dplyr) call to the README: https://github.com/bcgov/bccamtrap?tab=readme-ov-file#image-data-qa

ateucher commented 6 months ago

As for when to load the library - when writing an analysis script, it's good practice to load all of the libraries you need at the top of script so that you can see at a glance what you're working with. In the README here I loaded them "just in time" to illustrate where in the workflow you could start to use them (e.g. ggplot2 gets loaded further down once we start demonstrating custom plotting).

btitaro commented 5 months ago

Thanks @ateucher - that all makes sense! I'll keep working through the README from this point on and if anything else comes up will let you know.