Never mind, I figured it out.
You need to use sapply(), for instance, curve(sapply(x, p), from = 0, to
=10)
Thanks all!
On Tue, Oct 27, 2015 at 11:14 AM, C W wrote:
> Dear R list,
>
> I am trying to plot the curve of a function.
>
> Here's the R code:
>
> library(mvtnorm)
>
> p <- function(x,
Dear R list,
I am trying to plot the curve of a function.
Here's the R code:
library(mvtnorm)
p <- function(x, mu){
mu <- c(mu, 0)
dmvnorm(c(x, 1), mu, diag(2))
}
> curve(p(x, 2), from = 0, to =1)
Error in dmvnorm(c(x, 1), mu, diag(2)) :
mean and sigma have non-conforming size
I think
2 matches
Mail list logo