[R] how should I make the optional arguments in r?
Rui Barradas
ruipbarradas at sapo.pt
Thu Jan 24 19:42:14 CET 2013
Hello,
The question is a bit confusing, but for what I could understand, try
changing to
rr <- getrange(dataw, mydatao, method = method)
Hope this helps,
Rui Barradas
Em 24-01-2013 18:26, Tammy Ma escreveu:
>
> HI,
>
> I guess I did sth wrong with the optional argument in the program. but I don't know how should I make it.
>
>
> in my main program:
>
> source("getelasticity_overPB.r")
>
> crossprice<-getelasticity(mydata,mydatao,"nest")$cross_p
> is same with
> crossprice<-getelasticity(mydata,mydatao)$cross_p
> I don't know why????
>
> In ""getelasticity_overPB.r":
> I have the function:
>
> getelasticity=function(mydata,mydatao,method=NULL){
>
> .....
> source("runmodel.r")
> rr<-getrange(dataw,mydatao,method=NULL)
> #I have tested that rr<-getrange(dataw,mydatao) is different with rr<-getrange(dataw,mydatao,"nest"): which is what I want.
>
> rr
>
> }
>
>
> how should I make it work???
>
>
> Thanks for your help.
>
> Kind regards,
> Tammy
>
>
>
>
>
>
>
>
>
>
> [[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