RE: [R] Re: how to define functions in such a situation

2005-06-07 Thread Liaw, Andy
I've already given you an example (ecdf). You can look at the polynom package as well. Try: install.packages("polynom") library(polynom) as.function.polynomial Here's one trivial example: > f <- function(type) { g <- if (type == 1) cos else sin; g; } > myfun1 <- f(1) > myfun2 <- f(2) > myfun1(

Re: [R] Re: how to define functions in such a situation

2005-06-07 Thread Hu Chen
Sorry for my confusing expression. I need create some new temp functions after the package is loaded. And these new functions should be visible and usable. Functions could be returned as a object, as Liaw mentioned. However I can't find some examples in R-intro. I also want to know whether functio

RE: [R] Re: how to define functions in such a situation

2005-06-07 Thread Liaw, Andy
help.search("temporary") tells you to look at ?tempfile. Andy > From: Hu Chen > > I got a dirty way to solve this. > write a temp .R source file including these new functions, then > >source(this_temp_file) > but I don't know if there are some temp directory for R to > store temp files? > > O

Re: [R] Re: how to define functions in such a situation

2005-06-07 Thread Uwe Ligges
Hu Chen wrote: I got a dirty way to solve this. write a temp .R source file including these new functions, then source(this_temp_file) Don't know if you really have to do it that way, but I also really don't understand what you are going to do... but I don't know if there are some temp

Re: [R] Re: how to define functions in such a situation

2005-06-07 Thread Sean Davis
Look at the documentation for "source". You can source a file directly from the web: source('http://myserver.com/somefile_on_web.R') If that file contains R code for three functions, the functions will be "visible and useable immediately" in your workspace. Sean On Jun 7, 2005, at 8:58 AM,

[R] Re: how to define functions in such a situation

2005-06-07 Thread Hu Chen
I got a dirty way to solve this. write a temp .R source file including these new functions, then >source(this_temp_file) but I don't know if there are some temp directory for R to store temp files? On 6/7/05, Hu Chen <[EMAIL PROTECTED]> wrote: > hi R folks, > I need read a file from hardisk or ww