R/Open.curve.R

Defines functions Open.curve

Documented in Open.curve

Open.curve <-
function(gogn, df = nrow(gogn)/2, n = 10)
{
	gogn$index <- c(1:nrow(gogn))
        df <- round(df)
	x <- glm(lat ~ ns(index, df = df), data = gogn)
	y <- glm(lon ~ ns(index, df = df), data = gogn)
	r <- range(gogn$index)
	pred.frame <- data.frame(index = seq(r[1], r[2], length = nrow(gogn) *
		n))
	pred.frame$lat <- predict(x, pred.frame)
	pred.frame$lon <- predict(y, pred.frame)
	pred.frame <- pred.frame[, c("lat", "lon")]
	return(pred.frame)
}

Try the geo package in your browser

Any scripts or data that you put into this service are public.

geo documentation built on May 2, 2019, 5:22 p.m.