Running examples in 'spsurvey-Ex.R' failed
The error most likely occurred in:

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: attrisk.analysis
> ### Title: Attributable Risk Analysis for Probability Survey Data
> ### Aliases: attrisk.analysis
> ### Keywords: survey survival
> 
> ### ** Examples
> 
> mysiteID <- paste("Site", 1:100, sep="")
> mysites <- data.frame(
+   siteID=mysiteID,
+   Active=rep(TRUE, 100))
> mysubpop <- data.frame(
+   siteID=mysiteID,
+   All.Sites=rep("All Sites", 100),
+   Resource.Class=rep(c("Agr", "Forest"), c(55,45)))
> mydesign <- data.frame(
+   siteID=mysiteID,
+   wgt=runif(100, 10, 100),
+   xcoord=runif(100),
+   ycoord=runif(100),
+   stratum=rep(c("Stratum1", "Stratum2"), 50))
> mydata.ar <- data.frame(
+   siteID=mysiteID,
+   RespVar1=sample(c("Poor", "Good"), 100, replace=TRUE),
+   RespVar2=sample(c("Poor", "Good"), 100, replace=TRUE),
+   StressVar=sample(c("Poor", "Good"), 100, replace=TRUE))
> attrisk.analysis(sites=mysites, subpop=mysubpop, design=mydesign,
+   data.ar=mydata.ar, response.var=c("RespVar1", "RespVar2"),
+   stressor.var=rep("StressVar", 2))
 ----------- FAILURE REPORT -------------- 
 --- failure: the condition has length > 1 ---
 --- srcref --- 
: 
 --- package (from environment) --- 
spsurvey
 --- call from context --- 
localmean.weight(x = x, y = y, prb = 1/wgt)
 --- call from argument --- 
while (ind & iter < 11) {
    v <- v + vincr
    xt <- x + rnorm(n, 0, v)
    yt <- y + rnorm(n, 0, v)
    a22 <- localmean.weight2(xt, yt, prb, nbh)
    ind <- class(a22) == "try-error"
    iter <- iter + 1
}
 --- R stacktrace ---
where 1: localmean.weight(x = x, y = y, prb = 1/wgt)
where 2: attrisk.var(response.st, stressor.st, response.levels, stressor.levels, 
    wgt.st, xcoord[stratum.i], ycoord[stratum.i], stratum.ind, 
    stratum.levels[i], cluster.ind, pcfactor.ind = pcfactor.ind, 
    pcfsize = pcfsize[i], support = support[stratum.i], vartype = vartype, 
    warn.ind = warn.ind, warn.df = warn.df, warn.vec = warn.vec)
where 3: attrisk.est(response = data.ar[subpop.ind, response.var[ivar]], 
    stressor = data.ar[subpop.ind, stressor.var[ivar]], response.levels = response.levels[[ivar]], 
    stressor.levels = stressor.levels[[ivar]], wgt = design[subpop.ind, 
        2], xcoord = design[subpop.ind, 3], ycoord = design[subpop.ind, 
        4], stratum = design[subpop.ind, 5], cluster = design[subpop.ind, 
        6], wgt1 = design[subpop.ind, 7], xcoord1 = design[subpop.ind, 
        8], ycoord1 = design[subpop.ind, 9], popcorrect = pcfactor.ind, 
    pcfsize = temp.pcfsize, N.cluster = temp.N.cluster, stage1size = temp.stage1size, 
    support = design[subpop.ind, 10], sizeweight = swgt.ind, 
    swgt = design[subpop.ind, 11], swgt1 = design[subpop.ind, 
        12], vartype = vartype, conf = conf, check.ind = FALSE, 
    warn.ind = warn.ind, warn.df = warn.df, warn.vec = c(typenames[itype], 
        subpopnames[isubpop], varnames[ivar]))
where 4: attrisk.analysis(sites = mysites, subpop = mysubpop, design = mydesign, 
    data.ar = mydata.ar, response.var = c("RespVar1", "RespVar2"), 
    stressor.var = rep("StressVar", 2))

 --- value of length: 2 type: logical ---
[1] FALSE FALSE
 --- function from context --- 
function (x, y, prb, nbh = 4, vincr = 1e-05 * abs(mean(y))) 
{
    n <- length(x)
    dst <- as.matrix(dist(cbind(x, y), diag = TRUE, upper = TRUE))
    idx <- apply(dst, 2, order)[1:nbh, ]
    jdx <- rep(1:n, rep(nbh, n))
    kdx <- unique(c((jdx - 1) * n + idx, (idx - 1) * n + jdx)) - 
        1
    ij <- cbind((kdx)%/%n + 1, (kdx)%%n + 1)
    ij <- ij[order(ij[, 1], dst[ij]), ]
    gct <- tabulate(ij[, 1])
    gwt <- numeric(0)
    for (i in 1:n) gwt <- c(gwt, 1 - (1:gct[i] - 1)/(gct[i]))
    gwt <- gwt/prb[ij[, 2]]
    smwt <- sapply(split(gwt, ij[, 1]), sum)
    gwt <- gwt/smwt[ij[, 1]]
    smwt <- sapply(split(gwt, ij[, 2]), sum)
    hij <- matrix(0, n, n)
    hij[ij] <- 0.5
    a22 <- try(ginv(diag(gct/2) - hij %*% diag(2/gct) %*% hij), 
        TRUE)
    ind <- class(a22) == "try-error"
    iter <- 1
    v <- 0
    while (ind & iter < 11) {
        v <- v + vincr
        xt <- x + rnorm(n, 0, v)
        yt <- y + rnorm(n, 0, v)
        a22 <- localmean.weight2(xt, yt, prb, nbh)
        ind <- class(a22) == "try-error"
        iter <- iter + 1
    }
    if (ind) 
        stop("\nThe La.svd function terminated with an error.  Add random noise to the \nx-coordinates and y-coordinates.")
    a21 <- -diag(2/gct) %*% hij %*% a22
    lm <- a21 %*% (1 - smwt)
    gm <- a22 %*% (1 - smwt)
    gwt <- (lm[ij[, 1]] + gm[ij[, 2]])/2 + gwt
    list(ij = ij, gwt = gwt)
}
<bytecode: 0xb354ca0>
<environment: namespace:spsurvey>
 --- function search by body ---
Function localmean.weight in namespace spsurvey has this body.
 ----------- END OF FAILURE REPORT -------------- 
Fatal error: the condition has length > 1