Skip to content

Commit

Permalink
Merge pull request #290 from jmbarbone/roxygen2md
Browse files Browse the repository at this point in the history
Use `roxygen2md`
  • Loading branch information
JanMarvin authored Nov 8, 2021
2 parents f8bbdd0 + 4766fb3 commit 1c0295d
Show file tree
Hide file tree
Showing 59 changed files with 699 additions and 699 deletions.
1 change: 1 addition & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,4 @@ Collate:
'writeDataTable.R'
'writexlsx.R'
'zzz.R'
Roxygen: list(markdown = TRUE)
21 changes: 10 additions & 11 deletions R/CommentClass.R
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,12 @@ Comment$methods(show = function() {
#' @description Create a cell Comment object to pass to writeComment()
#' @param comment Comment text. Character vector.
#' @param author Author of comment. Character vector of length 1
#' @param style A Style object or list of style objects the same length as
#' comment vector. See \code{\link{createStyle}}.
#' @param style A Style object or list of style objects the same length as comment vector. See [createStyle()].
#' @param visible TRUE or FALSE. Is comment visible.
#' @param width,height Width and height of textbook (in number of cells);
#' doubles are rounded with \code{base::round()}
#' @export
#' @seealso \code{\link{writeComment}}
#' @seealso [writeComment()]
#' @examples
#' wb <- createWorkbook()
#' addWorksheet(wb, "Sheet 1")
Expand Down Expand Up @@ -127,12 +126,12 @@ createComment <- function(comment,
#' @param sheet A vector of names or indices of worksheets
#' @param col Column a column number of letter
#' @param row A row number.
#' @param comment A Comment object. See \code{\link{createComment}}.
#' @param xy An alternative to specifying \code{col} and
#' \code{row} individually. A vector of the form
#' \code{c(col, row)}.
#' @param comment A Comment object. See [createComment()].
#' @param xy An alternative to specifying `col` and
#' `row` individually. A vector of the form
#' `c(col, row)`.
#' @export
#' @seealso \code{\link{createComment}}
#' @seealso [createComment()]
#' @examples
#' wb <- createWorkbook()
#' addWorksheet(wb, "Sheet 1")
Expand Down Expand Up @@ -205,11 +204,11 @@ writeComment <- function(wb, sheet, col, row, comment, xy = NULL) {
#' @param sheet A vector of names or indices of worksheets
#' @param cols Columns to delete comments from
#' @param rows Rows to delete comments from
#' @param gridExpand If \code{TRUE}, all data in rectangle min(rows):max(rows) X min(cols):max(cols)
#' @param gridExpand If `TRUE`, all data in rectangle min(rows):max(rows) X min(cols):max(cols)
#' will be removed.
#' @export
#' @seealso \code{\link{createComment}}
#' @seealso \code{\link{writeComment}}
#' @seealso [createComment()]
#' @seealso [writeComment()]
removeComment <- function(wb, sheet, cols, rows, gridExpand = TRUE) {
sheet <- wb$validateSheet(sheet)

Expand Down
74 changes: 37 additions & 37 deletions R/build_workbook.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@
#' @details
#' This function can be used as shortcut to create a workbook object from a
#' data.frame or named list. If names are available in the list they will be
#' used as the worksheet names. The parameters in \code{...} are collected
#' and passed to \code{\link{writeData}} or \code{\link{writeDataTable}} to
#' used as the worksheet names. The parameters in `...` are collected
#' and passed to [writeData()] or [writeDataTable()] to
#' initially create the Workbook objects then appropriate parameters are
#' passed to \code{\link{setColWidths}}.
#' passed to [setColWidths()].
#'
#' @param x A data.frame or a (named) list of objects that can be handled by
#' \code{\link{writeData}} or \code{\link{writeDataTable}} to write to file
#' @param asTable If \code{TRUE} will use \code{\link{writeDataTable}} rather
#' than \code{\link{writeData}} to write \code{x} to the file (default:
#' \code{FALSE})
#' @param ... Additional arguments passed to \code{\link{writeData}},
#' \code{\link{writeDataTable}}, \code{\link{setColWidths}} (see Optional
#' [writeData()] or [writeDataTable()] to write to file
#' @param asTable If `TRUE` will use [writeDataTable()] rather
#' than [writeData()] to write `x` to the file (default:
#' `FALSE`)
#' @param ... Additional arguments passed to [writeData()],
#' [writeDataTable()], [setColWidths()] (see Optional
#' Parameters)
#' @author Jordan Mark Barbone
#' @returns A Workbook object
Expand All @@ -27,49 +27,49 @@
#'
#' @section Optional Parameters:
#'
#' \bold{createWorkbook Parameters}
#' **createWorkbook Parameters**
#' \itemize{
#' \item{\bold{creator}}{ A string specifying the workbook author}
#' \item{**creator**}{ A string specifying the workbook author}
#' }
#'
#' \bold{addWorksheet Parameters}
#' **addWorksheet Parameters**
#' \itemize{
#' \item{\bold{sheetName}}{ Name of the worksheet}
#' \item{\bold{gridLines}}{ A logical. If \code{FALSE}, the worksheet grid lines will be hidden.}
#' \item{\bold{tabColour}}{ Colour of the worksheet tab. A valid colour (belonging to colours())
#' \item{**sheetName**}{ Name of the worksheet}
#' \item{**gridLines**}{ A logical. If `FALSE`, the worksheet grid lines will be hidden.}
#' \item{**tabColour**}{ Colour of the worksheet tab. A valid colour (belonging to colours())
#' or a valid hex colour beginning with "#".}
#' \item{\bold{zoom}}{ A numeric between 10 and 400. Worksheet zoom level as a percentage.}
#' \item{**zoom**}{ A numeric between 10 and 400. Worksheet zoom level as a percentage.}
#' }
#'
#' \bold{writeData/writeDataTable Parameters}
#' **writeData/writeDataTable Parameters**
#' \itemize{
#' \item{\bold{startCol}}{ A vector specifying the starting column(s) to write df}
#' \item{\bold{startRow}}{ A vector specifying the starting row(s) to write df}
#' \item{\bold{xy}}{ An alternative to specifying startCol and startRow individually.
#' \item{**startCol**}{ A vector specifying the starting column(s) to write df}
#' \item{**startRow**}{ A vector specifying the starting row(s) to write df}
#' \item{**xy**}{ An alternative to specifying startCol and startRow individually.
#' A vector of the form c(startCol, startRow)}
#' \item{\bold{colNames or col.names}}{ If \code{TRUE}, column names of x are written.}
#' \item{\bold{rowNames or row.names}}{ If \code{TRUE}, row names of x are written.}
#' \item{\bold{headerStyle}}{ Custom style to apply to column names.}
#' \item{\bold{borders}}{ Either "surrounding", "columns" or "rows" or NULL. If "surrounding", a border is drawn around the
#' \item{**colNames or col.names**}{ If `TRUE`, column names of x are written.}
#' \item{**rowNames or row.names**}{ If `TRUE`, row names of x are written.}
#' \item{**headerStyle**}{ Custom style to apply to column names.}
#' \item{**borders**}{ Either "surrounding", "columns" or "rows" or NULL. If "surrounding", a border is drawn around the
#' data. If "rows", a surrounding border is drawn a border around each row. If "columns", a surrounding border is drawn with a border
#' between each column. If "\code{all}" all cell borders are drawn.}
#' \item{\bold{borderColour}}{ Colour of cell border}
#' \item{\bold{borderStyle}}{ Border line style.}
#' \item{\bold{keepNA}} {If \code{TRUE}, NA values are converted to #N/A (or \code{na.string}, if not NULL) in Excel, else NA cells will be empty. Defaults to FALSE.}
#' \item{\bold{na.string}} {If not NULL, and if \code{keepNA} is \code{TRUE}, NA values are converted to this string in Excel. Defaults to NULL.}
#' between each column. If "`all`" all cell borders are drawn.}
#' \item{**borderColour**}{ Colour of cell border}
#' \item{**borderStyle**}{ Border line style.}
#' \item{**keepNA**} {If `TRUE`, NA values are converted to #N/A (or `na.string`, if not NULL) in Excel, else NA cells will be empty. Defaults to FALSE.}
#' \item{**na.string**} {If not NULL, and if `keepNA` is `TRUE`, NA values are converted to this string in Excel. Defaults to NULL.}
#' }
#'
#' \bold{freezePane Parameters}
#' **freezePane Parameters**
#' \itemize{
#' \item{\bold{firstActiveRow}} {Top row of active region to freeze pane.}
#' \item{\bold{firstActiveCol}} {Furthest left column of active region to freeze pane.}
#' \item{\bold{firstRow}} {If \code{TRUE}, freezes the first row (equivalent to firstActiveRow = 2)}
#' \item{\bold{firstCol}} {If \code{TRUE}, freezes the first column (equivalent to firstActiveCol = 2)}
#' \item{**firstActiveRow**} {Top row of active region to freeze pane.}
#' \item{**firstActiveCol**} {Furthest left column of active region to freeze pane.}
#' \item{**firstRow**} {If `TRUE`, freezes the first row (equivalent to firstActiveRow = 2)}
#' \item{**firstCol**} {If `TRUE`, freezes the first column (equivalent to firstActiveCol = 2)}
#' }
#'
#' \bold{colWidths Parameters}
#' **colWidths Parameters**
#' \itemize{
#' \item{\bold{colWidths}} {May be a single value for all columns (or "auto"), or a list of vectors that will be recycled for each sheet (see examples)}
#' \item{**colWidths**} {May be a single value for all columns (or "auto"), or a list of vectors that will be recycled for each sheet (see examples)}
#' }
#'
#' @examples
Expand All @@ -80,7 +80,7 @@
#' buildWorkbook(y, asTable = TRUE)
#' buildWorkbook(y, asTable = TRUE, tableStyle = "TableStyleLight8")
#'
#' @seealso \code{\link{write.xlsx}}
#' @seealso [write.xlsx()]
#'
#' @export

Expand Down
28 changes: 14 additions & 14 deletions R/conditional_formatting.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#'
#' If type == "expression"
#' \itemize{
#' \item{style is a Style object. See \code{\link{createStyle}}}
#' \item{style is a Style object. See [createStyle()]}
#' \item{rule is an expression. Valid operators are "<", "<=", ">", ">=", "==", "!=".}
#' }
#'
Expand All @@ -37,56 +37,56 @@
#' \item{rule is a numeric vector specifying the range of the databar colours. Must be equal length to style}
#' \item{...
#' \itemize{
#' \item{\bold{showvalue} If FALSE the cell value is hidden. Default TRUE.}
#' \item{\bold{gradient} If FALSE colour gradient is removed. Default TRUE.}
#' \item{\bold{border} If FALSE the border around the database is hidden. Default TRUE.}
#' \item{**showvalue** If FALSE the cell value is hidden. Default TRUE.}
#' \item{**gradient** If FALSE colour gradient is removed. Default TRUE.}
#' \item{**border** If FALSE the border around the database is hidden. Default TRUE.}
#' }
#' }
#' }
#'
#' If type == "duplicates"
#' \itemize{
#' \item{style is a Style object. See \code{\link{createStyle}}}
#' \item{style is a Style object. See [createStyle()]}
#' \item{rule is ignored.}
#' }
#'
#' If type == "contains"
#' \itemize{
#' \item{style is a Style object. See \code{\link{createStyle}}}
#' \item{style is a Style object. See [createStyle()]}
#' \item{rule is the text to look for within cells}
#' }
#'
#' If type == "between"
#' \itemize{
#' \item{style is a Style object. See \code{\link{createStyle}}}
#' \item{style is a Style object. See [createStyle()]}
#' \item{rule is a numeric vector of length 2 specifying lower and upper bound (Inclusive)}
#' }
#'
#' If type == "topN"
#' \itemize{
#' \item{style is a Style object. See \code{\link{createStyle}}}
#' \item{style is a Style object. See [createStyle()]}
#' \item{rule is ignored}
#' \item{...
#' \itemize{
#' \item{\bold{rank} numeric vector of length 1 indicating number of highest values.}
#' \item{\bold{percent} TRUE if you want top N percentage.}
#' \item{**rank** numeric vector of length 1 indicating number of highest values.}
#' \item{**percent** TRUE if you want top N percentage.}
#' }
#' }
#' }
#'
#' If type == "bottomN"
#' \itemize{
#' \item{style is a Style object. See \code{\link{createStyle}}}
#' \item{style is a Style object. See [createStyle()]}
#' \item{rule is ignored}
#' \item{...
#' \itemize{
#' \item{\bold{rank} numeric vector of length 1 indicating number of lowest values.}
#' \item{\bold{percent} TRUE if you want bottom N percentage.}
#' \item{**rank** numeric vector of length 1 indicating number of lowest values.}
#' \item{**percent** TRUE if you want bottom N percentage.}
#' }
#' }
#' }
#'
#' @seealso \code{\link{createStyle}}
#' @seealso [createStyle()]
#' @export
#' @examples
#' wb <- createWorkbook()
Expand Down
2 changes: 1 addition & 1 deletion R/helperFunctions.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#' @param col column number of letter for hyperlink to link to
#' @param text display text
#' @param file Excel file name to point to. If NULL hyperlink is internal.
#' @seealso \code{\link{writeFormula}}
#' @seealso [writeFormula()]
#' @export makeHyperlinkString
#' @examples
#'
Expand Down
2 changes: 1 addition & 1 deletion R/loadWorkbook.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#' formatting of the original .xlsx file.
#' @return Workbook object.
#' @export
#' @seealso \code{\link{removeWorksheet}}
#' @seealso [removeWorksheet()]
#' @examples
#' ## load existing workbook from package folder
#' wb <- loadWorkbook(file = system.file("extdata", "loadExample.xlsx", package = "openxlsx"))
Expand Down
10 changes: 5 additions & 5 deletions R/openXL.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
#' In Windows (c) and Mac (c), it uses system default handlers,
#' given the file type.
#'
#' In Linux it searches (via \code{which}) for available xls/xlsx
#' reader applications (unless \code{options('openxlsx.excelApp')}
#' In Linux it searches (via `which`) for available xls/xlsx
#' reader applications (unless `options('openxlsx.excelApp')`
#' is set to the app bin path), and if it finds anything, sets
#' \code{options('openxlsx.excelApp')} to the program choosen by
#' `options('openxlsx.excelApp')` to the program choosen by
#' the user via a menu (if many are present, otherwise it will
#' set the only available). Currently searched for apps are
#' Libreoffice/Openoffice (\code{soffice} bin), Gnumeric
#' (\code{gnumeric}) and Calligra Sheets (\code{calligrasheets}).
#' Libreoffice/Openoffice (`soffice` bin), Gnumeric
#' (`gnumeric`) and Calligra Sheets (`calligrasheets`).
#'
#' @param file path to the Excel (xls/xlsx) file or Workbook object.
#' @usage openXL(file=NULL)
Expand Down
34 changes: 17 additions & 17 deletions R/openxlsx.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@
#'
#' @seealso
#' \itemize{
#' \item{\code{vignette("Introduction", package = "openxlsx")}}
#' \item{\code{vignette("formatting", package = "openxlsx")}}
#' \item{\code{\link{writeData}}}
#' \item{\code{\link{writeDataTable}}}
#' \item{\code{\link{write.xlsx}}}
#' \item{\code{\link{read.xlsx}}}
#' \item{\code{\link{op.openxlsx}}}
#' \item{`vignette("Introduction", package = "openxlsx")`}
#' \item{`vignette("formatting", package = "openxlsx")`}
#' \item{[writeData()]}
#' \item{[writeDataTable()]}
#' \item{[write.xlsx()]}
#' \item{[read.xlsx()]}
#' \item{[op.openxlsx()]}
#' }
#' for examples
#'
#' @details
#' The openxlsx package uses global options, most to simplify formatting. These
#' are stored in the \code{op.openxlsx} object.
#' are stored in the `op.openxlsx` object.
#'
#' \describe{
#' \item{openxlsx.bandedCols}{FALSE}
Expand All @@ -44,8 +44,8 @@
#' \item{openxlsx.tabColour}{"TableStyleLight9"}
#' \item{openxlsx.tableStyle}{"TableStyleLight9"}
#' \item{openxlsx.withFilter}{NA Whether to write data with or without a
#' filter. If NA will make filters with \code{writeDataTable} and will not for
#' \code{writeData}}
#' filter. If NA will make filters with `writeDataTable` and will not for
#' `writeData`}
#' }
#'
#' See the Formatting vignette for examples.
Expand All @@ -61,13 +61,13 @@
#'
#' @details
#'
#' \code{openxlsx_getOp()} retrieves the \code{"openxlsx"} options found in
#' \code{op.openxlsx}. If none are set (currently `NULL`) retrieves the
#' default option from \code{op.openxlsx}. This will also check that the
#' intended option is a standard option (listed in \code{op.openxlsx}) and
#' `openxlsx_getOp()` retrieves the `"openxlsx"` options found in
#' `op.openxlsx`. If none are set (currently `NULL`) retrieves the
#' default option from `op.openxlsx`. This will also check that the
#' intended option is a standard option (listed in `op.openxlsx`) and
#' will provide a warning otherwise.
#'
#' \code{openxlsx_setOp()} is a safer way to set an option as it will first
#' `openxlsx_setOp()` is a safer way to set an option as it will first
#' check that the option is a standard option (as above) before setting.
#'
#' @examples
Expand Down Expand Up @@ -114,8 +114,8 @@ op.openxlsx <- list(
openxlsx.withFilter = NULL
)

#' @param x An option name (\code{"openxlsx."} prefix optional)
#' @param default A default value if \code{NULL}
#' @param x An option name (`"openxlsx."` prefix optional)
#' @param default A default value if `NULL`
#' @rdname openxlsx_options
#' @export
openxlsx_getOp <- function(x, default = NULL) {
Expand Down
16 changes: 8 additions & 8 deletions R/readWorkbook.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
#' @param sheet The name or index of the sheet to read data from.
#' @param startRow first row to begin looking for data. Empty rows at the top of a file are always skipped,
#' regardless of the value of startRow.
#' @param colNames If \code{TRUE}, the first row of data will be used as column names.
#' @param skipEmptyRows If \code{TRUE}, empty rows are skipped else empty rows after the first row containing data
#' @param colNames If `TRUE`, the first row of data will be used as column names.
#' @param skipEmptyRows If `TRUE`, empty rows are skipped else empty rows after the first row containing data
#' will return a row of NAs.
#' @param rowNames If \code{TRUE}, first column of data will be used as row names.
#' @param detectDates If \code{TRUE}, attempt to recognise dates and perform conversion.
#' @param rowNames If `TRUE`, first column of data will be used as row names.
#' @param detectDates If `TRUE`, attempt to recognise dates and perform conversion.
#' @param cols A numeric vector specifying which columns in the Excel file to read.
#' If NULL, all columns are read.
#' @param rows A numeric vector specifying which rows in the Excel file to read.
Expand All @@ -24,8 +24,8 @@
#' @param namedRegion A named region in the Workbook. If not NULL startRow, rows and cols parameters are ignored.
#' @param na.strings A character vector of strings which are to be interpreted as NA. Blank cells will be returned as NA.
#' @param fillMergedCells If TRUE, the value in a merged cell is given to all cells within the merge.
#' @param skipEmptyCols If \code{TRUE}, empty columns are skipped.
#' @seealso \code{\link{getNamedRegions}}
#' @param skipEmptyCols If `TRUE`, empty columns are skipped.
#' @seealso [getNamedRegions()]
#' @details Formulae written using writeFormula to a Workbook object will not get picked up by read.xlsx().
#' This is because only the formula is written and left to be evaluated when the file is opened in Excel.
#' Opening, saving and closing the file with Excel will resolve this.
Expand Down Expand Up @@ -561,8 +561,8 @@ read.xlsx.default <- function(
#' @details Creates a data.frame of all data in worksheet.
#' @author Alexander Walker
#' @return data.frame
#' @seealso \code{\link{getNamedRegions}}
#' @seealso \code{\link{read.xlsx}}
#' @seealso [getNamedRegions()]
#' @seealso [read.xlsx()]
#' @export
#' @examples
#' xlsxFile <- system.file("extdata", "readTest.xlsx", package = "openxlsx")
Expand Down
Loading

0 comments on commit 1c0295d

Please sign in to comment.