Running ‘mefa4comparisons.R’ [9s/11s]
  Running ‘mefa4examples.R’
Running the tests in ‘tests/mefa4comparisons.R’ failed.
Complete output:
  > ## performance comparison
  > library(mefa)
  mefa 3.2-7 	 2016-01-11
  > library(mefa4)
  Loading required package: Matrix
  Loading required package: pbapply
  mefa4 0.3-4 	 2016-10-12
  
  Attaching package: 'mefa4'
  
  The following objects are masked from 'package:mefa':
  
      samp, taxa, xtab
  
  > 
  > data(abmibirds)
  > ## NONE: no species was recorded (8)
  > ## SNI: Species Not Identified (216)
  > ## VNA: Variable Not Applicable (6)
  > ## DNC: Did Not Collect (13)
  > ## PNA: Protocol Not Available (0 in this case)
  > 
  > ## S3 mefa processing
  > b3 <- abmibirds
  > b3 <- b3[!(b3$Scientific.Name %in% c("VNA", "DNC", "PNA")),]
  > levels(b3$Scientific.Name)[levels(b3$Scientific.Name) %in% c("NONE", "SNI")] <- "zero.pseudo"
  > b3$Counts <- ifelse(b3$Scientific.Name == "zero.pseudo", 0, 1)
  > b3$Label <- with(b3, paste(ABMI.Site, Year, Point.Count.Station, sep="_"))
  > x3 <- b3[!duplicated(b3$Label), c("Label", "ABMI.Site", "Year", "Field.Date", "Point.Count.Station",
  +     "Wind.Conditions", "Precipitation")]
  > rownames(x3) <- x3$Label
  > z3 <- b3[!duplicated(b3$Scientific.Name), c("Common.Name",
  +     "Scientific.Name", "Taxonomic.Resolution", "Unique.Taxonomic.Identification.Number")]
  > rownames(z3) <- z3$Scientific.Name
  > z3 <- z3[z3$Scientific.Name != "zero.pseudo",]
  > t31 <- system.time(s3 <- suppressWarnings(stcs(b3[,c("Label","Scientific.Name","Counts")])))
  > t32 <- system.time(m30 <- mefa(s3))
  > t33 <- system.time(m31 <- mefa(s3, x3, z3))
  > y30 <- m30$xtab
  > t34 <- system.time(m32 <- mefa(y30, x3, z3))
  Error in mefa(y30, x3, z3) : 'xtab' contains NA
  Calls: system.time -> mefa
  Timing stopped at: 0.001 0.002 0.003
  Execution halted
