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

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: loglike
> ### Title: Log-likelihood of the hyperparameters.
> ### Aliases: loglike
> 
> ### ** Examples
> 
> n <- 20
> T <- 20
> ##Specify hyper-parameters
> par <- c(rho0=0.1,sigma2=0.2,zeta=0.5,rho1=0.1,gamma=2,alpha=pi/4,muX=0.2,muY=-0.2,tau2=0.01)
> ##Simulate data
> spateSim <- spate.sim(par=par,n=n,T=T,seed=4)
> w <- spateSim$w
> 
> ##Initial values for optim. This takes a couple of seconds.
> parI <- c(rho0=0.2,sigma2=0.1,zeta=0.25,rho1=0.01,gamma=1,alpha=0.3,muX=0,muY=0,tau2=0.005)
> logInd=c(1,2,3,4,5,9)
> ##Transform to log-scale
> parI[logInd] <- log(parI[logInd])
> 
> ##Fourier transform needs to be done only once
> wFT <- real.fft.TS(w,n=n,T=T)
 ----------- FAILURE REPORT -------------- 
 --- failure: the condition has length > 1 ---
 --- srcref --- 
: 
 --- package (from environment) --- 
spate
 --- call from context --- 
real.fft.TS(w, n = n, T = T)
 --- call from argument --- 
if (class(w) == "matrix") {
    w <- TSmat.to.vect(w)
    Mat <- TRUE
} else {
    Mat <- FALSE
}
 --- R stacktrace ---
where 1: real.fft.TS(w, n = n, T = T)

 --- value of length: 2 type: logical ---
[1]  TRUE FALSE
 --- function from context --- 
function (w, n, T, inv = TRUE, indFFT = NULL) 
{
    if (class(w) == "matrix") {
        w <- TSmat.to.vect(w)
        Mat <- TRUE
    }
    else {
        Mat <- FALSE
    }
    if (length(w) != (n * n * T)) {
        print("Error: 'w' needs to be a vector of length n*n*T or a matrix of dimension T x n*n.")
        return()
    }
    if (is.null(indFFT)) {
        indFFT <- index.complex.to.real.dft(n)
    }
    wh <- .C("TSreal_fft", n = as.integer(n), T = as.integer(T), 
        wh = as.double(w), inverse = as.integer(sum(inv)), indCos = as.integer(indFFT$indCos), 
        indW = as.integer(indFFT$indW), as.integer(indFFT$indWCon), 
        as.integer(length(indFFT$indCos)))$wh
    if (Mat) 
        wh <- vect.to.TSmat(wh, T = T)
    return(wh)
}
<bytecode: 0x2542fd0>
<environment: namespace:spate>
 --- function search by body ---
Function real.fft.TS in namespace spate has this body.
 ----------- END OF FAILURE REPORT -------------- 
Error in if (class(w) == "matrix") { : the condition has length > 1
Calls: real.fft.TS
Execution halted