#' The length of a string
#'
#' Technically this returns the number of "code points", in a string. One
#' code point usually corresponds to one character, but not always. For example,
#' an u with a umlaut might be represented as a single character or as the
#' combination a u and an umlaut.
#'
#' @inheritParams str_detect
#' @return A numeric vector giving number of characters (code points) in each
#' element of the character vector. Missing string have missing length.
#' @seealso [stringi::stri_length()] which this function wraps.
#' @export
#' @examples
#' str_length(letters)
#' str_length(NA)
#' str_length(factor("abc"))
#' str_length(c("i", "like", "programming", NA))
<- function(string) {
str_length
... }
3 .R and helpfiles
.R
files contain the functions your packge will provideDon’t code helpfiles (
.Rd
files in theman
folder) yourselfUse Roxygen syntax through the roxygen2 package
- Roxygen syntax lines begin
#'
- Roxygen syntax lines begin
To additionally use markdown syntax within roxygen syntax add the following line to your
DESCRIPTION
fileRoxygen: list(markdown = TRUE)
Your
.R
files will look something like the following, i.e., roxygen code for the helpfile for a function before the actual R code of the functionRunning
devtools::document()
will generate your.Rd
files from your.R
files