#' @title Adding or Removing Classes
#'
#' @description Add or remove R classes in a pipeline-friendly way.
#'
#' @name add_rmv_class
NULL
#' @describeIn add_rmv_class add the class
#' @export
add_class <- function(x, new_class) {
assert_that(is.character(new_class))
class(x) <- union(class(x), new_class)
return(x)
}
#' @describeIn add_rmv_class remove the class
#' @export
rmv_class <- function(x, old_class) {
assert_that(is.character(old_class))
class(x) <- setdiff(class(x), old_class)
return(x)
}
#' @title
#' Remove NULLs from List
#' @export
drop_nulls <- function(x) {
x[!vapply(x, is.null, FUN.VALUE = logical(1))]
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.