[R] Newbie: Examples on functions callling a library etc.
Eduardo M. A. M.Mendes
emammendes at gmail.com
Fri Aug 29 10:48:07 CEST 2008
Hi
Many thanks. I got another post to this list that gives an example of what
I need exactly, that is, require and ::
Cheers
Ed
-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On
Behalf Of Ben Bolker
Sent: Thursday, August 28, 2008 11:44 PM
To: r-help at stat.math.ethz.ch
Subject: Re: [R] Newbie: Examples on functions callling a library etc.
Eduardo M. A. M.Mendes <emammendes <at> gmail.com> writes:
> R is pretty new to me. I need to write a function that returns three
> matrices of different dimensions. In addition, I need to call a function
> from a contributed package with the function. I have browsed several
> manuals and docs but the examples on them are either very simple or
> extremely hard to follow.
>
> Many thanks
>
> Ed
>
I think you need to try to specify your needs a little bit
more carefully. Here is a function that technically meets
your needs:
library("example_pkg") ## to load the contributed package
myfunction <- function() { ## function with no arguments
foo() ## assuming the function "foo" is in the package
list(matrix(nrow=2,ncol=2),matrix(nrow=3,ncol=3),matrix(nrow=4,ncol=4)
}
But I suspect that doesn't really do what you need ...
Ben Bolker
______________________________________________
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