Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export(check_outcomes_are_numeric)
export(check_outcomes_are_univariate)
export(check_prediction_size)
export(check_predictors_are_numeric)
export(convert_matrix)
export(create_modeling_package)
export(default_formula_blueprint)
export(default_recipe_blueprint)
Expand Down
12 changes: 12 additions & 0 deletions R/recompose.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,18 @@ recompose <- function(data, composition) {
}
}

#' Convert tibble to matrix
#'
#' @param x A tibble.
#' @param sparse Logical, denoting if result should be a sparse matrix.
#'
#' @return A matrix or dgCMatrix.
#' @export
#'
#' @examples
#' convert_matrix(mtcars, sparse = TRUE)
#'
#' convert_matrix(mtcars, sparse = FALSE)
convert_matrix <- function(x, sparse = TRUE) {
is_num <- vapply(x, is.numeric, logical(1))

Expand Down
1 change: 1 addition & 0 deletions _pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ reference:
- add_intercept_column
- weighted_table
- fct_encode_one_hot
- convert_matrix

- title: Validation
contents:
Expand Down
24 changes: 24 additions & 0 deletions man/convert_matrix.Rd

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