[R] ?plot: Add an example on how to plot functions to the help of `plot`.

David Winsemius dwinsemius at comcast.net
Wed Jul 27 23:21:33 CEST 2011


On Jul 27, 2011, at 4:53 PM, Paul Menzel wrote:

> Dear Bert,
>
>
> Am Mittwoch, den 27.07.2011, 13:26 -0700 schrieb Bert Gunter:
>> Paul:
>> No such change is needed.
>
> Well the fact is, that I as a beginner was looking for who I could  
> plot
> normal functions, so one more example would have helped me.
>
>> You do not understand S3 methods.
>
> That is probably true.
>
>> See ?plot.default and read about S3 methods (e.g. in the tutorial
>> Introduction to R or the Language manual).
>
> Searching for »s3 m« in [1] did not give me a good explanation. I have
> not yet read the language manual.
>
> By trial and error I still suggest to add the following.
>
>        # Plot the graph of a function f(x) = x^3 with the points  
> connected by lines.
>        # If you want to plot the graph as a curve please look into  
> `curve()`.
>        y <- seq(1:5)
>        plot(y, y**3, type="l")
>
> This would have helped me as a beginner.

I think that what Bert might have been trying to get you to do was to  
type:

?plot.function  # which is what you might once you do get a better  
understanding S3 methods.



-- 

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list