Skip to content
Back to formatted view

Raw Message

Message-ID: <CABxs9Vm+TOQyLW8NrGpno=5zHsHh6F2d59VdS72mxBGf2piuYg@mail.gmail.com>
Date: 2016-03-23T19:59:04Z
From: Liviu Andronic
Subject: Why missing values are not allowed in 'poly'?

Dear all,
I'm a bit surprised by this behavior in poly:

x <- c(NA, 1:10)
poly(x, degree = 2, raw=TRUE)
## Error in poly(x, degree = 2, raw = TRUE) :
##   missing values are not allowed in 'poly'
x^2
## [1] NA 1 4 9 16 25 36 49 64 81 100

As you can see, poly() will fail if the vector contains NAs, whereas
it is perfectly possible to obtain the square of the vector manually.

Is there a reason for this limitation in poly?

Regards,
Liviu


-- 
Do you think you know what math is?
http://www.ideasroadshow.com/issues/ian-stewart-2013-08-02
Or what it means to be intelligent?
http://www.ideasroadshow.com/issues/john-duncan-2013-08-30
Think again:
http://www.ideasroadshow.com/library