[R] R Example scripts

Gene Leynes gleynes+r at gmail.com
Tue Apr 22 20:34:23 CEST 2014


Duncan,

First, thank you. It's amazing how many things R has built in... such
as these quirky functions! I really appreciate the example.

Second, as it turns out I was looking for something that doesn't exist
in bayesm, although it wasn't obvious to me until I followed your
answer and read the package web page more carefully
(http://www.perossi.org/home/bsm-1/bayesm).

I was looking for those extended examples that some packages have. For
example e1071 has a file called svn.R in the /doc folder.  Many
packages, such as formatR and hmeasure have scripts with the same name
as the package in the /doc folder. I thought (mistakenly) that those
extended examples had been moved / encoded.

For anyone searching for "bayesm examples" you may find this link
helpful, because it does have some examples and more info about the
book by Peter Rossi:
http://www.perossi.org/home/bsm-1


On Sat, Apr 19, 2014 at 6:12 AM, Duncan Murdoch
<murdoch.duncan at gmail.com> wrote:
> On 18/04/2014, 6:07 PM, Gene Leynes wrote:
>>
>> A few years ago R changed the way help was handled so that the HTML
>> files are no longer available in the library directory.  Around that
>> time the R example files that used to be in some of the libraries also
>> vanished.
>>
>> I'm wondering where the "r-ex" folder went. Is it totally unsupported
>> and gone? Is it hidden in the mysterious rdx or rdb files?
>
>
> The source for the examples will be in the \examples{} section of the .Rd
> source file -- that didn't change.  What changed was how the source is
> processed.  The files are now parsed into a binary format that is stored in
> the database files.
>
> You can extract the examples from the source file using the tools::Rd2ex
> function.  You can extract them from the binary database using this function
> on an Rd object, which is obtainable using the internal function
> .getHelpFile.
>
> So for example, to see the code for the example for rwishart, you could do
>
> tools::Rd2ex(".../bayesm/man/rwishart.Rd")
>
> if you have the source file installed there, or
>
> library(bayesm)
> Rd <- utils:::.getHelpFile(?rwishart)
> tools::Rd2ex(Rd)
>
> if you have the package installed.
>
> Duncan Murdoch
>>
>>
>> In particular I'm looking for the latest example scripts in the baysem
>> package. I don't see them in the source code or the installed library.
>>
>> ______________________________________________
>> R-help at r-project.org 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