File: str_sub_replace.Rd

package info (click to toggle)
r-cran-stringr 0.6.0-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 304 kB
  • sloc: makefile: 3
file content (40 lines) | stat: -rw-r--r-- 1,113 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
\name{str_sub_replace}
\alias{str_sub_replace}
\alias{str_sub<-}
\title{Replace substrings in a character vector.
\code{str_sub<-} will recycle all arguments to be the same length as the
longest argument.}
\usage{
  str_sub(string, start = 1L, end = -1L) <- value
}
\arguments{
  \item{string}{input character vector.}

  \item{start}{integer vector giving position of first
  charater in substring, defaults to first character. If
  negative, counts backwards from last character.}

  \item{end}{integer vector giving position of last
  character in substring, defaults to last character. If
  negative, counts backwards from last character.}

  \item{value}{replacement string}
}
\value{
  character vector of substring from \code{start} to
  \code{end} (inclusive). Will be length of longest input
  argument.
}
\description{
  Replace substrings in a character vector.
  \code{str_sub<-} will recycle all arguments to be the
  same length as the longest argument.
}
\examples{
x <- "BBCDEF"
str_sub(x, 1, 1) <- "A"; x
str_sub(x, -1, -1) <- "K"; x
str_sub(x, -2, -2) <- "GHIJ"; x
str_sub(x, 2, -2) <- ""; x
}