خرید بک لینک

Vote count: 0

I've reviewed what's here on stat_function and I still can't get this to work. Here's min working code:

plotdata <- cbind(as.data.frame(seq(-5, 5, length=10)), as.data.frame(-seq(-5, 5, length=10)))
colnames(plotdata) <- c('x', 'y')

xvalues <- as.data.frame(seq(-5, 5, length = 100))

xey <- function(x) {x}

#ggplot(plotdata, aes(x, y)) + geom_line() + stat_function(data=xvalues, fun = xey, linetype = 2)

ggplot(plotdata, aes(x, y)) + geom_line() + stat_function(mapping = aes(x = x), data=xvalues, fun = xey, linetype = 2)

The error I get is :

Error in eval(expr, envir, enclos) : object 'y' not found

As you can see, I've tried it both with mapping and without and the error is the same. The plot works without the stat_function, the xey function is vectorised and written in terms of x, and the xvalues column is labeled x, so ????

asked 1 min ago

برچسب: r statistics with function, نویسنده: استخدام کار تاريخ: يکشنبه 21 شهريور 1395 ساعت: 20:55

صفحه بندی