[R] spline for implicit functions

Casper Ti. Vector caspervector at gmail.com
Wed Sep 21 06:59:36 CEST 2011


Hello list, is there any R function for generating spline for implicit
functions, for example a spline for an two-column data frame where for
one value for one variable there maybe several correspondent values for
another? Many thanks.

Currently I'm using this home-made one:
> spline2d <- function(df, ...)
> {
>     xname <- colnames(df)[1]
>     yname <- colnames(df)[2]
>
>     df <- data.frame(c(1 : nrow(df)), df[1], df[2])
>     colnames(df) <- c("index", xname, yname)
>
>     df <- data.frame(
>         spline(df[c("index", xname)], ...)$y,
>         spline(df[c("index", yname)], ...)$y
>     )
>     colnames(df) <- c(xname, yname)
>     return(df)
> }

-- 
    Using GPG/PGP? Please get my current public key (ID: 0xAEF6A134,
valid from 2010 to 2013) from a key server.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20110921/2b98e46f/attachment.bin>


More information about the R-help mailing list