Drawing Trig Function
On Wed, 31 May 2000, Ko-Kang Wang wrote:
Hi there, Two simple questions: 1) How do I comment out several lines in R? Do I need to type # in the beginning of each line?
Yes
2) I have got a few lines of codes that draws sin, cos and tan (supposedly) below. My codes can draw sin() and cos() perfectly fine, but when it comes to tan(), the last part which I have commentted out, I have problem. It does not draw what it's supposed to do.
I think it draws what it's supposed to. It doesn't draw what you want, perhaps. The problem is that you are drawing an unbounded function, so what you get will be determined almost entirely by how close x gets to the singularities at odd multiples of pi/2. You probably want to plot something like pmax(-10,pmin(10,tan(x))) or ifelse(abs(tan(x))>10,NA,tan(x)) -thomas Thomas Lumley Assistant Professor, Biostatistics University of Washington, Seattle -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._