I tried to define a function using another function I defined before, and the previous function has a vector as an argument, when I tried to get the graph of the new function, there was something going wrong. Here is a simple example to explain how it happend:
fr1 <- function(x,y){ x^2+x*y+1 } fr2 <- function(x){ fr1(x,3) } plot(fr2) In this case, it worked just fine. But when I changed it to the following form: Fr1 <- function(x){ x1 <- x[1] x2 <- x[2] x1^2+x1*x2+1 } Fr2 <- function(x){ Fr1(c(x,3)) } plot(Fr2) it gives: Error in xy.coords(x, y, xlabel, ylabel, log) : 'x' and 'y' lengths differ Could anyone help me with this problem? Thanks. -- View this message in context: http://www.nabble.com/plot-a-function-with-a-vector-as-argument-tp17299015p17299015.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ 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.