[R] custom function that plots other functions- problem

Jeff Newmiller jdnewmil at dcn.davis.CA.us
Sun May 5 19:55:52 CEST 2013

This request is clearly off-topic according to the Posting Guide. Please use the study assistance provided in the context of your assignment.
Jeff Newmiller                        The     .....       .....  Go Live...
DCN:<jdnewmil at dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
                                      Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
Sent from my phone. Please excuse my brevity.

"Bartłomiej Drążczyk" <bartek.drazczyk at gmail.com> wrote:

>Hi everyone!
>Could you please help me with the following assignment? My aim is to
>a custom function that draws the plots of functions submitted by the
>The catch is, that we do not know the exact number of functions the
>will select to draw.
>The program is relatively easy with one function, f.e sin:
>mf<- function(f,range,quality){
>                x<- seq(range[1],range[2], quality);
>                y<- f(x);
>                plot(x,y);
>mp(sin, c(0,2*pi), .02);
>but I encountered some problems while trying to provide more than one-
>following structure generates mistakes:
>plotter<- function(f,howmany,range,quality){
>    x<-seq(range[1],range[2],quality)
>    y<- matrix(f,how_many)
>    plot(x,y[1,])
>    for(i in 2:how_many){
>    lines(x,y[i,])
>    }
>I would really appreciate your help with this program.
>	[[alternative HTML version deleted]]
>R-help at r-project.org mailing list
>PLEASE do read the posting guide
>and provide commented, minimal, self-contained, reproducible code.

More information about the R-help mailing list