[R] splitstr problem

Thomas Lumley thomas at biostat.washington.edu
Mon Feb 21 19:54:24 CET 2000

On Mon, 21 Feb 2000, Christian Hoffmann wrote:

> Hi all,
> In my  "\R-0.65.1/src/library/base/man/"   I can only find "strsplit.Rd" giving the help to strsplit, but no "strsplit"  itself.
> Can anybody tell me how to retrieve "strsplit" itself? (as R/S-Plus program)

Well, if you type the name of any function it will list itself
   > strsplit
   function (x, split)
   .Internal(strsplit(as.character(x), as.character(split)))

and you will see that this isn't very helpful.  The function is written in
C and is part of the internal compiled code.

Now, to find the C code you need to look somewhere in the subdirectories
of src/, probably in src/main. This means that you need the source, not
just a compiled version.

You can look in src/main/names.c to see what the C function is called

On Unix this is done with grep
  % cd src/main
  % fgrep strsplit names.c
   {"strsplit",    do_strsplit,    1,      11,     2,      PP_FUNCALL},
on Windows you can probably use 'Find file'

and you find that it is called do_strsplit, which is the usual naming

Now a similar search for do_strsplit shows that it is declared in
character.c, and looking in character.c reveals the function.


Thomas Lumley
Assistant Professor, Biostatistics
University of Washington, Seattle

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