DS4PS / cpp-527-fall-2020

http://ds4ps.org/cpp-527-fall-2020/
0 stars 1 forks source link

create-r-package devtools::install error #31

Open krbrick opened 3 years ago

krbrick commented 3 years ago

my create_game check worked, but when I got to this stage, I got a big red one that looks like it has something to do with my wd. System command 'R' failed, exit status: 1, stdout & stderr were printed published to GitHub successfully.

devtools::install( "montyhall" ) ✓ checking for file ‘/Users/karabrick/montyhall/DESCRIPTION’ ... ─ preparing ‘montyhall’: ✓ checking DESCRIPTION meta-information ... ─ checking for LF line-endings in source and make files and shell scripts ─ checking for empty or unneeded directories ─ building ‘montyhall_0.0.0.9000.tar.gz’

Running /Library/Frameworks/R.framework/Resources/bin/R CMD INSTALL \ /var/folders/fm/dkr394jj6w97jggg2035jf1r0000gn/T//RtmpFUJL5x/montyhall_0.0.0.9000.tar.gz \ --install-tests

lecy commented 3 years ago

Are you trying to knit the instructions in R Studio?

You should be running the instructions in an R script. This is the extend of what you would need to run:

  1. Create a package skeleton (set of empty files and folders).
  2. Add your R code to the skeleton directory.
  3. Create documentation for your package (similar to knitting RMD files).
  4. Install your new package on your computer and test it out.
  5. Upload the package to GitHub.
# set your working directory
# if you don't want to create
# the package in your default 
# working directory

getwd()   # default directory, usually my documents 
library(devtools)

# step 1
usethis::create_package( "montyhall" )

# step 2 move R script to montyhall/R folder
# after completing documentation fields 

# step 3
setwd( "montyhall" )
devtools::document()

# step 4
setwd( ".." )
devtools::install( "montyhall" )
library( montyhall )
create_game()

# step 5: close R and re-open new console
devtools::install_github( "yourGitHubName/montyhall" )