TkSpline | R Documentation |
This function plots a dataset in a Tk window then draws the spline fit through the points. It places a line to show the predicted y from the given x value. The line can be clicked on and dragged to new x-values with the predicted y-values automatically updating. A table at the bottem of the graph shows the values and the 3 derivatives.
TkSpline(x, y, method='natural', snap.to.x=FALSE, digits=4,
col=c('blue','#009900','red','black'),
xlab=deparse(substitute(x)), ylab=deparse(substitute(y)),
hscale=1.5, vscale=1.5, wait=TRUE,
...)
x |
The x-values of the data, should be sorted |
y |
The corresponding y-values of the data |
method |
Spline Method, passed to |
snap.to.x |
Logical, if TRUE then the line will only take on the
values of |
digits |
Number of digits to print, passed to |
col |
Colors of the prediction and other lines |
xlab |
Label for the x-axis, passed to |
ylab |
Label for the y-axis, passed to |
hscale |
Horizontal scaling, passed to |
vscale |
Vertical scaling, passed to |
wait |
Should R wait for the window to close |
... |
Additional parameters passed to |
This provides an interactive way to explore predictions from a set of
x and y values. Internally the function splinefun
is used to
make the predictions.
The x-value of the reference line can be changed by clicking and dragging the line to a new position. The x and y values are shown in the margins of the graph. Below the graph is a table with the y-value and derivatives.
If wait
is FALSE then an invisible NULL is returned, if
wait
is TRUE then an invisible list with the x and y values and
derivatives is returned.
Greg Snow 538280@gmail.com
splinefun
, TkApprox
if(interactive()) {
x <- 1:10
y <- sin(x)
TkSpline(x,y, xlim=c(0,11))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.