I'm stuck with it, so, please, any advice is welcome.
b <- str_extract_all(c('hello ringпрг','trust'), regex("[a-z]+", TRUE))
Returns a list:
List of 2
$ : chr [1:2] "hello" "ring"
$ : chr "trust"
But I want to have a vector with strings of this words for each element of vector c('hello ringпрг','trust')
such as "hello ring", "trust"
. Any other functions and packages are welcome too.
Use sapply
with paste
as in:
b<-str_extract_all(c('hello ringпрг','trust'), regex("[a-z]+", TRUE))
sapply(b, paste, collapse = " ")
## [1] "hello ring" "trust"