File: stri_join_list.Rd

package info (click to toggle)
r-cran-stringi 1.7.12-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 39,772 kB
  • sloc: cpp: 482,349; ansic: 51,900; perl: 471; makefile: 9; sh: 1
file content (82 lines) | stat: -rw-r--r-- 2,217 bytes parent folder | download | duplicates (2)
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/join.R
\name{stri_join_list}
\alias{stri_join_list}
\alias{stri_c_list}
\alias{stri_paste_list}
\title{Concatenate Strings in a List}
\usage{
stri_join_list(x, sep = "", collapse = NULL)

stri_c_list(x, sep = "", collapse = NULL)

stri_paste_list(x, sep = "", collapse = NULL)
}
\arguments{
\item{x}{a list consisting of character vectors}

\item{sep}{a single string; separates strings in each of the character
vectors in \code{x}}

\item{collapse}{a single string or \code{NULL}; an optional
results separator}
}
\value{
Returns a character vector.
}
\description{
These functions concatenate all the strings in each character vector
in a given list.
\code{stri_c_list} and \code{stri_paste_list} are aliases for
\code{stri_join_list}.
}
\details{
Unless \code{collapse} is \code{NULL}, the result will be a single string.
Otherwise, you get a character vector of length equal
to the length of \code{x}.

Vectors in \code{x} of length 0 are silently ignored.

If \code{collapse} or \code{sep} has length greater than 1,
then only the first string will be used.
}
\examples{
stri_join_list(
   stri_extract_all_words(c('Lorem ipsum dolor sit amet.',
   'Spam spam bacon sausage and spam.')),
sep=', ')

stri_join_list(
   stri_extract_all_words(c('Lorem ipsum dolor sit amet.',
   'Spam spam bacon sausage and spam.')),
sep=', ', collapse='. ')

stri_join_list(
   stri_extract_all_regex(
      c('spam spam bacon', '123 456', 'spam 789 sausage'), '\\\\p{L}+'
   ),
sep=',')

stri_join_list(
   stri_extract_all_regex(
      c('spam spam bacon', '123 456', 'spam 789 sausage'), '\\\\p{L}+',
      omit_no_match=TRUE
   ),
sep=',', collapse='; ')

}
\seealso{
The official online manual of \pkg{stringi} at \url{https://stringi.gagolewski.com/}

Gagolewski M., \pkg{stringi}: Fast and portable character string processing in R, \emph{Journal of Statistical Software} 103(2), 2022, 1-59, \doi{10.18637/jss.v103.i02}

Other join: 
\code{\link{\%s+\%}()},
\code{\link{stri_dup}()},
\code{\link{stri_flatten}()},
\code{\link{stri_join}()}
}
\concept{join}
\author{
\href{https://www.gagolewski.com/}{Marek Gagolewski} and other contributors
}