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

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: clman
> ### Title: Methods to create, manipulate and query objects of class
> ###   'Clman'.
> ### Aliases: initialize,Clman-method spectra,Clman-method
> ###   spectra<-,Clman,data.frame-method spectra<-,Clman,matrix-method
> ###   spectra<-,Clman,numeric-method plot,Clman-method
> ###   plot,Clman,ANY-method
> ### Keywords: aplot
> 
> ### ** Examples
> 
> ## Model spectra using PROSAIL
> parameter <- data.frame(N = rep.int(c(1, 1.5),2), LAI = c(1,1,3,3))
> spec <- PROSAIL(parameterList=parameter)
 ----------- FAILURE REPORT -------------- 
 --- failure: the condition has length > 1 ---
 --- srcref --- 
: 
 --- package (from environment) --- 
hsdar
 --- call from context --- 
.createspeclib(spectra, wavelength, ...)
 --- call from argument --- 
if (class(spectra) %in% c("RasterBrick", "HyperSpecRaster")) {
    fromRaster <- TRUE
} else {
    if (class(spectra) == "RasterLayer") {
        spectra <- brick(spectra)
        fromRaster <- TRUE
    }
    else {
        fromRaster <- FALSE
        dim_spectra <- c(nrow(spectra), ncol(spectra))
    }
}
 --- R stacktrace ---
where 1: .createspeclib(spectra, wavelength, ...)
where 2: speclib(wavelength = c(1:nw) + 399, spectra = extern$reflectance)
where 3: speclib(wavelength = c(1:nw) + 399, spectra = extern$reflectance)
where 4: PROSAIL(N = x[1], Cab = x[2], Car = x[3], Cbrown = x[4], Cw = x[5], 
    Cm = x[6], psoil = x[7], LAI = x[8], TypeLidf = x[9], lidfa = x[10], 
    lidfb = x[11], hspot = x[12], tts = x[13], tto = x[14], psi = x[15], 
    rsoil = rsoil)
where 5: FUN(newX[, i], ...)
where 6: apply(parameterList, 1, FUN = iterate_prosail, rsoil)
where 7: apply(parameterList, 1, FUN = iterate_prosail, rsoil)
where 8: t(apply(parameterList, 1, FUN = iterate_prosail, rsoil))
where 9: PROSAIL(parameterList = parameter)

 --- value of length: 2 type: logical ---
[1] FALSE FALSE
 --- function from context --- 
function (spectra, wavelength, fwhm = NULL, SI = NULL, usagehistory = NULL, 
    transformation = NULL, continuousdata = "auto", wlunit = "nm", 
    xlabel = "Wavelength", ylabel = "Reflectance", rastermeta = NULL) 
{
    if (class(spectra) %in% c("RasterBrick", "HyperSpecRaster")) {
        fromRaster <- TRUE
    }
    else {
        if (class(spectra) == "RasterLayer") {
            spectra <- brick(spectra)
            fromRaster <- TRUE
        }
        else {
            fromRaster <- FALSE
            dim_spectra <- c(nrow(spectra), ncol(spectra))
        }
    }
    wavelength.is.range <- FALSE
    if (class(wavelength) == "data.frame" || class(wavelength) == 
        "matrix") {
        wavelength <- as.data.frame(wavelength)
        if (ncol(wavelength) == 1) {
            wavelength <- as.vector(wavelength)
            if (!is.null(fwhm)) 
                if (length(fwhm) != length(wavelength)) 
                  stop("Length of fwhm and wavelength differ")
            if (!fromRaster) {
                if (length(wavelength) == dim_spectra[1]) {
                  if (length(wavelength) == dim_spectra[2]) {
                    warning("Could not determine orientation of spectra data. \n  \n                    Make sure that columns are wavelength and rows samples")
                  }
                  else {
                    spectra <- t(spectra)
                  }
                }
            }
        }
        else {
            wavelength.is.range <- TRUE
            if (!fromRaster) {
                if (nrow(wavelength) == dim_spectra[1]) {
                  if (nrow(wavelength) == dim_spectra[2]) {
                    warning("Could not determine orientation of spectra data. \n  \n                    Make sure that columns are wavelength and rows samples")
                  }
                  else {
                    spectra <- t(spectra)
                  }
                }
            }
        }
    }
    else {
        if (!is.null(fwhm)) {
            wavelength.is.range <- TRUE
            if (length(fwhm) != length(wavelength)) 
                stop("Length of fwhm and wavelength differ")
        }
        if (!fromRaster) {
            if (length(wavelength) == dim_spectra[1]) {
                if (length(wavelength) == dim_spectra[2]) {
                  warning("Could not determine orientation of spectra data. \n  \n                  Make sure that columns are bands and rows different samples")
                }
                else {
                  spectra <- t(spectra)
                }
            }
        }
    }
    if (!fromRaster) {
        names <- NULL
        rn <- row.names(spectra)
        if (!is.null(rn)) {
            rn <- as.factor(rn)
            if (nlevels(rn) != length(rn)) {
                warning("  some row.names duplicated: --> Spectra does not have IDs")
                rn <- as.factor(1:length(rn))
            }
            rn <- as.character(rn)
        }
        else {
            rn <- character()
        }
        spectra <- as.matrix(spectra)
        cn <- colnames(spectra)
        rownames(spectra) <- NULL
        colnames(spectra) <- NULL
    }
    else {
        cn <- c(1:spectra@data@nlayers)
        rn <- character()
    }
    if (!wavelength.is.range) {
        if (length(wavelength) > 1) {
            range <- wavelength[-1] - wavelength[-1 * length(wavelength)]
            range <- c(as.numeric(range), range[length(range)])
            if (sd(range) == 0) 
                range <- mean(range)
            fwhm <- range
        }
        else {
            fwhm <- 1
        }
    }
    else {
        if (!is.null(fwhm)) {
            if (is.data.frame(wavelength)) 
                wavelength <- rowMeans(wavelength)
        }
    }
    if (is.null(SI)) 
        SI <- data.frame()
    if (is.null(usagehistory)) 
        usagehistory <- character()
    if (is.null(transformation)) 
        transformation <- character()
    if (is.null(rastermeta)) 
        rastermeta <- list()
    wavelength <- wavelength * .ConvWlFwd(wlunit)
    fwhm <- fwhm * .ConvWlFwd(wlunit)
    result <- new("Speclib", spectra = spectra, wavelength = wavelength, 
        fwhm = fwhm, wavelength.is.range = wavelength.is.range, 
        continuousdata = continuousdata, SI = SI, transformation = transformation, 
        usagehistory = usagehistory, wlunit = wlunit, xlabel = xlabel, 
        ylabel = ylabel, rastermeta = rastermeta)
    idSpeclib(result) <- rn
    bandnames(result) <- cn
    if (validObject(result)) {
        return(result)
    }
}
<bytecode: 0xf891ae0>
<environment: namespace:hsdar>
 --- function search by body ---
Function .createspeclib in namespace hsdar has this body.
 ----------- END OF FAILURE REPORT -------------- 
Fatal error: the condition has length > 1