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

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: symmomentsv2-package
> ### Title: Symbolically compute and numerically evaluate multivariate
> ###   central moments
> ### Aliases: ' symmomentsv2-package' ' symmomentsv2'
> 
> ### ** Examples
> 
> # Compute the moment for the 4-dimensional moment c(1,2,3,4):
> callmultmoments(c(1,2,3,4)) 
E[ X1^1 X2^2 X3^3 X4^4 ]: 
   coef S(1,1) S(1,2) S(1,3) S(1,4) S(2,2) S(2,3) S(2,4) S(3,3) S(3,4) S(4,4)
1    72      0      0      0      1      0      0      2      1      1      0
2   144      0      0      0      1      0      1      1      0      2      0
3    72      0      0      0      1      0      1      1      1      0      1
4    72      0      0      0      1      0      2      0      0      1      1
5    24      0      0      0      1      1      0      0      0      3      0
6    36      0      0      0      1      1      0      0      1      1      1
7    72      0      0      1      0      0      0      2      0      2      0
8    36      0      0      1      0      0      0      2      1      0      1
9   144      0      0      1      0      0      1      1      0      1      1
10   18      0      0      1      0      0      2      0      0      0      2
11   36      0      0      1      0      1      0      0      0      2      1
12    9      0      0      1      0      1      0      0      1      0      2
13   48      0      1      0      0      0      0      1      0      3      0
14   72      0      1      0      0      0      0      1      1      1      1
15   72      0      1      0      0      0      1      0      0      2      1
16   18      0      1      0      0      0      1      0      1      0      2
> 
> # Print the representation of the 4-dimensional moment c(1,2,3,4):
> print(callmultmoments(c(1,2,3,4))) 
E[ X1^1 X2^2 X3^3 X4^4 ]: 
   coef S(1,1) S(1,2) S(1,3) S(1,4) S(2,2) S(2,3) S(2,4) S(3,3) S(3,4) S(4,4)
1    72      0      0      0      1      0      0      2      1      1      0
2   144      0      0      0      1      0      1      1      0      2      0
3    72      0      0      0      1      0      1      1      1      0      1
4    72      0      0      0      1      0      2      0      0      1      1
5    24      0      0      0      1      1      0      0      0      3      0
6    36      0      0      0      1      1      0      0      1      1      1
7    72      0      0      1      0      0      0      2      0      2      0
8    36      0      0      1      0      0      0      2      1      0      1
9   144      0      0      1      0      0      1      1      0      1      1
10   18      0      0      1      0      0      2      0      0      0      2
11   36      0      0      1      0      1      0      0      0      2      1
12    9      0      0      1      0      1      0      0      1      0      2
13   48      0      1      0      0      0      0      1      0      3      0
14   72      0      1      0      0      0      0      1      1      1      1
15   72      0      1      0      0      0      1      0      0      2      1
16   18      0      1      0      0      0      1      0      1      0      2
> 
> # Compute the LaTeX representation of the central moment c(1,2,3,4):
> toLatex(callmultmoments(c(1,2,3,4)))
 [1] "E[X_{1}^{1}X_{2}^{2}X_{3}^{3}X_{4}^{4}]=\\\\"                             
 [2] "18\\sigma_{1,2}\\sigma_{2,3}\\sigma_{3,3}\\sigma_{4,4}^{2}+"              
 [3] "72\\sigma_{1,2}\\sigma_{2,3}\\sigma_{3,4}^{2}\\sigma_{4,4}+"              
 [4] "72\\sigma_{1,2}\\sigma_{2,4}\\sigma_{3,3}\\sigma_{3,4}\\sigma_{4,4}+"     
 [5] "48\\sigma_{1,2}\\sigma_{2,4}\\sigma_{3,4}^{3}+\\\\"                       
 [6] "9\\sigma_{1,3}\\sigma_{2,2}\\sigma_{3,3}\\sigma_{4,4}^{2}+"               
 [7] "36\\sigma_{1,3}\\sigma_{2,2}\\sigma_{3,4}^{2}\\sigma_{4,4}+"              
 [8] "18\\sigma_{1,3}\\sigma_{2,3}^{2}\\sigma_{4,4}^{2}+"                       
 [9] "144\\sigma_{1,3}\\sigma_{2,3}\\sigma_{2,4}\\sigma_{3,4}\\sigma_{4,4}+\\\\"
