[R] Problem with ?curve
Gabor Grothendieck
ggrothendieck at gmail.com
Wed Apr 18 18:38:32 CEST 2007
Your chipply function is not vectorized. See ?curve and try:
curve(Vectorize(chippy)(x), 1, 20, n=200)
On 4/18/07, Ron Michael <ron_michael70 at yahoo.com> wrote:
>
> Dear all R gurus,
>
>
>
> I have following syntax:
>
>
>
> y = c(1:10)
> chippy <- function(x)
> {
> y[5] = x
> sin(cos(t(y)%*%y)*exp(-t(y)%*%y/2))
> }
> curve(chippy, 1, 20, n=200)
>
>
>
> But I am getting error while executing :
>
>
>
> Error in xy.coords(x, y, xlabel, ylabel, log) :
> 'x' and 'y' lengths differ
> In addition: Warning message:
> number of items to replace is not a multiple of replacement length
>
>
> Can anyone tell me how I can recover?
>
>
>
> Thanks
>
> Ron
>
>
>
>
>
>
>
>
> Send instant messages to your online friends http://uk.messenger.yahoo.com
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at stat.math.ethz.ch 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.
>
More information about the R-help
mailing list