Re: [R] regexpr: R takes very long with non-existent pattern

2022-05-18 Thread Leonard Mada via R-help
Dear Bert, The variable patt does not exist in the R environment. I was pasting the code for an R function in the R console and I had a syntax error on a line. But the next lines executed simply as simple R code. The variable patt was not previously defined. Though x was a different object

Re: [R] regexpr: R takes very long with non-existent pattern

2022-05-18 Thread Leonard Mada via R-help
Dear Andrew, I screwed it a little bit up. The object was not a string vector, but an xml object (the original xml with the abstracts). str(x) List of 2  $ node:  $ doc :  - attr(*, "class")= chr [1:2] "xml_document" "xml_node" i pasted the R code for a function but had an error, which stop

[R] regexpr: R takes very long with non-existent pattern

2022-05-18 Thread Leonard Mada via R-help
Dear R Users, I have run the following command in R: # x = larger vector of strings (1200 Pubmed abstracts); # patt = not defined; npos = regexpr(patt, x, perl=TRUE); # Error in regexpr(patt, x, perl = TRUE) : object 'patt' not found The problem: R becomes unresponsive and it takes 1-2 minut