Re: R-beta: data(foo) - Error in sub(... --- need "r[ege]x[p]" library

Martin Maechler (
Mon, 22 Jun 1998 10:03:34 +0200

Date: Mon, 22 Jun 1998 10:03:34 +0200
Message-Id: <>
From: Martin Maechler <>
Subject: Re: R-beta: data(foo) - Error in sub(... --- need "r[ege]x[p]" library

Prof. Harrington, 
I cannot see your problem, i.e.,   data(iris) ... works just fine,

even though I use SPARC Solaris 2.x (2.5, not 2.4) as well.

>>>>> "gordon" == gordon harrington <> writes:

    gordon> R-0.62.1 sparc-sun-solaris2.4:

    gordon> demo(graphics) stops at:
    >> data("iris")
    gordon> Error in sub(pattern, replacement, x,, extended) :
    gordon> invalid regular expression

    gordon> .....

Can you try these two examples?

  > sub("a","AA", "a cat in the hat")
  [1] "AA cat in the hat"
  > gsub("a","AA", "a cat in the hat")
  [1] "AA cAAt in the hAAt"

If they fail as well, it'll mean that during R installation,
the "./configure" script couldn't find a proper
 ``regular expression library''.

RHOME/src/regex/README  says

	If you are looking for a regex library try:

	or the GNU versions


	which are available at all GNU mirrors.

When you run ./configure
you should get a line

checking for regcomp... (cached) yes
			^^^^^^^^ ===  <<<< you need this for  sub(), gsub()

Yes, it is both true that

1) RHOME/INSTALL   should definitely help you figure out the above

2) Maybe we (R developers) should have been more cautious in using
   [g]sub() in such important places  as help() and data().

I even think we should consider (slower) versions of  these [data(), help()]
in case there's no 'regex' (regular expression) library found.

Martin Maechler <>			<><
Seminar fuer Statistik, ETH-Zentrum SOL G1;	Sonneggstr.33
ETH (Federal Inst. Technology)	8092 Zurich	SWITZERLAND
phone: x-41-1-632-3408		fax: ...-1086
r-help mailing list -- Read
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: