Re: [R] how to load functions from file
On 04/04/12 15:54, John Kohr wrote: Hello, I have several functions in an .R file. I try to load them with load() command but it seems is not working.. if .R is in /home/user/myfunctions.R how can i load it? is there any other way? Don't assume that you know what load means on the basis of believing that you have an intuitive understanding of this term. You haven't. Read the help for load. I.e. RTFM. You will see that the function load() could scarcely be *less* appropriate for what you are trying to do. As someone else had told, the function you need to use is source(). But how would you have found that out, without someone telling you? Ah! Now you're asking questions! The simple answer is, damned if I know. I just thrashed around for a while with help.search() and RSiteSearch(), and looked through ``An Introduction to R'' on the r-project home page. Nada. If you *know* the function is called source then you can find it. If you don't know catch 22. cheers, Rolf Turner __ 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.
Re: [R] how to load functions from file
Rolf: Google on load functions into R. A post referencing source() (from Henrik Bengtsson is the first hit. -- Bert On Wed, Apr 4, 2012 at 3:23 AM, Rolf Turner rolf.tur...@xtra.co.nz wrote: On 04/04/12 15:54, John Kohr wrote: Hello, I have several functions in an .R file. I try to load them with load() command but it seems is not working.. if .R is in /home/user/myfunctions.R how can i load it? is there any other way? Don't assume that you know what load means on the basis of believing that you have an intuitive understanding of this term. You haven't. Read the help for load. I.e. RTFM. You will see that the function load() could scarcely be *less* appropriate for what you are trying to do. As someone else had told, the function you need to use is source(). But how would you have found that out, without someone telling you? Ah! Now you're asking questions! The simple answer is, damned if I know. I just thrashed around for a while with help.search() and RSiteSearch(), and looked through ``An Introduction to R'' on the r-project home page. Nada. If you *know* the function is called source then you can find it. If you don't know catch 22. cheers, Rolf Turner __ 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. -- Bert Gunter Genentech Nonclinical Biostatistics Internal Contact Info: Phone: 467-7374 Website: http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm __ 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.
Re: [R] how to load functions from file
On 04/04/12 22:32, Bert Gunter wrote: Rolf: Google on load functions into R. A post referencing source() (from Henrik Bengtsson is the first hit. Tried that just now. The only hits I got were to *your* post; no hits on any post from Henrik Bengtsson. These things are never as easy and straightforward as the cognoscenti would have you believe. cheers, Rolf __ 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.
Re: [R] how to load functions from file
I just tried it, because I'm curious that way. If I search for load functions into R I get only this thread. If I search for load functions into R (no quotes), I get the referenced discussion from Henrik Bengtsson: ttps://stat.ethz.ch/pipermail/r-help/2008-September/173606.html As in so many areas of dealing with R, details matter. Sarah On Wed, Apr 4, 2012 at 6:05 PM, Rolf Turner rolf.tur...@xtra.co.nz wrote: On 04/04/12 22:32, Bert Gunter wrote: Rolf: Google on load functions into R. A post referencing source() (from Henrik Bengtsson is the first hit. Tried that just now. The only hits I got were to *your* post; no hits on any post from Henrik Bengtsson. These things are never as easy and straightforward as the cognoscenti would have you believe. cheers, Rolf -- Sarah Goslee http://www.functionaldiversity.org __ 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.
Re: [R] how to load functions from file
On 05/04/12 10:10, Sarah Goslee wrote: I just tried it, because I'm curious that way. If I search for load functions into R I get only this thread. If I search for load functions into R (no quotes), I get the referenced discussion from Henrik Bengtsson: ttps://stat.ethz.ch/pipermail/r-help/2008-September/173606.html As in so many areas of dealing with R, details matter. Indeed. But to me, this is a highly counter-intuitive detail. Put yourself in the place of a newbie trying to find how to load functions into R. cheers, Rolf __ 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.
Re: [R] how to load functions from file
On Apr 4, 2012, at 6:10 PM, Sarah Goslee wrote: I just tried it, because I'm curious that way. If I search for load functions into R I get only this thread. If I search for load functions into R (no quotes), I get the referenced discussion from Henrik Bengtsson: ttps://stat.ethz.ch/pipermail/r-help/2008-September/173606.html As in so many areas of dealing with R, details matter. I sometime check how many hops using links in the help system that it takes to get from a not-quite-right-term to the right help page. Usually it's a pretty small number. In this case the links from the load page are save - dump (where source is discussed and not just linked at the bottom) - source. So arguably the number of hops needed are only two but at most three. (And obviously I'm not counting the dput link or the other ones higher up the page. So I do understand that I may be asking people to read 9 or 10 pages before they post a question. That seems an acceptable effort.) The help system is not advertised as the preferred method of learning R, but it was the method I grew up with. -- David. Sarah On Wed, Apr 4, 2012 at 6:05 PM, Rolf Turner rolf.tur...@xtra.co.nz wrote: On 04/04/12 22:32, Bert Gunter wrote: Rolf: Google on load functions into R. A post referencing source() (from Henrik Bengtsson is the first hit. Tried that just now. The only hits I got were to *your* post; no hits on any post from Henrik Bengtsson. These things are never as easy and straightforward as the cognoscenti would have you believe. cheers, Rolf -- Sarah Goslee http://www.functionaldiversity.org __ 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. David Winsemius, MD West Hartford, CT __ 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] how to load functions from file
Hello, I have several functions in an .R file. I try to load them with load() command but it seems is not working.. if .R is in /home/user/myfunctions.R how can i load it? is there any other way? 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.
Re: [R] how to load functions from file
?source On Tue, Apr 3, 2012 at 11:54 PM, John Kohr wrote: Hello, I have several functions in an .R file. I try to load them with load() command but it seems is not working.. if .R is in /home/user/myfunctions.R how can i load it? is there any other way? 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. [[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.