DS4PS / cpp-527-spr-2020

Course shell for CPP 527 Foundations of Data Science II for Spring 2020.
http://ds4ps.org/cpp-527-spr-2020/
0 stars 1 forks source link

R Package #11

Open sunaynagoel opened 4 years ago

sunaynagoel commented 4 years ago

@lecy When I run this code

# set your directory
# setwd()
usethis::create_package( "montyhall" )

It opens up a new R console. The console shows all the file and folders we need. I am a little confused on where to add roxygen comments? In the new R console or to my original r document I was working with? This is my 5th try and I am not able to make it work.

Thanks

JaesaR commented 4 years ago

@castower I did! After installing build_github_devtools

library(devtools)
has_devel()

returns the same error as before

library(build_github_devtools)
has_devel()

returns: Error in library(build_github_devtools) : there is no package called ‘build_github_devtools’

castower commented 4 years ago

@JaesaR try this one: devtools::install_github("r-lib/devtools")

https://github.com/r-lib/devtools

JaesaR commented 4 years ago

@castower Wow I really appreciate all your help, thanks Courtney! Unfortunately, when I run that it returns with the following error:

Error: .onLoad failed in loadNamespace() for 'pkgload', details: call: loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) error: namespace ‘rlang’ 0.4.0 is already loaded, but >= 0.4.1 is required

castower commented 4 years ago

@JaesaR I believe I got that error too. I uninstalled 'rlang' and then reinstalled it.

JaesaR commented 4 years ago

@castower Thanks for your suggestion, but unfortunately after uninstalling and reinstalling 'rlang' I am still experiencing the same issues.

castower commented 4 years ago

@JaesaR hmm, my only other suggestion (but you've probably tried it already!) would be to re-start R, sometimes that seems to fix odd problems.

JaesaR commented 4 years ago

@castower haha you're right I've restarted it multiple times and even tried restarting my computer but I just keep running into the same issues. Thanks for all your help though :)

castower commented 4 years ago

@JaesaR you're welcome! I ran into a few issues too so I know it can get frustrating, lol

lecy commented 4 years ago

@JaesaR It definitely appears to be a problem with dependencies from the error:

namespace ‘rlang’ 0.4.0 is already loaded, but >= 0.4.1 is required

When I google that error here is what comes up:

https://community.rstudio.com/t/problems-with-tidyverse-load-error-package-or-namespace-load-failed-for-tidyverse-in-loadnamespace-i-c-lib-loc-libpaths-versioncheck-vi-i-namespace-scales-0-4-0-is-already-loaded-but-0-4-1-is-required/3414/10

Not the solution I expected, but worth a try!

I find that when there are package conflicts it is easier to update them with a basic R console rather than R Studio. I'm not sure if R Studio loads some packages automatically, but I don't encounter as many problems

You can try installing devtools directly, or uninstall and reinstall rlang.

remove.packages( "rlang" )
# install.packages( "rlang" )
devtools::install_github( "r-lib/devtools" )

Sometimes it is not the package that is triggering the error, but another related package to which it is bundled. You can also try Packages >> Update packages.

lecy commented 4 years ago

Thanks for your help @castower !

lecy commented 4 years ago

@JaesaR Were you installing roxygen from GitHub or from CRAN? Did you try:

devtools::install_github( "r-lib/roxygen2" )
JaesaR commented 4 years ago

Thanks for the help, everyone! I ended up needing to update and restart R, because I was only restarting RStudio.