Skip to content

Commit 377e9b6

Browse files
author
ripley
committed
add some sanity-checking code
git-svn-id: https://svn.r-project.org/R/trunk@87402 00db46b3-68df-0310-9c12-caf00c1e9a41
1 parent e7df566 commit 377e9b6

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/library/stats/R/loess.R

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,10 @@ predLoess <-
316316
order.drop.sqr <- (2L - drop.square)[order.parametric]
317317
storage.mode(x) <- "double"
318318
storage.mode(y) <- "double"
319+
## package intamap somehow gets NULL
320+
N <- nrow(x)
321+
if (length(weights) < N) weights <- rep(1, N)
322+
if (length(robust) < N) robust <- rep(1, N)
319323
if(surface == "direct") {
320324
nas <- rowSums(is.na(newx)) > 0
321325
fit <- rep_len(NA_real_, length(nas))

src/library/stats/R/ppr.R

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ function(x, y, weights=rep(1,n), ww=rep(1,q), nterms, max.terms=nterms,
6565
stop("'ppr' applies only to numerical variables")
6666
n <- nrow(x)
6767
if(nrow(y) != n) stop("mismatched 'x' and 'y'")
68+
if(length(weights) != n)
69+
stop("mismatched 'x' and 'weights'")
6870
p <- ncol(x)
6971
q <- ncol(y)
7072
xnames <- if(!is.null(dimnames(x))) dimnames(x)[[2L]] else paste0("X", 1L:p)

0 commit comments

Comments
 (0)