Liaw, Andy
2004-Aug-09 03:27 UTC
[R] returns the value of a polynomial of degree n evaluated a t x.
Try something like: install.packages("polynom") library(polynom) predict(polynomial(rev(p)), x) HTH, Andy> From: McClatchie, Sam (PIRSA-SARDI) > > > Background: > > OS: Linux Mandrake 9.1 > > release: R 1.9.0 > > editor: Xemacs 21.4 > > frontend: ESS 5.1.23 > > --------------------------------- > > > > Colleagues > > > Is there a function in R that is similar to polyval in matlab? (y > polyval(p,x) returns the value of a polynomial of degree n > evaluated at x. > The input argument p is a vector of length n+1 whose elements are the > coefficients in descending powers of the polynomial to be evaluated). > <http://www.mathworks.com/access/helpdesk/help/techdoc/ref/polyval.html> I have possibly missed it in the R help files, so please excuse me if I have. "Polynomial evaluation" yielded no result in a search of help, and the functions poly() and locpoly() don't seem to be what I am after.> Sam > ---- > Sam McClatchie, > Sub-program leader, Pelagic Fisheries > South Australian Aquatic Sciences Centre > PO Box 120, Henley Beach 5022 > Adelaide, South Australia > email <mcclatchie.sam at saugov.sa.gov.au> > Telephone: (61-8) 8200 2448 > FAX: (61-8) 8200 2481 > Research home page <http://www.smcc.150m.com/> > > /\ > ...>><xX(??> > //// \\\\ > <??)Xx><< > ///// \\\\\\ > ><(((??> > >><(((??> ...>><xX(??>O<??)Xx><< >______________________________________________ R-help at stat.math.ethz.ch mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html