Data package-r documentation

Oscar Jnn

I am creating a package and the automatic generation of Rd file for documentation work well with Roxygen2 for my function (here is an example of my R file wich gives a good Rd file using roxygen2::roxygenise():

#' Total flows of a DF
#'
#' This function allows you to store the totals of origins, destinations and intrenals flows for each city in a dataframe,
#' from a long format matrix of flows.
#'
#' @param tabflows A data.frame of flows between origins and destinations (long format matrix containing, at least, origins, destinations, flows)
#' @param idori identifiant ori
#' @param iddes identifiant des
#' @param idflow identifiant flux
#' @return A data.frame of totals origins, destinations and internals flows for each city
#'
#' @examples
#' data(tabflows)
#'
#' popTab <- pop_tab(tabflows = tabflows, idori = "ORI", iddes = "DES", idflow = "FLOW")
#'
#' popTab[10:10,]
#'
#' @export
#' @importFrom stats aggregate

pop_tab <- function(tabflows, idori, iddes, idflow){
  tabflowIntra <- tabflows[tabflows[idori] == tabflows[iddes], ]
  tabflowIntra <- aggregate(x = tabflowIntra[[idflow]], by = list(tabflowIntra[[idori]],tabflowIntra[[iddes]]), FUN = sum)
  colnames(tabflowIntra) <- c("ORI", "DES","TOTINTRA")
  tabflowOri <- tabflows[tabflows[idori] != tabflows[iddes], ]
  tabflowOri <- aggregate(x = tabflowOri[[idflow]], by = list(tabflowOri[[idori]]), FUN = sum)
  colnames(tabflowOri) <- c("ORI","TOTORI")
  tabflowDes <- tabflows[tabflows[idori] != tabflows[iddes], ]
  tabflowDes <- aggregate(x = tabflowDes[[idflow]], by = list(tabflowDes[[iddes]]), FUN = sum)
  colnames(tabflowDes) <- c("DES","TOTDES")
  poptab <- merge(x = tabflowIntra, y = tabflowOri, by.x = idori, by.y =idori)
  poptab <- merge(x = poptab, y = tabflowDes, by.x = idori, by.y =iddes)
  poptab[[iddes]] <- NULL
  colnames(poptab) <- c("idflow", "TOTINTRA","TOTORI", "TOTDES")
  return(poptab)
}

However, when i try to roxygenise() this next R file which is about data documentation, no Rd file is generated in the man directory. I could of course write the Rd file myself but i would like to know what is the issue here...

#' @title Commuters
#' @name tabflows
#' @description Data on commuters between Urban Areas in Paris region in 2014.
#' Fields: \cr
#' \itemize{
#' \item{ORI: Code of the urban area of residence}
#' \item{DES: Code of the urban area of work}
#' \item{MODE: Transport mode used by the workers}
#' \item{FLOW: Number of commuters between i and j}
#' \item{DIST: distance between the urban area of work and the urban area of residence}
#' \item{DISTTOT: total distance between the urban area of work and the urban area of residence}
#' \item{ORILIB: Name of the urban area of residence}
#' \item{DESLIB: Name of the urban area of work}
#' }
#' @docType data
#' @examples
#' ## tabflows
#' data(tabflows)
Stéphane Laurent

Write NULL after the last line:

......
#' @examples
#' ## tabflows
#' data(tabflows)
NULL

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

R object documentation: Package documentation as first item

c++ documentation in an R package

short url in R package documentation

R package documentation: link to a whole package, not function

Export R package documentation to a web page

Bilingual (English and Portuguese) documentation in an R package

R package documentation items params order

Travis CI R package error in documentation

How to build API documentation for an R package in RStudio?

How to share objects in vignettes documentation in a R package?

Adding Greek letters to LaTeX code while creating documentation for an R package

Writing symbols in R package documentation files (.Rd files)

creating Rd documentation files for R6 classes not in a package

Including images in R-package documentation (.Rd) files

What are the standard options for generating printable documentation for an R package?

Rcpp integrated with R package: Documentation of CPP code objects

Get single latex file instead of PDF for documentation of R package

Inherit Roxygen2 documentation for multiple arguments in R package

Data Deprecation in R-package

Loading data into R with rsqlserver package

Trouble loading R package data

Altering internal data in R package

Generate data with simsem package in R

How to read package documentation

Creating Package Documentation with RStudio?

Vignette in Package Documentation

can't update R package documentation: `System command 'R' failed` (#using statements don't work)

Git doesn't know my name/email when Github Actions deploy R package documentation and breaks

R package documentation: "Found the following apparent S3 methods exported but not registered"