Here is another way of doing it: x <- c(1990, 1994, 1995, 1997) all.x <- seq(min(x), max(x)) complementary.x <- setdiff(all.x, x)
-----Original Message----- From: Sundar Dorai-Raj [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 12, 2003 9:39 PM To: Remigijus Lapinskas Cc: [EMAIL PROTECTED] Subject: Re: [R] Interpolation 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 ______________________________________________ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help ______________________________________________ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help