[R] writing function ( 'plot' and 'if') problem

casperyc casperyc at hotmail.co.uk
Wed Apr 14 00:41:31 CEST 2010


===========================
myf=function(ds=1){
x=rnorm(10)
y=rnorm(10)

{ #start of if
if (ds==1)
{
list(x,y)
}

else (ds==2)
{
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.



More information about the R-help mailing list