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

Martin Maechler maechler at stat.math.ethz.ch
Mon Jun 22 10:03:34 CEST 1998


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 <gordon.harrington at uni.edu> writes:

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

    gordon> demo(graphics) stops at:
	
    >> data("iris")
    gordon> Error in sub(pattern, replacement, x, ignore.case, 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:

		http://people.delphi.com/gjc/winregex.html

	or the GNU versions

		regex-?.??.tar.gz
		rx-?.?.tar.gz 

	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()
		      (optional)

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 <maechler at stat.math.ethz.ch>			<><
Seminar fuer Statistik, ETH-Zentrum SOL G1;	Sonneggstr.33
ETH (Federal Inst. Technology)	8092 Zurich	SWITZERLAND
phone: x-41-1-632-3408		fax: ...-1086
http://www.stat.math.ethz.ch/~maechler/
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list