Dear Bert,
Thank you for the suggestion. Indeed, there are various solutions and
workarounds. However, there is still a bug in strsplit.
2.) gsub
I would try to avoid gsub on a Wikipedia-sized corpus: using strsplit
directly should be far more efficient.
3.) Punctuation marks
Abbreviations and
Primarily for my own amusement, here is a way to do what I think you wanted
without look-aheads/behinds
strsplit(gsub("([[:punct:]])"," \\1 ","a bc,def, adef,x; ,,gh"), " +")
[[1]]
[1] "a""bc" ",""def" ",""adef" ",""x"";"
[10] ","",""gh"
I certainly would *not* cla
Dear Avi,
Punctuation marks are used in various NLP language models. Preserving
the "," is therefore useful in such scenarios and Regex are useful to
accomplish this (especially if you have sufficient experience with such
expressions).
I observed only an odd behaviour using strsplit: the exa
Leonard,
It can be helpful to spell out your intent in English or some of us have to go
back to the documentation to remember what some of the operators do.
Your text being searched seems to be an example of items between comas with an
optional space after some commas and in one case, nothing b
Dear Bill,
Indeed, there are other cases as well - as documented.
Various Regex sites give the warning to avoid the legacy syntax
"[[:<:]]", so this is the alternative syntax:
strsplit(split="\\b(?=\\w)", "One, two; three!", perl=TRUE)
# "O" "n" "e" ", " "t" "w" "o" "; " "t" "h" "r" "
> Bill Dunlap on Fri, 5 May 2023 08:19:21 -0700 writes:
https://bugs.r-project.org/show_bug.cgi?id=16745 (from 2016, still labelled
'UNCONFIRMED") contains some other examples of strsplit misbehaving when
using 0-length perl look-behinds. E.g.,
Thank you, Bill -- yes, uhmm, ...
https://bugs.r-project.org/show_bug.cgi?id=16745 (from 2016, still labelled
'UNCONFIRMED") contains some other examples of strsplit misbehaving when
using 0-length perl look-behinds. E.g.,
> strsplit(split="[[:<:]]", "One, two; three!", perl=TRUE)[[1]]
[1] "O" "n" "e" ", " "t" "w" "o" "; "
在 5/5/23 21:08, Duncan Murdoch 写道:
On 05/05/2023 7:41 a.m., Jiayue Wang wrote:
在 5/5/23 19:15, Duncan Murdoch 写道:
On 05/05/2023 6:48 a.m., Jiayue Wang wrote:
Thanks Duncan. glxgears works at the terminal; tcltk::tktoplevel()
outputs the following:
$ID
[1] ".1"
$env
attr(,"class")
[1]
On 05/05/2023 7:41 a.m., Jiayue Wang wrote:
在 5/5/23 19:15, Duncan Murdoch 写道:
On 05/05/2023 6:48 a.m., Jiayue Wang wrote:
Thanks Duncan. glxgears works at the terminal; tcltk::tktoplevel()
outputs the following:
$ID
[1] ".1"
$env
attr(,"class")
[1] "tkwin"
Jiayue
But no window opens f
在 5/5/23 19:15, Duncan Murdoch 写道:
On 05/05/2023 6:48 a.m., Jiayue Wang wrote:
Thanks Duncan. glxgears works at the terminal; tcltk::tktoplevel()
outputs the following:
$ID
[1] ".1"
$env
attr(,"class")
[1] "tkwin"
Jiayue
But no window opens for tcltk::tktoplevel()? Sounds like R isn't
On 05/05/2023 6:48 a.m., Jiayue Wang wrote:
Thanks Duncan. glxgears works at the terminal; tcltk::tktoplevel()
outputs the following:
$ID
[1] ".1"
$env
attr(,"class")
[1] "tkwin"
Jiayue
But no window opens for tcltk::tktoplevel()? Sounds like R isn't seeing
your DISPLAY variable. Does S
If you only want the character strings, this seems a little simpler:
> strsplit("a bc,def, adef ,,gh", "[ ,]+", perl=T)
[[1]]
[1] "a""bc" "def" "adef" "gh"
If you need delimeters (the commas) you could then add them back in again
afterwards.
Tim
--
Messag
Thanks Duncan. glxgears works at the terminal; tcltk::tktoplevel()
outputs the following:
$ID
[1] ".1"
$env
attr(,"class")
[1] "tkwin"
Jiayue
在 5/5/23 16:45, Duncan Murdoch 写道:
On 05/05/2023 2:24 a.m., Jiayue Wang wrote:
Hi
I can't get rgl working. I installed rgl, loaded it, but it seem
On Thu, 4 May 2023 23:59:33 +0300
Leonard Mada via R-help wrote:
> strsplit("a bc,def, adef ,,gh", " |(?=,)|(?<=,)(?![ ])", perl=T)
> # "a" "bc" "," "def" "," "" "adef" "," "," "gh"
>
> strsplit("a bc,def, adef ,,gh", " |(? # "a" "bc" "," "def" "," "" "adef" ",
On 05/05/2023 2:24 a.m., Jiayue Wang wrote:
Hi
I can't get rgl working. I installed rgl, loaded it, but it seems all
plot3d codes have failed:
remotes::install_github("dmurdoch/rgl")
library(rgl)
open3d()
x <- sort(rnorm(1000))
y <- rnorm(1000)
z <- rnorm(1000) + atan2(x, y)
plot3d(x, y, z, col
15 matches
Mail list logo