[R] Questions on user defined function
R. Michael Weylandt
michael.weylandt at gmail.com
Fri Mar 30 04:37:41 CEST 2012
1. It's your choice, but it's entirely possible to define multiple
functions in the same file or inline. If you want to read from a file
though, you have to do it with source().
2. Yes. This is the idea behind the package system.
In short, R is much nicer about functions than Matlab.
Michael
On Thu, Mar 29, 2012 at 10:18 PM, jpm miao <miaojpm at gmail.com> wrote:
> Hello,
>
> I am new to the construction of user defined functions in R. I do see
> the syntax of the function in many R reference but don't see the structures
> / paths issue. Two basic questions:
>
> 1. Should the function embedded in the main program? Could a function be a
> separate R file (like Matlab)?
>
> 2. Could I call the function from more than one programs?
>
> Thanks!
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> 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