1

Is there a way to define the entire real line as a domain of a function in R? Up until now when I wanted to plot a function, I would first define x using the command:

> x <- seq(a,b, by=0.01) 

where a and b are numbers enclosing the interval. And then

> plot(x,f(x)) 

where f(x) is a prespecified function.

Is there a way to define the real line as the domain and skip step 1?

Jilber Urbina
  • 58,147
  • 10
  • 114
  • 138
JohnK
  • 1,019
  • 3
  • 14
  • 30
  • 2
    You can use `curve`, but that just hides step 1. There is no way to avoid that because of the way computer graphics work. There can only be a finite number of points (or objects if you use a vector graphics format) in a plot. – Roland Jan 01 '14 at 18:07
  • @Roland, post as an answer (with example)? – Ben Bolker Jan 01 '14 at 23:07
  • there are some comments about auto-selection of x-axis range here: http://stackoverflow.com/questions/20251653/plot-a-polynomial-function-like-on-the-wolframalpha-website-so-that-it-is-easy-t – Ben Bolker Jan 01 '14 at 23:08

0 Answers0