Open lecy opened 3 years ago
It might be an issue related to whether you are in the proper folder when running each step.
For the first step you will create the montyhall folder in whatever directory you are working in (I'm using documents here):
getwd()
usethis::create_package( "montyhall" )
documents # should be here first
├─ montyhall
│ ├─ R
You run the document() function from inside the new montyhall folder after you have moved your documented code into the R folder:
setwd( "montyhall" )
getwd()
devtools::document()
documents
├─ montyhall # should be here now
│ ├─ R # place your R scripts in here
If your document() task was successful you will find new *.Rd (R documentation) files in the new man (manual) folder. One file for each function (change_door.Rd, create_game.Rd, etc.). These are the help files for each function.
Then return to the default directory before trying to install the package.
setwd( ".." )
getwd() # back to documents
devtools::install( "montyhall" )
documents # should be back here
├─ montyhall
│ ├─ R
│ ├─ man # new *.rd files were added here
Dear Prof. Jesse,
I’ve completed all the steps of GitHub Hosting tell reaching Push Origin using the desktop app without facing any issue, however after I use devtools::install_github( "..." ) I got this error when testing it in a new R console:
Downloading GitHub repo
Error: Failed to install 'montyhall' from GitHub:
Line starting 'behind it and two ha ...' is malformed!
Why I'm encountering this issue?
Unlike R, roxygen comments are like YAML headers - they parse data using spaces so can be a little sensitive.
I searched your script for the text in the error and found:
#' @details
#' The game setup replicates the game on the TV show "Let's
#' Make a Deal" where there are three doors for a contestant
#' to choose from, one of which has a car behind it and two
#' have goats. The contestant selects a door, then the host
Note that only that line has a space after it:
#' Make a Deal" where there are three doors for a contestant
#' to choose from, one of which has a car behind it and two[SPACE]
#' have goats. The contestant selects a door, then the host
Try removing that and see if it works.
"malformed line" often means extra or missing spaces, carriage returns, special characters.
I’m working on the package assignment , I did all the steps however when I use to test the create_game() function I got this error:
Also when I used :
I got this:
Then when I use
I got only this two line :
instead of this:
What is wrong?