[R] how to create help files

Fri Dec 29 12:46:00 CET 2000

Dear R users,

this is a question for R version 1.2.0 under Windows NT 4.0, regarding the
documentation of ones own functions.
I have ceated a private library for my functions, which works all very well,
apart from that I am not able to create appropriate help files.

For illustration, here is a simple example of where I'm stuck:

> # first, create a simple function f1:
> f1 <- function(x) x^2
> # create directories where a package called "testfunctions" with my own
functions will live:
> R.home()
[1] "D:\\Programme\\R\\rw1020"
> mypath <- paste(R.home(),"\\library\\testfunctions", sep="")
> mypath
[1] "D:\\Programme\\R\\rw1020\\library\\testfunctions"
> dir.create(mypath)
> dir.create(paste(mypath, "\\R", sep=""))
> # dump the function into file "testfunctions"
> dump("f1", file = paste(mypath, "\\R\\testfunctions", sep=""))
> # very well, now let's try to add documentation:
> dir.create(paste(mypath, "\\help", sep=""))
> prompt(f1, file = paste(mypath, "\\help\\f1", sep=""))
created file named  D:\Programme\R\rw1020\library\testfunctions\help\f1  in
the current directory.
  Edit the file and move it to the appropriate directory,
> # let's see if it works:
> rm(f1)
> library(testfunctions)
> find(f1)
[1] "package:testfunctions"
> f1(3)
[1] 9
> # very well so far!
> # now, what about the documentation:
> help(f1)
Error in help(f1) : No documentation for `f1' in specified packages and

And that's where I'm stuck. Not that it comes as a surprise to me that this
doesn't work. I do have the "Writing R extensions" manual right here in
front of me, and I have read "readme.packages", but I have to admit that I
am a bit lost in the documentation. I do have installed "rw1020sp.zip", I
have downloaded "http://www.stats.ox.ac.uk/pub/Rtools/tools.zip", and I
guess I have to use  those MAKE, INSTALL, RCMD etc. facilities in an
appropriate way. But I just can't put the pieces together. (Please note that
I don't need to build a "professional" package at the moment (with
description files and all that stuff)).

If someone could point out how to procede in my simple example and how to
make "help(f1)" work, it would be easier for me to figure out how to do
these things generally. Maybe something like "Open a WindowsNT command
window, got to directory xyz, and run the command(s) abc, ..."?

Best wishes for 2001,

Heinrich Rinner.
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