CODE IN R ( Cubic splines) I am dealing with the syntax error \" Error in xy.coo
ID: 3664581 • Letter: C
Question
CODE IN R ( Cubic splines)
I am dealing with the syntax error
" Error in xy.coords(x, y, xlabel, ylabel, log) :
'x' and 'y' lengths differ "
When I input this into my R console:
{ R code..........
}
dy = CubicSpline(0:10, sin(0:10), cos(0), cos(10))
x = c()
y = c()
for (i in 0:100) {
x = c(x, i*0.1)
y = c(y, CubicSplineValue(i*0.1, 0:10, sin(0:10), dy))
}
plot(sin,from = 0, to = 10)
plot(x,y) # trying to plot cubic spline values but I get an error about lengths x and y differing
What am I doing wrong?