# =============================================================================
# Base R operators ------------------------------------------------------------
# =============================================================================
#' Insert %*%
#'
#' Call this function as an add-in to insert `%*%` at the cursor position.
#'
#' @inheritParams addin.tools::rs_get_index
#'
#' @export
#' @seealso Operator [%*%][base::%*%] for matrix multiplication.
#'
#' @family 'Insert at cursor position' add-ins
rs_insert_matrix_multiplication <- function(context = rs_get_context()) {
# rstudioapi::insertText(text = " %*% ")
rs_insert_text(text = "%*%", context = context, spaces = TRUE)
}
#' Insert %/%
#'
#' @description Call this function as an add-in to insert `%/% ` at the cursor position.
#'
#' @inheritParams addin.tools::rs_get_index
#' @export
#' @seealso Operator [%/%][base::%/%].
#'
#' @family 'Insert at cursor position' add-ins
rs_insert_integer_division <- function(context = rs_get_context()) {
rs_insert_text(text = "%/%", context = context, spaces = TRUE)
}
#' Insert %%
#'
#' Call this function as an add-in to insert `%%` at the cursor position.
#'
#' @note Operator does not work unless package which contains this operator is loaded.
#'
#' @inheritParams addin.tools::rs_get_index
#'
#' @export
#'
#' @family 'Insert at cursor position' add-ins
#'
rs_insert_modulo <- function(context = rs_get_context()) {
rs_insert_text(text = "%%", context = context, spaces = TRUE)
}
#' Insert %in%
#'
#' @description Call this function as an add-in to insert `%in%` at the cursor position.
#'
#' @inheritParams addin.tools::rs_get_index
#' @export
#' @seealso Operator [%in%][base::%in%].
#'
#' @family 'Insert at cursor position' add-ins
rs_insert_infix_in <- function(context = rs_get_context()) {
rs_insert_text(text = "%in%", context = context, spaces = TRUE)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.