To create documentation for a function using roxygen2 you need
#Load the necessary libraries
library(devtools)
library(roxygen2)
dir.create("packagedir")
#unlink("packagedir", recursive=TRUE) # If you want to delete the directory for some reason
setwd("packagedir")
create() # This will create the package skeleton for roxygen2 to work
create the function\functions you need to document in the R directory
ensure that you are at the top level of the directory and not in the directory
document() #This will create the rd documents
setwd("..") # Go one directory step up
install("packagedir") #Enter your package name here
shell("rm -f packagedir.pdf")
shell("R CMD Rd2pdf packagedir") #This will create a packagedir.pdf file in the directory
setwd("./packagedir")
#Load the necessary libraries
library(devtools)
library(roxygen2)
dir.create("packagedir")
#unlink("packagedir", recursive=TRUE) # If you want to delete the directory for some reason
setwd("packagedir")
create() # This will create the package skeleton for roxygen2 to work
create the function\functions you need to document in the R directory
ensure that you are at the top level of the directory and not in the directory
document() #This will create the rd documents
setwd("..") # Go one directory step up
install("packagedir") #Enter your package name here
shell("rm -f packagedir.pdf")
shell("R CMD Rd2pdf packagedir") #This will create a packagedir.pdf file in the directory
setwd("./packagedir")
Comments
Post a Comment