Bug 14970 - unexpected behavior in ns(knots=NULL,...)
Summary: unexpected behavior in ns(knots=NULL,...)
Alias: None
Product: R
Classification: Unclassified
Component: Models (show other bugs)
Version: R 2.15.x
Hardware: All All
: P5 normal
Assignee: R-core
Depends on:
Reported: 2012-07-03 01:35 UTC by Randall Pruim
Modified: 2012-07-04 07:32 UTC (History)
1 user (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Randall Pruim 2012-07-03 01:35:48 UTC
ns(x, df=4, knots=NULL) 


    ns(x, df=4)

produce different results despite the fact that

> args(ns)
function (x, df = NULL, knots = NULL, intercept = FALSE, Boundary.knots = range(x)) 

This is because ns() is testing knots using missing(knots) rather than is.null(knots).  This caused a bug in my code that took some head scratching to locate.  Is this desired behavior or a bug?
Comment 1 Martin Maechler 2012-07-03 16:18:27 UTC
you are right.  This is undesirable... and I'll tackle it
Comment 2 Randall Pruim 2012-07-03 16:21:03 UTC
(In reply to comment #1)
> you are right.  This is undesirable... and I'll tackle it

This affects bs() in the same way and the same fix should work for both.