Displaying 4 results from an estimated 4 matches for "leucocyten".
2023 Apr 12
3
Split String in regex while Keeping Delimiter
Hello List,
?
I have a dataset consisting of strings that I want to split while saving the delimiter.
?
Some example data:
?leucocyten + gramnegatieve staven +++ grampositieve staven ++?
?leucocyten ? grampositieve coccen +?
?
I want to split the strings such that I get the following result:
c(?leucocyten +?, ??gramnegatieve staven +++?, ??grampositieve staven ++?)
c(?leucocyten ??, ?grampositieve coccen +?)
?
I have tried strspli...
2023 Apr 12
1
Split String in regex while Keeping Delimiter
On Wed, 12 Apr 2023 08:29:50 +0000
Emily Bakker <emilybakker at outlook.com> wrote:
> Some example data:
> ?leucocyten + gramnegatieve staven +++ grampositieve staven ++?
> ?leucocyten ? grampositieve coccen +?
> ?
> I want to split the strings such that I get the following result:
> c(?leucocyten +?, ??gramnegatieve staven +++?,
> ??grampositieve staven ++?)
> c(?leucocyten ??, ?grampositieve coc...
2023 Apr 12
2
Split String in regex while Keeping Delimiter
...;, dat), what="", sep="\n")
> On Apr 12, 2023, at 2:29 AM, Emily Bakker <emilybakker at outlook.com> wrote:
>
> Hello List,
>
> I have a dataset consisting of strings that I want to split while saving the delimiter.
>
> Some example data:
> ?leucocyten + gramnegatieve staven +++ grampositieve staven ++?
> ?leucocyten ? grampositieve coccen +?
>
> I want to split the strings such that I get the following result:
> c(?leucocyten +?, ?gramnegatieve staven +++?, ?grampositieve staven ++?)
> c(?leucocyten ??, ?grampositieve coccen +...
2023 Apr 13
1
Split String in regex while Keeping Delimiter
Dear Emily,
Using a look-behind solves the split problem in this case. (Note: Using
Regex is in most/many cases the simplest solution.)
str = c("leucocyten + gramnegatieve staven +++ grampositieve staven ++",
"leucocyten ? grampositieve coccen +")
tokens = strsplit(str, "(?<=[-+])\\s++", perl=TRUE)
PROBLEM
The current expression does NOT work for a different reason: the "-" is
coded using a NON-ASCII character....