[R] Wikibooks

Duncan Murdoch murdoch at stats.uwo.ca
Fri Mar 30 15:27:43 CEST 2007


On 3/30/2007 9:16 AM, Alberto Monteiro wrote:
> Romain Francois wrote:
>>
>>> Say I don't know (and I can't understand the help) how to
>>> use the rnorm function. If I do RSiteSearch("rnorm"), I
>>> will get too much useless information. OTOH, an ideal wikipedia
>>> would have a page http://www.r-wiki.org/rnorm, where I could
>>> find examples, learn the theory, browse the source code, and 
>>> have links to similar functions. OK, maybe that's too much, I
>>> would be happy just to have some examples :-)
>> 
>> Do you mean something like (it fullfills basically all your 
>> requirements) :
>> 
>> R> rnorm     # get the code
>> R> ?rnorm   # get the help page
>>
> This works when there's a decent documentation for the function.
> The functions in the tcltk package, for example, are horribly
> undocumented, and asking for help only loops to a general
> help about all (and none) of the functions.

I don't remember if you've said which platform you're working on, but if 
you're on Windows, the TCL/TK documentation is available to you.  It's 
in RHOME/Tcl/doc.  This is mentioned in the ?tcltk R help topic.

I believe most Unix-like systems with TCL/TK support installed would 
have the same documentation available, but I don't know where.

That documentation assumes you're using a TCL interpreter rather than R, 
so the syntax is all wrong, but there's a mechanical translation from it 
to R syntax which is described in the ?TkCommands R help topic.

So these functions may be horribly documented, but they're not horribly 
undocumented.

Duncan Murdoch

>  
>> The wiki already has a similar thing, for example for rnorm, you can 
>> go to: http://wiki.r-project.org/rwiki/doku.php?id=rdoc:stats:Normal
>> 
> I didn't like the way it worked. I searched for rnorm and Norm,
> and I got a list of pages. Even for this trivial example, I
> have no idea how I could find anything using the Search.
> 
>> There has been (recently and less recently) some discussions on the
>> r-sig-wiki list about why sometimes you get ~~RDOC~~ instead of the
>> documentation page, it is still a work in progress.
>> 
>> The only tricky bit is how do I know that I have to go to 
>> stats:normal, well you can ask that to R, for example using that 
>> small function :
>> 
>> wikiHelp <- function( ... , sarcasm = TRUE ){
>>     if(  length(hp <- help(...) ) > 0 ){
>>       hp <- tail( strsplit(hp[1], "/")[[1]], 3 )
>>       wikiPage <-
>> sprintf("http://wiki.r-project.org/rwiki/doku.php?id=rdoc:%s:%s",
>> hp[1],  hp[3])
>>        cat("the following wiki page will be displayed in your 
>> browser:",             wikiPage,             ">>>     Please feel 
>> free to add information if you have some, " , sep = "\n")      if( 
>> sarcasm) cat( ">>>     except if you are an evil person\n")      
>>  browseURL(wikiPage)    } else print( hp )  }
>> 
> Nice code :-)
> 
> R> wikiHelp( rnorm )
> 
> ~~RDOC~~ # what is this?
> 
> R> wikiHelp( tkWidgets )
> 
> No documentation for 'tkWidgets' in specified packages and libraries:
> you could try 'help.search("tkWidgets")'
> 
> R> wikiHelp( seq )
> 
> Here it worked as expected.
> 
>> 
>> The wiki has its own search engine already, so you can go there
>> and use it. I guess you can search for "search" there and get
>> info on how to search.
>>
> :-)))))))))))))))))))))
> 
> Or I could ask help(help) to learn how help works :-P
> 
> Alberto Monteiro
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list