[R] How to use curve() function without using x as the variable name inside expression?

C W tmrsg11 at gmail.com
Thu Jan 29 22:02:57 CET 2015


Hi all,

I want to graph a curve as a function of mu, not x.

Here's the R code:

x <- rnorm(10)
y <- rnorm(10)

func <- function(x, y, mu){
   x + y + mu ^ 2
}

curve(f = func(x = x, y = y, mu), from = 0, to = 10)
I know I can change variable mu to x, but is there a way to tell R that mu
is the variable of interest, not x.

Thanks in advance,

Mike

	[[alternative HTML version deleted]]



More information about the R-help mailing list