Open WSKQ23 opened 3 years ago
I'm not sure if I understand entirely.
You will run this step first to create a "skeleton" for your package with an R folder:
usethis::create_package( "montyhall" )
documents # package created inside documents
├─ montyhall # new folder that will appear after create_package()
│ ├─ R
You download the monty-hall-problem.R script and move it to that folder.
Then open it in an editor or your choosing (notebook, R Studio, etc). Add roxygen comments to all of the functions. Then:
setwd( "montyhall" )
getwd() # needs to be in the monty hall directory: 'some/path/.../montyhall'
devtools::document()
Then the man (R manual) folder will appear.
documents
├─ montyhall
│ ├─ R
│ ├─ man # new *.rd files will be here
I also tried to save it directly in R folder, but shows series of errors.
What did you try saving there? The monty-hall-problem.R script?
Can you download the script, then move it into the R folder? Or try save-as?
The only reason you would not be able to save to that folder is if the directory is protected, which means it is stored somewhere on you computer where you don't have admin rights like a root C: directory or a work partition on a work computer?
Also, did you save the script in the R folder inside the skeleton before trying the document() step? That script needs to be there and roxygen fields complete when you run the document() step.
Two things:
You are getting warnings here because you are creating a folder called "montyhall" inside a folder called "montyhall":
I see the following:
getwd() # documents in this example [1] "/Users/ahmedradwan/montyhall" usethis::create_package( "montyhall" )# set your directory if you want the package New project 'montyhall' is nested inside an existing project './', which is rarely a good idea. If this is unexpected, the here package has a function, here::dr_here() that reveals why './' is regarded as a project. Do you want to create anyway?
You might change your top-level montyhall folder to something else (rpackage?).
For these errors, have you completed the roxygen comments before trying to document your functions?
Warning: [/Users/ahmedradwan/montyhall/R/monty-hall-problem.R:38] @description requires a value Warning: [/Users/ahmedradwan/montyhall/R/monty-hall-problem.R:39] @details requires a value Warning: [/Users/ahmedradwan/montyhall/R/monty-hall-problem.R:40] @param requires a value
If you haven't filled those out yet in the script that is why. Otherwise it might be related to the issue above (nested folders with identical names).
Hello @lecy I am working on the R Package and have gone through the instructions but have issues installing the package. I used the DOWNLOAD THE TEMPLATE: monty-hall-problem. R in the title for R folder, but it does not show in the R folder. I noticed that the "R" and "Man" folders in the package are empty. I also tried to save it directly in R folder, but shows series of errors.