Skip to content
This repository has been archived by the owner on Jan 30, 2025. It is now read-only.

Commit

Permalink
Reorganize documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
nfrerebeau committed Jan 17, 2024
1 parent 1fe62d9 commit 105f4ba
Show file tree
Hide file tree
Showing 22 changed files with 149 additions and 177 deletions.
5 changes: 3 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Suggests:
tinytest
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.3
RoxygenNote: 7.3.0
Collate:
'AllGenerics.R'
'append.R'
Expand All @@ -47,10 +47,11 @@ Collate:
'discard.R'
'keep.R'
'mathematics.R'
'palettes.R'
'plot.R'
'remove.R'
'replace.R'
'scale.R'
'statistics.R'
'transform.R'
'utilities.R'
'zzz.R'
143 changes: 72 additions & 71 deletions R/AllGenerics.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# GENERIC METHODS

# Data cleaning ================================================================
# Data preparation =============================================================
## Count -----------------------------------------------------------------------
#' Count Values Using a Predicate
#'
Expand All @@ -18,7 +18,7 @@
#' @example inst/examples/ex-count.R
#' @author N. Frerebeau
#' @docType methods
#' @family data cleaning tools
#' @family data preparation tools
#' @aliases count-method
setGeneric(
name = "count",
Expand All @@ -39,7 +39,7 @@ setGeneric(
#' @example inst/examples/ex-detect.R
#' @author N. Frerebeau
#' @docType methods
#' @family data cleaning tools
#' @family data preparation tools
#' @aliases detect-method
setGeneric(
name = "detect",
Expand All @@ -56,7 +56,7 @@ setGeneric(
#' @example inst/examples/ex-keep.R
#' @author N. Frerebeau
#' @docType methods
#' @family data cleaning tools
#' @family data preparation tools
#' @aliases keep-method
setGeneric(
name = "keep",
Expand Down Expand Up @@ -87,7 +87,7 @@ setGeneric(
#' @example inst/examples/ex-discard.R
#' @author N. Frerebeau
#' @docType methods
#' @family data cleaning tools
#' @family data preparation tools
#' @aliases discard-method
setGeneric(
name = "discard",
Expand Down Expand Up @@ -123,7 +123,7 @@ setGeneric(
#' @example inst/examples/ex-compact.R
#' @author N. Frerebeau
#' @docType methods
#' @family data cleaning tools
#' @family data preparation tools
#' @aliases compact-method
setGeneric(
name = "compact",
Expand All @@ -144,8 +144,67 @@ setGeneric(
def = function(x, ...) standardGeneric("compact_rows")
)

## Remove ----------------------------------------------------------------------
### NA --------------------------------------------------------------------------
## Assign ----------------------------------------------------------------------
#' Assign a Specific Row/Column to the Column/Row Names
#'
#' @param x A [`data.frame`].
#' @param row A length-one [`numeric`] vector specifying the row number that is
#' to become the column names.
#' @param column A length-one [`numeric`] vector specifying the column number
#' that is to become the row names.
#' @param remove A [`logical`] scalar: should the specified row/column be removed
#' after making it the column/row names?
#' @param ... Currently not used.
#' @example inst/examples/ex-assign.R
#' @return A [`data.frame`].
#' @author N. Frerebeau
#' @docType methods
#' @family data preparation tools
#' @name assign
#' @rdname assign
NULL

#' @rdname assign
#' @aliases assign_colnames-method
setGeneric(
name = "assign_colnames",
def = function(x, ...) standardGeneric("assign_colnames")
)

#' @rdname assign
#' @aliases assign_rownames-method
setGeneric(
name = "assign_rownames",
def = function(x, ...) standardGeneric("assign_rownames")
)

#' Convert Row Names to an Explicit Column
#'
#' @param x A [`data.frame`].
#' @param after A length-one [`numeric`] vector specifying a subscript,
#' after which the row names are to be appended.
#' @param var A [`character`] string giving the name of column to use for row
#' names.
#' @param remove A [`logical`] scalar: should the row names be removed?
#' @param ... Currently not used.
#' @example inst/examples/ex-assign.R
#' @return A [`data.frame`].
#' @author N. Frerebeau
#' @docType methods
#' @family data preparation tools
#' @name append
#' @rdname append
NULL

#' @rdname append
#' @aliases append_rownames-method
setGeneric(
name = "append_rownames",
def = function(x, ...) standardGeneric("append_rownames")
)

# Data cleaning ================================================================
## NA --------------------------------------------------------------------------
#' Tools for Working With Missing Values
#'
#' @description
Expand Down Expand Up @@ -178,7 +237,7 @@ setGeneric(
def = function(x, ...) standardGeneric("replace_NA")
)

### Inf -------------------------------------------------------------------------
## Inf -------------------------------------------------------------------------
#' Tools for Working With Infinite Values
#'
#' @description
Expand Down Expand Up @@ -211,7 +270,7 @@ setGeneric(
def = function(x, ...) standardGeneric("replace_Inf")
)

### Zeros -----------------------------------------------------------------------
## Zeros -----------------------------------------------------------------------
#' Tools for Working With Zeros
#'
#' @description
Expand Down Expand Up @@ -244,7 +303,7 @@ setGeneric(
def = function(x, ...) standardGeneric("replace_zero")
)

### Empty string ---------------------------------------------------------------
## Empty string ----------------------------------------------------------------
#' Tools for Working With Empty String
#'
#' @description
Expand Down Expand Up @@ -277,7 +336,7 @@ setGeneric(
def = function(x, ...) standardGeneric("replace_empty")
)

### Constant -------------------------------------------------------------------
## Constant --------------------------------------------------------------------
#' Remove Constant Columns
#'
#' @param x An \R object (should be a [`matrix`] or a [`data.frame`]).
Expand All @@ -297,65 +356,6 @@ setGeneric(
)

# Data transformation ==========================================================
## Assign ----------------------------------------------------------------------
#' Assign a Specific Row/Column to the Column/Row Names
#'
#'
#' @param x A [`data.frame`].
#' @param row A length-one [`numeric`] vector specifying the row number that is
#' to become the column names.
#' @param column A length-one [`numeric`] vector specifying the column number
#' that is to become the row names.
#' @param remove A [`logical`] scalar: should the specified row/column be removed
#' after making it the column/row names?
#' @param ... Currently not used.
#' @example inst/examples/ex-assign.R
#' @return A [`data.frame`].
#' @author N. Frerebeau
#' @docType methods
#' @family transformation tools
#' @name assign
#' @rdname assign
NULL

#' @rdname assign
#' @aliases assign_colnames-method
setGeneric(
name = "assign_colnames",
def = function(x, ...) standardGeneric("assign_colnames")
)

#' @rdname assign
#' @aliases assign_rownames-method
setGeneric(
name = "assign_rownames",
def = function(x, ...) standardGeneric("assign_rownames")
)

#' Convert Row Names to an Explicit Column
#'
#' @param x A [`data.frame`].
#' @param after A length-one [`numeric`] vector specifying a subscript,
#' after which the row names are to be appended.
#' @param var A [`character`] string giving the name of column to use for row
#' names.
#' @param remove A [`logical`] scalar: should the row names be removed?
#' @param ... Currently not used.
#' @example inst/examples/ex-assign.R
#' @return A [`data.frame`].
#' @author N. Frerebeau
#' @docType methods
#' @family transformation tools
#' @name append
#' @rdname append
NULL

#' @rdname append
#' @aliases append_rownames-method
setGeneric(
name = "append_rownames",
def = function(x, ...) standardGeneric("append_rownames")
)

# Mathematics ==================================================================
#' Least Common Multiple
Expand Down Expand Up @@ -506,6 +506,7 @@ setGeneric(
def = function(object, ...) standardGeneric("confidence_multinomial")
)

# Resampling ===================================================================
## Bootstrap -------------------------------------------------------------------
#' Bootstrap Estimation
#'
Expand Down
17 changes: 1 addition & 16 deletions R/scale.R → R/palettes.R
Original file line number Diff line number Diff line change
@@ -1,19 +1,4 @@
# SCALE
NULL

#' Rescale Continuous Vector
#'
#' Rescales continuous vector to have specified minimum and maximum.
#' @param x A [`numeric`] vector.
#' @param to A length-two [`numeric`] vector specifying the output range.
#' @param from A length-two [`numeric`] vector specifying the input range.
#' @note For internal use only.
#' @return A [`numeric`] vector.
#' @family scales
#' @export
scale_range <- function(x, to = c(0, 1), from = range(x, finite = TRUE)) {
(x - from[1L]) / diff(from) * diff(to) + to[1L]
}
# PALETTES

#' Color Mapping
#'
Expand Down
16 changes: 16 additions & 0 deletions R/transform.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# DATA TRANSFORMATION
NULL

#' Rescale Continuous Vector
#'
#' Rescales continuous vector to have specified minimum and maximum.
#' @param x A [`numeric`] vector.
#' @param to A length-two [`numeric`] vector specifying the output range.
#' @param from A length-two [`numeric`] vector specifying the input range.
#' @note For internal use only.
#' @return A [`numeric`] vector.
#' @family data transformation tools
#' @export
scale_range <- function(x, to = c(0, 1), from = range(x, finite = TRUE)) {
(x - from[1L]) / diff(from) * diff(to) + to[1L]
}
11 changes: 8 additions & 3 deletions man/append.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion man/arkhe-package.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 8 additions & 3 deletions man/assign.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 5 additions & 8 deletions man/compact.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 5 additions & 8 deletions man/count.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 105f4ba

Please sign in to comment.