Skip to content

Commit

Permalink
better docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Melkiades committed Nov 28, 2023
1 parent 795176a commit 2b18a77
Show file tree
Hide file tree
Showing 9 changed files with 282 additions and 289 deletions.
372 changes: 183 additions & 189 deletions R/tt_export.R

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions R/tt_from_df.R
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
#' Create `ElementaryTable` from data.frame
#'
#' @param df data.frame.
#'
#' @return an \code{ElementaryTable} object with unnested columns corresponding to
#' \code{names(df)} and row labels corresponding to \code{row.names(df)}
#'
#' @examples
#' df_to_tt(mtcars)
#'
#' @export
df_to_tt <- function(df) {
colnms <- colnames(df)
Expand All @@ -14,5 +18,6 @@ df_to_tt <- function(df) {
rni <- if (havern) rnames[i] else ""
do.call(rrow, c(list(row.name = rni), unclass(df[i, ])))
})

ElementaryTable(kids = kids, cinfo = cinfo)
}
18 changes: 14 additions & 4 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ is_rtable <- function(x) {
is(x, "VTableTree")
}



# nocov start
## is each object in a collection from a class
are <- function(object_collection, class2) {
Expand Down Expand Up @@ -51,7 +49,6 @@ is_logical_vector_modif <- function(x, min_length = 1) {
}
# nocov end


# Shorthand for functions that take df as first parameter
.takes_df <- function(f) {
func_takes(f, "df", is_first = TRUE)
Expand Down Expand Up @@ -79,11 +76,11 @@ func_takes <- function(func, params, is_first = FALSE) {

#' Translate spl_context to Path for display in error messages
#'
#'
#' @param ctx data.frame. The `spl_context` data.frame where the error occurred
#'
#' @return A character string containing a description of the row path corresponding
#' to the `ctx`
#'
#' @export
spl_context_to_disp_path <- function(ctx) {
## this can happen in the first split in column space, but
Expand All @@ -107,3 +104,16 @@ spl_context_to_disp_path <- function(ctx) {
paste_vec <- function(vec) {
paste0('c("', paste(vec, collapse = '", "'), '")')
}

# Utility for checking if a package is installed
check_required_packages <- function(pkgs) {
for (pkgi in pkgs) {
if (!requireNamespace(pkgi)) {
stop(
"This function requires the ", pkgi, " package. ",
"Please install it if you wish to use it"
)
}
}
}

39 changes: 0 additions & 39 deletions man/as_result_df.Rd

This file was deleted.

74 changes: 74 additions & 0 deletions man/data.frame_export.Rd

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

1 change: 1 addition & 0 deletions man/df_to_tt.Rd

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

37 changes: 0 additions & 37 deletions man/path_enriched_df.Rd

This file was deleted.

17 changes: 0 additions & 17 deletions man/result_df_specs.Rd

This file was deleted.

8 changes: 5 additions & 3 deletions man/tsv_io.Rd

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

0 comments on commit 2b18a77

Please sign in to comment.