First post, so please be gentle. May I share something I just learned?
I have been struggling for hours because my R code could not find a particular function in a package that is the whole purpose of the package. I closed and reopened RStudio, reinstalled the package, and got the same "could not find function x".
It turns out the issue was that my R version was too old. Upgrading the R version via the installr package was pretty painless and solved my issue.
So the moral is, don't let your R version become too obsolete.