mirror of
https://github.com/agdamsbo/stRoke.git
synced 2024-11-24 13:41:55 +01:00
27 lines
616 B
Plaintext
27 lines
616 B
Plaintext
|
% Generated by roxygen2: do not edit by hand
|
||
|
% Please edit documentation in R/str_extract.R
|
||
|
\name{str_extract}
|
||
|
\alias{str_extract}
|
||
|
\title{Extract string based on regex pattern}
|
||
|
\usage{
|
||
|
str_extract(d, pattern)
|
||
|
}
|
||
|
\arguments{
|
||
|
\item{d}{vector of character strings}
|
||
|
|
||
|
\item{pattern}{regex pattern to match}
|
||
|
}
|
||
|
\value{
|
||
|
vector of character strings
|
||
|
}
|
||
|
\description{
|
||
|
Use base::strsplit to
|
||
|
}
|
||
|
\examples{
|
||
|
ls <- do.call(c,lapply(sample(4:8,20,TRUE),function(i){
|
||
|
paste(sample(letters,i,TRUE),collapse = "")}))
|
||
|
ds <- do.call(c,lapply(1:20,function(i){
|
||
|
paste(sample(ls,1),i,sample(ls,1),"23",sep = "_")}))
|
||
|
str_extract(ds,"([0-9]+)")
|
||
|
}
|