R/rs_insert_at_row_start.R

#' Insert text at the beginning of the row
#'
#' @param row (integer) The index of the row.
#' @param text (character) The text to add.
#'
#' @export
rs_insert_at_row_start <- function(row,
                                   text = NULL) {
    row <- row[1]
    location <- list(start = c(row, 1),
                     end   = c(row, 1))
    class(location) <- "document_range"

    rstudioapi::insertText(location = location, text = text)
}

Try the spAddins package in your browser

Any scripts or data that you put into this service are public.

spAddins documentation built on May 2, 2019, 3:04 a.m.