2023-09-05 19:08:26 +02:00
|
|
|
% 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{
|
2024-10-10 14:13:16 +02:00
|
|
|
DEPRECATION: moved to \code{agdamsbo/project.aid}
|
|
|
|
}
|
|
|
|
\details{
|
2023-09-05 19:08:26 +02:00
|
|
|
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]+)")
|
|
|
|
}
|