[R] Interpolation
Sundar Dorai-Raj
sundar.dorai-raj at pdf.com
Wed Feb 12 14:42:02 CET 2003
Remigijus Lapinskas wrote:
> Many thanks to all who replied to my e-mail. My problem was that I
> had not known about the approx function.
>
> By the way, if I have x <- c(1990,1994,1995,1997), is there an
> automated way to fill in the gaps, i.e., to get
> c(1991,1992,1993,1996)?
>
Try this:
R> x <- c(1990, 1994, 1995, 1997)
R> all.x <- seq(min(x), max(x))
R> missing.x <- all.x[!all.x %in% x]
R> missing.x
[1] 1991 1992 1993 1996
R>
Regards,
Sundar
More information about the R-help
mailing list