Roxygen2 and RStudio without creating documentation for functions

I am trying to add documentation via roxygen2 in a package. I can create the package successfully on upload to use the functions too. Here is my understanding of how to do it, I create an empty R-Package project on RStudio and then create a source file called getSomething.R. The content is as follows:

#' Test function to ask on stackoverflow
#' 
#' \code{getSomething} Does something to get something.
#' 
#' @param a param 1
#' @param b param 2
#' 
#'

getSomething <- function(a,b){
  return(a*b)
}

      

Now I create and download a package, which should ideally create a package with a .Rd file in the / man folder, and also start executing "getSomething". But nothing happens when the command is used and no Rd files are created. Am I missing something? In my original project, I have some dependent packages that I added.

Below is the decription file,

Package: testPackage
Type: Package
Title: Learn how to use roxygen2.
Version: 1.0.1
Date: 2014-11-27
Author: amj2403
Maintainer: amj2403 <emailid>
Description: Write something here
License: NA
Depends:
    R (>= 3.0.0),
    rjson,
    futile.logger,
    RCurl

      

Also the NAMESPACE file,

exportPattern ("^ [[: alpha:]] +"

I think I am missing an important step.

+3


source to share


2 answers


By default in RStudio, when you enable roxygen2, you need to roxygenise everything on package builds and R CMD CHECK, but not build and reload. To enable this, go to Project Options → Build Tools. Then click the "Configure" button next to "Generate documentation with Roxygen" and check the "Create and reload" box.



+4


source


Sometimes RStudio does not display the "Generate documentation from Roxygen" checkbox at all. If so, in the R Console (roxygen2) type library and it will suddenly show up.



I would like to be instructed to download it and enable it by default.

+1


source







All Articles