我的工作区是在D:\Program Files\Insightful\splus62\users\hyy下:
(1)打开一个Script的编辑窗口,输入一个自定义函数,假设为
myfun<-function(func,min.x,max.x,nx=100,my.type="l",...)
{
x<-seq(min.x,max.x,length=nx)
y<-func(x)
my.title<-paste("Plot of",my.ylabel,sep=" ")
plot(x,y,type=my.type,ylab=my.ylabel,...)
my.ylabel<-deparse(substitute(func))
title(main=my.title,sub=date(),col=3)
}
(2)将其保存在D:\Program Files\Insightful\splus62\users\hyy下
(3)在命令窗口输入myfun(sin,0,2*pi),出现错误:
Problem: Couldn't find a function definition for "myfun"
我的疑问是:编好的文件到底应该存在哪个路径下才不出现这种问题呢?或者是有别的原因?
(如果是在命令窗口中定义上面的函数并执行的话,是可以的)
[此贴子已经被作者于2007-4-13 13:34:58编辑过]