[10] "36\\sigma_{1,3}\\sigma_{2,4}^{2}\\sigma_{3,3}\\sigma_{4,4}+"              
[11] "72\\sigma_{1,3}\\sigma_{2,4}^{2}\\sigma_{3,4}^{2}+"                       
[12] "36\\sigma_{1,4}\\sigma_{2,2}\\sigma_{3,3}\\sigma_{3,4}\\sigma_{4,4}+"     
[13] "24\\sigma_{1,4}\\sigma_{2,2}\\sigma_{3,4}^{3}+\\\\"                       
[14] "72\\sigma_{1,4}\\sigma_{2,3}^{2}\\sigma_{3,4}\\sigma_{4,4}+"              
[15] "72\\sigma_{1,4}\\sigma_{2,3}\\sigma_{2,4}\\sigma_{3,3}\\sigma_{4,4}+"     
[16] "144\\sigma_{1,4}\\sigma_{2,3}\\sigma_{2,4}\\sigma_{3,4}^{2}+"             
[17] "72\\sigma_{1,4}\\sigma_{2,4}^{2}\\sigma_{3,3}\\sigma_{3,4}\\\\"           
> 
> # Write the LaTeX representation to a file using the standard R function (not run):
> # writeLines(callmultmoments(c(1,2,3,4))),con="yourfilename", sep = "\n")
> 
> # evaluate the moment c(1,2,3,4) at the following variance-covariance matrix
>   #  4 2 1 1
>   #  2 3 1 1
>   #  1 1 2 1
> 
> evaluate(callmultmoments(c(1,2,3,4)),c(4,2,1,1,3,1,1,2,1,2))
[1] 3480
> 
> # Using 10000 samples, estimate the central moment for c(2,4) at the covariance matrix (not run)
> #  2 1
> #  1 4
> 
> # and mean (0,0)
> library(mvtnorm)
> simulate(callmultmoments(c(2,4)),10000,NULL,c(0,0),c(2,1,1,4))
[1] 133.7029
> 
> # Compute Latex representation of a non-central moment
> # as.matrix(toLatex_noncentral(c(1,3))) 
> 
> # Create all 2-dimensional moment objects with exponents up to 3 
> # First create the symmoments environment if it does not exist
> # symmoments <- new.env()
> # make.all.moments(c(3,3))
> 
> # Evaluate a non-central moment at a specified mean and covariance matrix
> # Note that this invocation requires moments of order up to c(1,3)
> # to exist in environment symmoments.
> # evaluate_noncentral(c(1,3),c(1,2),c(1,0,1))
> 
> # Create an mpoly object 
> library(mpoly)

Attaching package: 'mpoly'

The following object is masked from 'package:multipol':

    is.constant

