Hi,
Let's create the xxx object just to avoid confusion even if it's not
necessary
for reproducing the problem below:
xxx <- 8:3
If I start typing this:
max(xxx[
and now try to autocomplete with <TAB>, then I get the following error
(and a warning):
> max(xxx[Error in grep(sprintf("^%s", makeRegexpSafe(text)),
allArgs, value = TRUE) :
invalid regular expression '^xxx['
In addition: Warning message:
In grep(sprintf("^%s", makeRegexpSafe(text)), allArgs, value =
TRUE) :
regcomp error: 'Invalid regular expression'
Now it seems that this problem in R has managed to screw up something out of R
(and
this is probably OS dependent, I'm running 64-bit openSUSE 10.3) because
when I quit
R and try to do something at the shell level, what I type is not echoed anymore
in
the terminal window. For example if I type 'whoami' followed by
<Enter>, here is what
I get on the screen (only the output of the command is displayed but not the
command
itself):
hpages at gopher3:~> hpages
I've tried this with other R versions (2.6.1, 2.6.2) on other Linux flavors
(64-bit
openSUSE 10.1, 32-bit openSUSE 10.3, 32-bit Ubuntu 6.06) and got almost the same
thing,
the only difference being that with older versions of R (e.g. with 2.7.0 from
2007-12-09
r43632), I get the error message but no additional warning.
Cheers,
H.
> sessionInfo()
R version 2.7.0 beta (2008-04-07 r45159)
x86_64-unknown-linux-gnu
locale:
LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=en_US.UTF-8;LC_COLLATE=en_US.UTF-8;LC_MONETARY=C;LC_MESSAGES=en_US.UTF-8;LC_PAPER=en_US.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US.UTF-8;LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
On 4/9/08, Herve Pages <hpages at fhcrc.org> wrote:> Hi, > > Let's create the xxx object just to avoid confusion even if it's not necessary > for reproducing the problem below: > > xxx <- 8:3 > > If I start typing this: > > max(xxx[ > > and now try to autocomplete with <TAB>, then I get the following error (and a warning): > > > max(xxx[Error in grep(sprintf("^%s", makeRegexpSafe(text)), allArgs, value = TRUE) : > invalid regular expression '^xxx[' > In addition: Warning message: > In grep(sprintf("^%s", makeRegexpSafe(text)), allArgs, value = TRUE) : > regcomp error: 'Invalid regular expression'Thanks for the report, makeRegexpSafe was not escaping "[". Does the following workaround fix the problem (without introducing additional ones)? assignInNamespace("makeRegexpSafe", ns = "utils", value = function(s) { s <- gsub(".", "\\.", s, fixed = TRUE) s <- gsub("?", "\\?", s, fixed = TRUE) s <- gsub("[", "\\[", s, fixed = TRUE) s <- gsub("]", "\\]", s, fixed = TRUE) # necessary? s }) (with 2.6.x, replace "utils" with "rcompgen") -Deepayan
Herve Pages wrote:> Hi, > > Let's create the xxx object just to avoid confusion even if it's not necessary > for reproducing the problem below: > > xxx <- 8:3 > > If I start typing this: > > max(xxx[ > > and now try to autocomplete with <TAB>, then I get the following error (and a warning): > > > max(xxx[Error in grep(sprintf("^%s", makeRegexpSafe(text)), allArgs, value = TRUE) : > invalid regular expression '^xxx[' > In addition: Warning message: > In grep(sprintf("^%s", makeRegexpSafe(text)), allArgs, value = TRUE) : > regcomp error: 'Invalid regular expression' > >Hmm, looks like makeRegexpSafe(text)) isn't. Presumably, it should escape [ along with . and ?> Now it seems that this problem in R has managed to screw up something out of R (and > this is probably OS dependent, I'm running 64-bit openSUSE 10.3) because when I quit > R and try to do something at the shell level, what I type is not echoed anymore in > the terminal window.Yes it happens occasionally (not just with R) that you come back to the shell level with tty settings out of whack. The pragmatic fix is to blind-type the command stty sane followed by <Enter> (or ctrl-J if you are paranoid).> For example if I type 'whoami' followed by <Enter>, here is what > I get on the screen (only the output of the command is displayed but not the command > itself): > > hpages at gopher3:~> hpages > > I've tried this with other R versions (2.6.1, 2.6.2) on other Linux flavors (64-bit > openSUSE 10.1, 32-bit openSUSE 10.3, 32-bit Ubuntu 6.06) and got almost the same thing, > the only difference being that with older versions of R (e.g. with 2.7.0 from 2007-12-09 > r43632), I get the error message but no additional warning. > > Cheers, > H. > > > > sessionInfo() > R version 2.7.0 beta (2008-04-07 r45159) > x86_64-unknown-linux-gnu > > locale: > LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=en_US.UTF-8;LC_COLLATE=en_US.UTF-8;LC_MONETARY=C;LC_MESSAGES=en_US.UTF-8;LC_PAPER=en_US.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US.UTF-8;LC_IDENTIFICATION=C > > attached base packages: > [1] stats graphics grDevices utils datasets methods base > > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel >-- O__ ---- Peter Dalgaard ?ster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907