[R] writing function ( 'plot' and 'if') problem
David Winsemius
dwinsemius at comcast.net
Wed Apr 14 05:34:25 CEST 2010
On Apr 13, 2010, at 5:41 PM, casperyc wrote:
>
> ===========================
> myf=function(ds=1){
> x=rnorm(10)
> y=rnorm(10)
>
> { #start of if
> if (ds==1)
> {
> list(x,y)
> }
>
> else (ds==2)
?"if"
That seems odd. I would expect this function to return TRUE or FAKSE
rather than proceeding to a plot function. There is not usually a
condition following the else{} step.
--
David.
> {
> plot(x,y)
> }
>
> } # end of if
>
> } # end of function
> ===========================
>
> Hi All,
>
> the problem i am having here is,
> that I want to be able to control the display,
> lf ds=1, i want to just have a list,
>
> but it seem to always plot...
>
> Thanks.
>
> casper
> --
> View this message in context: http://n4.nabble.com/writing-function-plot-and-if-problem-tp1839091p1839091.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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