> t0 <- mpoly(list(c(coef=3,x1=2),c(coef=2,x1=1,x2=3),
+                    c(coef=-4,z=2),c(coef=1,x1=1,x2=2,z=1)))  
>                      
> # Convert an mpolyobject to a moment object
> t1 <<- convert.mpoly(t0)      
> 
> # Convert a moment object to a multipol object
> t2 <<- convert.multipol(t1)
> 
> # Convert from multipol back to mpoly through moment
> 
> mpoly(convert.mpoly(convert.multipol(t2)))     
3 X1^2  +  2 X1 X2^3  +  X1 X2^2 X3  -  4 X3^2> 
> # Evaluate the expected value of a multivariate polynomial
> # Required moments must exist in environment symmoments.
> 
> # evaluate_expected.polynomial(t0,c(1,2,3),c(1,0,0,1,0,1))
> 
> # Create a Newick representation of a tree
> exam.Newick      <- "(((a,b),c),d);"
> 
> # Convert to phylo format
> library(ape)
> exam.phylo       <- read.tree(text=exam.Newick)
> 
> # Convert to matching format
> exam.matching    <- as.matching(exam.phylo)
> 
> # Convert to L-matrix format
> exam.L.matrix    <- toMoment(exam.matching)
 ----------- FAILURE REPORT -------------- 
 --- failure: the condition has length > 1 ---
 --- srcref --- 
: 
 --- package (from environment) --- 
symmoments
 --- call from context --- 
toNewick(L, type = "square", tip.label = temp.tip.label)
 --- call from argument --- 
if (class(L) == "L-matrix") {
    L.matrix <- L$L
}
 --- R stacktrace ---
where 1: toNewick(L, type = "square", tip.label = temp.tip.label)
where 2: toMoment(exam.matching)

 --- value of length: 2 type: logical ---
[1] FALSE FALSE
 --- function from context --- 
function (L, type = NULL, tip.label = NULL) 
{
    toSquare <- function(L.ut) {
        n <- (-1 + sqrt(1 + 8 * length(L.ut)))/2
        L <- 0 * diag(n)
        start <- 1
        for (irow in 1:n) {
            L[irow, ] <- c(rep(0, (irow - 1)), L.ut[start:(start + 
                n - irow)])
            start <- start + n - irow + 1
        }
        return(L)
    }
    if (class(L) == "L-matrix") {
        L.matrix <- L$L
    }
    if (!is.null(type)) {
        if (type == "square") {
            L.matrix <- L
        }
        if (type == "ut") {
            L.matrix <- toSquare(L)
        }
    }
    nL <- dim(L.matrix)[1]
    n <- 1 + nL/2
    alphab <- gsub(" ", "", paste(rep(letters, times = rep(676, 
        26)), paste(rep(letters, times = rep(26, 26)), letters)))
    if (!is.null(tip.label)) {
        tips <- tip.label
    }
    if (is.null(tip.label) & class(L) == "L-matrix") {
        tips <- L$tip.label
    }
    if (is.null(tip.label) & class(L) != "L-matrix") {
        if (n <= 26) {
            tips <- letters[1:n]
        }
        if (n > 26) {
            tips <- alphab[1:n]
        }
    }
    nodes <- tips
    for (icol in 2:nL) {
        irow <- (1:icol)[L.matrix[1:icol, icol] == 1]
        if (length(irow) == 1) {
            ccol <- nodes[icol]
            crow <- nodes[irow]
            if (icol <= n) {
                couple <- gsub(" ", "", paste("(", crow, ",", 
                  ccol, ")"), fixed = TRUE)
            }
            if (icol > n) {
                couple <- gsub(" ", "", paste("(", ccol, ",", 
                  crow, ")"), fixed = TRUE)
            }
            nodes <- c(nodes, couple)
        }
    }
    nodes.n <- length(nodes)
    temp.Newick <- gsub(" ", "", paste(nodes[nodes.n], ";"))
    nodes <- gsub("!", "", nodes, fixed = TRUE)
    Newick <- list(Newick = temp.Newick, tip.label = tips, tip.label.n = n, 
        L = L.matrix, node.label = nodes, nodes.label.n = nodes.n)
    class(Newick) <- "L-Newick"
    return(Newick)
}
<bytecode: 0x4767dd0>
<environment: namespace:symmoments>
 --- function search by body ---
Function toNewick in namespace symmoments has this body.
 ----------- END OF FAILURE REPORT -------------- 
Error in if (class(L) == "L-matrix") { : the condition has length > 1
Calls: toMoment -> toNewick
Execution halted