## Utils
## Infix operator (null-default)
`%||%` <- purrr::`%||%`
#' re-export magrittr pipe operator
#'
#' @importFrom magrittr %>%
#' @name %>%
#' @rdname pipe
#' @export
NULL
## From tidyverse package
text_col <- function(x) {
# If RStudio not available, messages already printed in black
if (!rstudioapi::isAvailable()) {
return(x)
}
if (!rstudioapi::hasFun("getThemeInfo")) {
return(x)
}
theme <- rstudioapi::getThemeInfo()
if (isTRUE(theme$dark)) crayon::white(x) else crayon::black(x)
}
rlm_version <- function(x) {
version <- as.character(unclass(utils::packageVersion(x))[[1]])
crayon::italic(paste0(version, collapse = "."))
}
search_conflicts <- function(path = search()){
## Search for conflicts
confs <- conflicts(path,TRUE)
## Grab those with the rlm package
rlm_conflicts <- confs$`package:rlm`
## Find which packages have those functions that are conflicted
if (length(rlm_conflicts) != 0){
other_conflicts <- list()
for (i in rlm_conflicts){
other_conflicts[[i]] <- lapply(confs, function(x) any(grepl(i, x))) %>%
do.call("rbind", .) %>%
data.frame %>%
setNames(c("conflicted")) %>%
tibble::rownames_to_column() %>%
.[.$conflicted == TRUE &
.$rowname != "package:rlm",]
}
} else {
other_conflicts <- data.frame()
}
other_conflicts
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.