Hi everyone! Could you please help me with the following assignment? My aim is to write a custom function that draws the plots of functions submitted by the user. The catch is, that we do not know the exact number of functions the user 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- the 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,]) } } plotter<-(c(sin(x),cos(x)),2,c(0,2*pi),.02) I would really appreciate your help with this program. Regards, Bartek [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.