Your problem is that length(x) != length(y) approx uses linear interpolation but there's no way to make sense of that if you can't match up the x and y coordinates -- and you can't match up the x and y coordinates if there aren't the same number of them.
Michael On Wed, Apr 18, 2012 at 10:15 AM, uday <uday_143...@hotmail.com> wrote: > hi Petr , > Thanks for replay and sorry for typo mistake > approx(pres, sci.pre) its nothing but approx(pre2, pre1). > > so for more simplicity > x <- c(10.34615 , 52.02116, 146.17357, 243.28644, 347.41504, 431.67105, > 521.42712, 629.00446 ,729.95941, 827.86279, 921.55078, > 956.44446) > y <- c( 983.4477692, 973.6199013, 958.0722141, 938.8194208 ,915.1833983, > 852.1671089, > 765.0037479,654.0372907, 526.7369169, 397.0581990, 279.9788079, > 229.5127059, > 185.2578164 ,147.2534510,115.1949457, 88.5712513, 66.7337287, > 49.0140828, > 23.3535195 , 0.6609724) > approx(x,y,xout=x,method="linear") > still I get error message > Error in xy.coords(x, y) : 'x' and 'y' lengths differ > > I saw the approx. function , but yet I do not know that how we can use that > for the data set which having different length > > So I hope that my problem is bit more clear than before > > Cheers > Uday > > > > > -- > View this message in context: > http://r.789695.n4.nabble.com/interpolation-issue-tp4567362p4567826.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.