Running the tests in ‘tests/mefa4examples.R’ failed.
Complete output:
  > ## examples
  > 
  > ## load library
  > library(mefa)
  mefa 3.2-7 	 2016-01-11
  > library(mefa4)
  Loading required package: Matrix
  Loading required package: pbapply
  mefa4 0.3-4 	 2016-10-12
  
  Attaching package: 'mefa4'
  
  The following objects are masked from 'package:mefa':
  
      samp, taxa, xtab
  
  > ## create input data
  > x <- data.frame(
  +     sample = paste("Sample", c(1,1,2,2,3,4), sep="."),
  +     species = c(paste("Species", c(1,1,1,2,3), sep="."),  "zero.pseudo"),
  +     count = c(1,2,10,3,4,0),
  +     segment = letters[c(6,13,6,13,6,6)])
  > x
      sample     species count segment
  1 Sample.1   Species.1     1       f
  2 Sample.1   Species.1     2       m
  3 Sample.2   Species.1    10       f
  4 Sample.2   Species.2     3       m
  5 Sample.3   Species.3     4       f
  6 Sample.4 zero.pseudo     0       f
  > samp <- data.frame(samples=levels(x$sample), var1=1:2)
  > taxa <- data.frame(specnames=levels(x$species), var2=c("b","a"))
  > rownames(samp) <- samp$samples
  > rownames(taxa) <- taxa$specnames
  > samp
            samples var1
  Sample.1 Sample.1    1
  Sample.2 Sample.2    2
  Sample.3 Sample.3    1
  Sample.4 Sample.4    2
  > taxa
                specnames var2
  Species.1     Species.1    b
  Species.2     Species.2    a
  Species.3     Species.3    b
  zero.pseudo zero.pseudo    a
  > ## Xtab class, counts by repetitions in RHS
  > (x0 <- Xtab(~ sample + species, x))
  4 x 4 sparse Matrix of class "dgCMatrix"
           Species.1 Species.2 Species.3 zero.pseudo
  Sample.1         2         .         .           .
  Sample.2         1         1         .           .
  Sample.3         .         .         1           .
  Sample.4         .         .         .           1
  > ## counts by LHS and repetitions in RHS
  > (x1 <- Xtab(count ~ sample + species, x))
  4 x 4 sparse Matrix of class "dgCMatrix"
           Species.1 Species.2 Species.3 zero.pseudo
  Sample.1         3         .         .           .
  Sample.2        10         3         .           .
  Sample.3         .         .         4           .
  Sample.4         .         .         .           .
  > ## drop all empty rows
  > (x2 <- Xtab(count ~ sample + species, x, cdrop=FALSE,rdrop=TRUE))
  3 x 4 sparse Matrix of class "dgCMatrix"
           Species.1 Species.2 Species.3 zero.pseudo
  Sample.1         3         .         .           .
  Sample.2        10         3         .           .
  Sample.3         .         .         4           .
  > ## drop all empty columns
  > Xtab(count ~ sample + species, x, cdrop=TRUE,rdrop=FALSE)
  4 x 3 sparse Matrix of class "dgCMatrix"
           Species.1 Species.2 Species.3
  Sample.1         3         .         .
  Sample.2        10         3         .
  Sample.3         .         .         4
  Sample.4         .         .         .
  > ## drop specific columns by placeholder
  > Xtab(count ~ sample + species, x, cdrop="zero.pseudo")
  4 x 3 sparse Matrix of class "dgCMatrix"
           Species.1 Species.2 Species.3
  Sample.1         3         .         .
  Sample.2        10         3         .
  Sample.3         .         .         4
  Sample.4         .         .         .
  > 
  > ## 3-way crosstab
  > x33 <- Xtab(count ~ sample + species + segment, x)
  > 
  > ## Mefa class, standard
  > (x3 <- Mefa(x1, samp, taxa))
  Object of class "Mefa"
    ..@ xtab: 4 x 4 sparse Matrix
    ..@ samp: data frame with 2 variables
    ..@ taxa: data frame with 2 variables
    ..@ join: left 
  > unclass(x3)
  <S4 Type Object>
  attr(,"xtab")
  4 x 4 sparse Matrix of class "dgCMatrix"
           Species.1 Species.2 Species.3 zero.pseudo
  Sample.1         3         .         .           .
  Sample.2        10         3         .           .
  Sample.3         .         .         4           .
  Sample.4         .         .         .           .
  attr(,"samp")
            samples var1
  Sample.1 Sample.1    1
  Sample.2 Sample.2    2
  Sample.3 Sample.3    1
  Sample.4 Sample.4    2
  attr(,"taxa")
                specnames var2
  Species.1     Species.1    b
  Species.2     Species.2    a
  Species.3     Species.3    b
  zero.pseudo zero.pseudo    a
  attr(,"join")
  [1] "left"
  > ## effects of left join, NULL taxa slot, xtab is (not sparse) matrix
  > (x4 <- Mefa(as.matrix(x1), samp[1:2,]))
  Object of class "Mefa"
    ..@ xtab: 4 x 4 sparse Matrix
    ..@ samp: data frame with 2 variables
    ..@ taxa: NULL
    ..@ join: left 
  > unclass(x4)
  <S4 Type Object>
  attr(,"xtab")
  4 x 4 sparse Matrix of class "dgCMatrix"
           Species.1 Species.2 Species.3 zero.pseudo
  Sample.1         3         .         .           .
  Sample.2        10         3         .           .
  Sample.3         .         .         4           .
  Sample.4         .         .         .           .
  attr(,"samp")
            samples var1
  Sample.1 Sample.1    1
  Sample.2 Sample.2    2
  Sample.3     <NA>   NA
  Sample.4     <NA>   NA
  attr(,"taxa")
  `\001NULL\001`
  attr(,"join")
  [1] "left"
  > ## effects of inner join (intersect)
  > (x5 <- Mefa(x2, samp, taxa, join="inner"))
  Object of class "Mefa"
    ..@ xtab: 3 x 4 sparse Matrix
    ..@ samp: data frame with 2 variables
    ..@ taxa: data frame with 2 variables
    ..@ join: inner 
  > unclass(x5)
  <S4 Type Object>
  attr(,"xtab")
  3 x 4 sparse Matrix of class "dgCMatrix"
           Species.1 Species.2 Species.3 zero.pseudo
  Sample.1         3         .         .           .
  Sample.2        10         3         .           .
  Sample.3         .         .         4           .
  attr(,"samp")
            samples var1
  Sample.1 Sample.1    1
  Sample.2 Sample.2    2
  Sample.3 Sample.3    1
  attr(,"taxa")
                specnames var2
  Species.1     Species.1    b
  Species.2     Species.2    a
  Species.3     Species.3    b
  zero.pseudo zero.pseudo    a
  attr(,"join")
  [1] "inner"
  > unclass(Mefa(x1, samp[1:2,], join="inner"))
  <S4 Type Object>
  attr(,"xtab")
  2 x 4 sparse Matrix of class "dgCMatrix"
           Species.1 Species.2 Species.3 zero.pseudo
  Sample.1         3         .         .           .
  Sample.2        10         3         .           .
  attr(,"samp")
            samples var1
  Sample.1 Sample.1    1
  Sample.2 Sample.2    2
  attr(,"taxa")
  `\001NULL\001`
  attr(,"join")
  [1] "inner"
  > ## xtab only Mefa
  > (x6 <- Mefa(x1))
  Object of class "Mefa"
    ..@ xtab: 4 x 4 sparse Matrix
    ..@ samp: NULL
    ..@ taxa: NULL
    ..@ join: left 
  > ## creating new Mefa object without Mefa()
  > new("Mefa", xtab=x1, samp=samp, taxa=taxa,join="left")
  Object of class "Mefa"
    ..@ xtab: 4 x 4 sparse Matrix
    ..@ samp: data frame with 2 variables
    ..@ taxa: data frame with 2 variables
    ..@ join: left 
  > 
  > ## 0 and 1 row/col Mefa object
  > x3[c(FALSE,FALSE,FALSE,FALSE),c(FALSE,FALSE,FALSE,FALSE)]
  Object of class "Mefa"
    ..@ xtab: 0 x 0 sparse Matrix
    ..@ samp: data frame with 2 variables
    ..@ taxa: data frame with 2 variables
    ..@ join: left 
  > x3[c(TRUE,FALSE,FALSE,FALSE),c(FALSE,FALSE,FALSE,FALSE)]
  Object of class "Mefa"
    ..@ xtab: 1 x 0 sparse Matrix
    ..@ samp: data frame with 2 variables
    ..@ taxa: data frame with 2 variables
    ..@ join: left 
  > x3[c(FALSE,FALSE,FALSE,FALSE),c(TRUE,FALSE,FALSE,FALSE)]
  Object of class "Mefa"
    ..@ xtab: 0 x 1 sparse Matrix
    ..@ samp: data frame with 2 variables
    ..@ taxa: data frame with 2 variables
    ..@ join: left 
  > x3[c(TRUE,FALSE,FALSE,FALSE),c(TRUE,FALSE,FALSE,FALSE)]
  Object of class "Mefa"
    ..@ xtab: 1 x 1 sparse Matrix
    ..@ samp: data frame with 2 variables
    ..@ taxa: data frame with 2 variables
    ..@ join: left 
  > 
  > ## Melt
  > x0 <- Xtab(count ~ sample + species, x)
  > x33 <- Xtab(count ~ sample + species + segment, x)
  > (M1 <- Melt(x0))
        rows      cols value
  1 Sample.1 Species.1     3
  2 Sample.2 Species.1    10
  3 Sample.2 Species.2     3
  4 Sample.3 Species.3     4
  > Melt(as.matrix(x0))
        rows      cols value
  1 Sample.1 Species.1     3
  2 Sample.2 Species.1    10
  3 Sample.2 Species.2     3
  4 Sample.3 Species.3     4
  > (M2 <- Melt(x33))
        rows      cols segm value
  1 Sample.1 Species.1    f     1
  2 Sample.2 Species.1    f    10
  3 Sample.3 Species.3    f     4
  4 Sample.1 Species.1    m     2
  5 Sample.2 Species.2    m     3
  > stopifnot(identical(Xtab(value ~ rows + cols, M1), x0))
  > stopifnot(identical(Xtab(value ~ rows + cols + segm, M2), x33))
  > 
  > ## stack
  > stack(x3)
                 samp        taxa values samp_samples samp_var1 taxa_specnames
  Sample.1   Sample.1   Species.1      3     Sample.1         1      Species.1
  Sample.2   Sample.2   Species.1     10     Sample.2         2      Species.1
  Sample.3   Sample.3   Species.1      0     Sample.3         1      Species.1
  Sample.4   Sample.4   Species.1      0     Sample.4         2      Species.1
  Sample.1.1 Sample.1   Species.2      0     Sample.1         1      Species.2
  Sample.2.1 Sample.2   Species.2      3     Sample.2         2      Species.2
  Sample.3.1 Sample.3   Species.2      0     Sample.3         1      Species.2
  Sample.4.1 Sample.4   Species.2      0     Sample.4         2      Species.2
  Sample.1.2 Sample.1   Species.3      0     Sample.1         1      Species.3
  Sample.2.2 Sample.2   Species.3      0     Sample.2         2      Species.3
  Sample.3.2 Sample.3   Species.3      4     Sample.3         1      Species.3
  Sample.4.2 Sample.4   Species.3      0     Sample.4         2      Species.3
  Sample.1.3 Sample.1 zero.pseudo      0     Sample.1         1    zero.pseudo
  Sample.2.3 Sample.2 zero.pseudo      0     Sample.2         2    zero.pseudo
  Sample.3.3 Sample.3 zero.pseudo      0     Sample.3         1    zero.pseudo
  Sample.4.3 Sample.4 zero.pseudo      0     Sample.4         2    zero.pseudo
             taxa_var2
  Sample.1           b
  Sample.2           b
  Sample.3           b
  Sample.4           b
  Sample.1.1         a
  Sample.2.1         a
  Sample.3.1         a
  Sample.4.1         a
  Sample.1.2         b
  Sample.2.2         b
  Sample.3.2         b
  Sample.4.2         b
  Sample.1.3         a
  Sample.2.3         a
  Sample.3.3         a
  Sample.4.3         a
  > 
  > ## accessing the xtab slot
  > xtab(x3)
  4 x 4 sparse Matrix of class "dgCMatrix"
           Species.1 Species.2 Species.3 zero.pseudo
  Sample.1         3         .         .           .
  Sample.2        10         3         .           .
  Sample.3         .         .         4           .
  Sample.4         .         .         .           .
  > ## replacing the slot value
  > x1[3,1] <- 999
  > xtab(x3) <- x1
  > xtab(x3)
  4 x 4 sparse Matrix of class "dgCMatrix"
           Species.1 Species.2 Species.3 zero.pseudo
  Sample.1         3         .         .           .
  Sample.2        10         3         .           .
  Sample.3       999         .         4           .
  Sample.4         .         .         .           .
  > 
  > ## accessing and replacing the samp slot
  > samp(x3)
            samples var1
  Sample.1 Sample.1    1
  Sample.2 Sample.2    2
  Sample.3 Sample.3    1
  Sample.4 Sample.4    2
  > samp(x3) <- NULL
  > samp(x3)
  NULL
  > samp(x3) <- samp[1:3,]
  > samp(x3)
            samples var1
  Sample.1 Sample.1    1
  Sample.2 Sample.2    2
  Sample.3 Sample.3    1
  Sample.4     <NA>   NA
  > 
  > ## accessing and replacing the taxa slot
  > taxa(x3)
                specnames var2
  Species.1     Species.1    b
  Species.2     Species.2    a
  Species.3     Species.3    b
  zero.pseudo zero.pseudo    a
  > taxa(x3) <- NULL
  > taxa(x3)
  NULL
  > taxa(x3) <- taxa[1:3,]
  > taxa(x3)
              specnames var2
  Species.1   Species.1    b
  Species.2   Species.2    a
  Species.3   Species.3    b
  zero.pseudo      <NA> <NA>
  > 
  > ## subsetting
  > unclass(x3[3:2, 1:2])
  <S4 Type Object>
  attr(,"xtab")
  2 x 2 sparse Matrix of class "dgCMatrix"
           Species.1 Species.2
  Sample.3       999         .
  Sample.2        10         3
  attr(,"samp")
            samples var1
  Sample.3 Sample.3    1
  Sample.2 Sample.2    2
  attr(,"taxa")
            specnames var2
  Species.1 Species.1    b
  Species.2 Species.2    a
  attr(,"join")
  [1] "left"
  > unclass(x3[3:2,])
  <S4 Type Object>
  attr(,"xtab")
  2 x 4 sparse Matrix of class "dgCMatrix"
           Species.1 Species.2 Species.3 zero.pseudo
  Sample.3       999         .         4           .
  Sample.2        10         3         .           .
  attr(,"samp")
            samples var1
  Sample.3 Sample.3    1
  Sample.2 Sample.2    2
  attr(,"taxa")
              specnames var2
  Species.1   Species.1    b
  Species.2   Species.2    a
  Species.3   Species.3    b
  zero.pseudo      <NA> <NA>
  attr(,"join")
  [1] "left"
  > unclass(x3[,1:2])
  <S4 Type Object>
  attr(,"xtab")
  4 x 2 sparse Matrix of class "dgCMatrix"
           Species.1 Species.2
  Sample.1         3         .
  Sample.2        10         3
  Sample.3       999         .
  Sample.4         .         .
  attr(,"samp")
            samples var1
  Sample.1 Sample.1    1
  Sample.2 Sample.2    2
  Sample.3 Sample.3    1
  Sample.4     <NA>   NA
  attr(,"taxa")
            specnames var2
  Species.1 Species.1    b
  Species.2 Species.2    a
  attr(,"join")
  [1] "left"
  > 
  > ## simple methods, dim, dimnames
  > dim(x5)
  [1] 3 4
  > dimnames(x5)
  [[1]]
  [1] "Sample.1" "Sample.2" "Sample.3"
  
  [[2]]
  [1] "Species.1"   "Species.2"   "Species.3"   "zero.pseudo"
  
  > dn <- list(paste("S", 1:dim(x5)[1], sep=""),
  +     paste("SPP", 1:dim(x5)[2], sep=""))
  > dimnames(x5) <- dn
  > unclass(x5)
  <S4 Type Object>
  attr(,"xtab")
  3 x 4 sparse Matrix of class "dgCMatrix"
     SPP1 SPP2 SPP3 SPP4
  S1    3    .    .    .
  S2   10    3    .    .
  S3    .    .    4    .
  attr(,"samp")
      samples var1
  S1 Sample.1    1
  S2 Sample.2    2
  S3 Sample.3    1
  attr(,"taxa")
         specnames var2
  SPP1   Species.1    b
  SPP2   Species.2    a
  SPP3   Species.3    b
  SPP4 zero.pseudo    a
  attr(,"join")
  [1] "inner"
  > dimnames(x5)[[1]] <- paste("S", 1:dim(x5)[1], sep="_")
  > unclass(x5)
  <S4 Type Object>
  attr(,"xtab")
  3 x 4 sparse Matrix of class "dgCMatrix"
      SPP1 SPP2 SPP3 SPP4
  S_1    3    .    .    .
  S_2   10    3    .    .
  S_3    .    .    4    .
  attr(,"samp")
       samples var1
  S_1 Sample.1    1
  S_2 Sample.2    2
  S_3 Sample.3    1
  attr(,"taxa")
         specnames var2
  SPP1   Species.1    b
  SPP2   Species.2    a
  SPP3   Species.3    b
  SPP4 zero.pseudo    a
  attr(,"join")
  [1] "inner"
  > dimnames(x5)[[2]] <- paste("SPP", 1:dim(x5)[2], sep="_")
  > unclass(x5)
  <S4 Type Object>
  attr(,"xtab")
  3 x 4 sparse Matrix of class "dgCMatrix"
      SPP_1 SPP_2 SPP_3 SPP_4
  S_1     3     .     .     .
  S_2    10     3     .     .
  S_3     .     .     4     .
  attr(,"samp")
       samples var1
  S_1 Sample.1    1
  S_2 Sample.2    2
  S_3 Sample.3    1
  attr(,"taxa")
          specnames var2
  SPP_1   Species.1    b
  SPP_2   Species.2    a
  SPP_3   Species.3    b
  SPP_4 zero.pseudo    a
  attr(,"join")
  [1] "inner"
  > 
  > ## transpose
  > x5
  Object of class "Mefa"
    ..@ xtab: 3 x 4 sparse Matrix
    ..@ samp: data frame with 2 variables
    ..@ taxa: data frame with 2 variables
    ..@ join: inner 
  > t(x5)
  Object of class "Mefa"
    ..@ xtab: 4 x 3 sparse Matrix
    ..@ samp: data frame with 2 variables
    ..@ taxa: data frame with 2 variables
    ..@ join: inner 
  > unclass(x5)
  <S4 Type Object>
  attr(,"xtab")
  3 x 4 sparse Matrix of class "dgCMatrix"
      SPP_1 SPP_2 SPP_3 SPP_4
  S_1     3     .     .     .
  S_2    10     3     .     .
  S_3     .     .     4     .
  attr(,"samp")
       samples var1
  S_1 Sample.1    1
  S_2 Sample.2    2
  S_3 Sample.3    1
  attr(,"taxa")
          specnames var2
  SPP_1   Species.1    b
  SPP_2   Species.2    a
  SPP_3   Species.3    b
  SPP_4 zero.pseudo    a
  attr(,"join")
  [1] "inner"
  > unclass(t(x5))
  <S4 Type Object>
  attr(,"xtab")
  4 x 3 sparse Matrix of class "dgCMatrix"
        S_1 S_2 S_3
  SPP_1   3  10   .
  SPP_2   .   3   .
  SPP_3   .   .   4
  SPP_4   .   .   .
  attr(,"samp")
          specnames var2
  SPP_1   Species.1    b
  SPP_2   Species.2    a
  SPP_3   Species.3    b
  SPP_4 zero.pseudo    a
  attr(,"taxa")
       samples var1
  S_1 Sample.1    1
  S_2 Sample.2    2
  S_3 Sample.3    1
  attr(,"join")
  [1] "inner"
  > 
  > ## aggregation, sums
  > groupSums(as.matrix(x2), 1, c(1,1,2))
    Species.1 Species.2 Species.3 zero.pseudo
  1        13         3         0           0
  2         0         0         4           0
  > groupSums(as.matrix(x2), 2, c(1,1,2,2))
            1 2
  Sample.1  3 0
  Sample.2 13 0
  Sample.3  0 4
  > groupSums(x2, 1, c(1,1,2))
  2 x 4 sparse Matrix of class "dgCMatrix"
    Species.1 Species.2 Species.3 zero.pseudo
  1        13         3         .           .
  2         .         .         4           .
  > groupSums(x2, 2, c(1,1,2,2))
  3 x 2 sparse Matrix of class "dgCMatrix"
            1 2
  Sample.1  3 .
  Sample.2 13 .
  Sample.3  . 4
  > groupSums(x5, 1, c(1,1,2))
  Object of class "Mefa"
    ..@ xtab: 2 x 4 sparse Matrix
    ..@ samp: NULL
    ..@ taxa: data frame with 2 variables
    ..@ join: inner 
  > groupSums(x5, 2, c(1,1,2,2))
  Object of class "Mefa"
    ..@ xtab: 3 x 2 sparse Matrix
    ..@ samp: data frame with 2 variables
    ..@ taxa: NULL
    ..@ join: inner 
  > ## aggregation, means
  > groupMeans(as.matrix(x2), 1, c(1,1,2))
    Species.1 Species.2 Species.3 zero.pseudo
  1       6.5       1.5         0           0
  2       0.0       0.0         4           0
  > groupMeans(as.matrix(x2), 2, c(1,1,2,2))
             1 2
  Sample.1 1.5 0
  Sample.2 6.5 0
  Sample.3 0.0 2
  > groupMeans(x2, 1, c(1,1,2))
  2 x 4 sparse Matrix of class "dgCMatrix"
    Species.1 Species.2 Species.3 zero.pseudo
  1       6.5       1.5         .           .
  2       .         .           4           .
  > groupMeans(x2, 2, c(1,1,2,2))
  3 x 2 sparse Matrix of class "dgCMatrix"
             1 2
  Sample.1 1.5 .
  Sample.2 6.5 .
  Sample.3 .   2
  > groupMeans(x5, 1, c(1,1,2))
  Object of class "Mefa"
    ..@ xtab: 2 x 4 sparse Matrix
    ..@ samp: NULL
    ..@ taxa: data frame with 2 variables
    ..@ join: inner 
  > groupMeans(x5, 2, c(1,1,2,2))
  Object of class "Mefa"
    ..@ xtab: 3 x 2 sparse Matrix
    ..@ samp: data frame with 2 variables
    ..@ taxa: NULL
    ..@ join: inner 
  > 
  > ## back and foth -- this is important to keep in the vignette
  > as.stcs(x1)
        samp        taxa count        segm
  1 Sample.1   Species.1     3   undefined
  2 Sample.2   Species.1    10   undefined
  3 Sample.2   Species.2     3   undefined
  4 Sample.3   Species.1   999   undefined
  5 Sample.3   Species.3     4   undefined
  6 Sample.4 zero.pseudo     0 zero.pseudo
  > as.mefa(x1)
  
  An object of class 'mefa' containing
  
   $ xtab: 1019 individuals of 4 taxa in 4 samples,
   $ segm: 1 (all inclusive) segment,
   $ samp: table for samples not provided,
   $ taxa: table for taxa not provided.
  
  > as.stcs(x3)
        samp        taxa count        segm
  1 Sample.1   Species.1     3   undefined
  2 Sample.2   Species.1    10   undefined
  3 Sample.2   Species.2     3   undefined
  4 Sample.3   Species.1   999   undefined
  5 Sample.3   Species.3     4   undefined
  6 Sample.4 zero.pseudo     0 zero.pseudo
  > (a <- as.mefa(x3))
  
  An object of class 'mefa' containing
  
   $ xtab: 1019 individuals of 4 taxa in 4 samples,
   $ segm: 1 (all inclusive) segment,
   $ samp: table for samples provided (2 variables),
   $ taxa: table for taxa provided (2 variables).
  
  > xtab(a)
           Species.1 Species.2 Species.3 zero.pseudo
  Sample.1         3         0         0           0
  Sample.2        10         3         0           0
  Sample.3       999         0         4           0
  Sample.4         0         0         0           0
  > samp(a)
            samples var1
  Sample.1 Sample.1    1
  Sample.2 Sample.2    2
  Sample.3 Sample.3    1
  Sample.4     <NA>   NA
  > taxa(a)
              specnames var2
  Species.1   Species.1    b
  Species.2   Species.2    a
  Species.3   Species.3    b
  zero.pseudo      <NA> <NA>
  > segm(a)
           Species.1 Species.2 Species.3 zero.pseudo
  Sample.1         3         0         0           0
  Sample.2        10         3         0           0
  Sample.3       999         0         4           0
  Sample.4         0         0         0           0
  > segm(x3)
  4 x 4 sparse Matrix of class "dgCMatrix"
           Species.1 Species.2 Species.3 zero.pseudo
  Sample.1         3         .         .           .
  Sample.2        10         3         .           .
  Sample.3       999         .         4           .
  Sample.4         .         .         .           .
  > as.Mefa(a)
  Object of class "Mefa"
    ..@ xtab: 4 x 4 sparse Matrix
    ..@ samp: data frame with 2 variables
    ..@ taxa: data frame with 2 variables
    ..@ join: left 
  > as.Xtab(a)
  4 x 4 sparse Matrix of class "dgCMatrix"
           Species.1 Species.2 Species.3 zero.pseudo
  Sample.1         3         .         .           .
  Sample.2        10         3         .           .
  Sample.3       999         .         4           .
  Sample.4         .         .         .           .
  > (s <- melt(a))
        samp        taxa count        segm
  1 Sample.1   Species.1     3   undefined
  2 Sample.2   Species.1    10   undefined
  3 Sample.2   Species.2     3   undefined
  4 Sample.3   Species.1   999   undefined
  5 Sample.3   Species.3     4   undefined
  6 Sample.4 zero.pseudo     0 zero.pseudo
  > as.Xtab(s)
  4 x 4 sparse Matrix of class "dgCMatrix"
           Species.1 Species.2 Species.3 zero.pseudo
  Sample.1         3         .         .           .
  Sample.2        10         3         .           .
  Sample.3       999         .         4           .
  Sample.4         .         .         .           .
  > as.Mefa(s)
  Object of class "Mefa"
    ..@ xtab: 4 x 4 sparse Matrix
    ..@ samp: NULL
    ..@ taxa: NULL
    ..@ join: left 
  > melt(x1)
        samp        taxa count        segm
  1 Sample.1   Species.1     3   undefined
  2 Sample.2   Species.1    10   undefined
  3 Sample.2   Species.2     3   undefined
  4 Sample.3   Species.1   999   undefined
  5 Sample.3   Species.3     4   undefined
  6 Sample.4 zero.pseudo     0 zero.pseudo
  > melt(x3)
        samp        taxa count        segm
  1 Sample.1   Species.1     3   undefined
  2 Sample.2   Species.1    10   undefined
  3 Sample.2   Species.2     3   undefined
  4 Sample.3   Species.1   999   undefined
  5 Sample.3   Species.3     4   undefined
  6 Sample.4 zero.pseudo     0 zero.pseudo
  > ## sparse matrix list
  > as.mefa(x33)
  
  An object of class 'mefa' containing
  
  Error in if (sum(x$xtab) == 1) " individual" else " individuals" : 
    missing value where TRUE/FALSE needed
  Calls: <Anonymous> -> print.mefa
  Execution halted