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 <miao...@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@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. ______________________________________________ R-help@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.