R/prepare-acdc-covars.R

Defines functions .prepare_acdc_covars

# Generated by autofun (0.0.0.9000): do not edit by hand!!!
# Please edit source code in spsann-package/R-autofun/prepare-acdc-covars.R
.prepare_acdc_covars<-function(...){
expression(if (use.coords) {
  covars <- data.frame(covars, candi[, 2:3])
}, covars.type <- ifelse(pedometrics::anyFactor(covars), "factor", "numeric"), 
    if (covars.type == "factor") {
      if (!pedometrics::allFactor(covars)) {
        i <- which(sapply(covars, is.factor) == FALSE)
        mes <- paste("converting ", length(i), " numeric covariates into factor covariates...", sep = "")
        message(mes)
        num_covars <- data.frame(covars[, i])
        # breaks <- .strataACDC(
        #   n.pts = n_pts, strata.type = strata.type, covars = num_covars, covars.type = "numeric")[[1]]
        # Use 'n_pts + n_fixed_pts' to account for existing fixed points.
        breaks <- .strataACDC(
          n.pts = n_pts + n_fixed_pts, strata.type = strata.type, covars = num_covars, covars.type = "numeric")[[1]]
        num_covars <- pedometrics::cont2cat(x = num_covars, breaks = breaks)
        covars[, i] <- num_covars
      }
    }, n_cov <- ncol(covars), sm <- covars[points[, 1], ])
}
Laboratorio-de-Pedometria/spsann-package documentation built on Nov. 2, 2023, 3:14 p.m.