"Error in G * t(hat) : non-conformable arrays" error in adonis(), in Vegan , in R

FishyStats picture FishyStats · Sep 16, 2013 · Viewed 7.2k times · Source

ANSWERED: A single NA value in any column in either data.frame can cause this error.


I have a rather frustrating problem that I need help with. I'm trying to run a permanova in R, and I'm using adonis() in Vegan to do it. I have a species by sample data.frame, 249 rows by 16 columns (species names as column.names), and a separate data.frame of 249 rows by 3 columns, containing my environmental covariates. I'm using the code below to run it, and I get the error above. I've run adonis on some very, very similar data without issue, and I'm not sure what's wrong this time through.

Any suggestions? Thanks a ton.


Code

SpeciesADONIS <- adonis(ScreenedSpeciesbySample ~ AvgSalinity + AvgTurbidity +
        AvgDO + AvgSalinity * AvgTurbidity + AvgSalinity*AvgDO + 
        AvgTurbidity * AvgDO,
    data = RegPhysDriversTimeSeries2,
    permutations=999, method="bray")

Species by Sample head (created using dput)

ScreenedSpeciesbySample <- 
    structure(list(
        "Gulf menhaden" = c(0.05, 0.05, 0.01, 0.02, 0.00471, 0.01), 
        "Hardhead catfish" = c(0, 0, 0, 0.26, 0.00107, 0.04), 
        "White shrimp" = c(0.00298, 9.2e-06, 0.04, 0.13, 0.36, 0.01), 
        "Atlantic croaker" = c(0.01, 0.14, 0.44, 0.25, 0.08, 0.05), 
        "Black drum" = c(0, 0, 0, 0.12, 0, 0), 
        "Gafftopsail catfish" = c(0, 0, 0, 0, 0, 0), 
        "Striped mullet" = c(0.46, 0, 0, 0, 0, 0), 
        "Brown shrimp" = c(0, 0, 0, 0, 0.32, 0.04), 
        "Spotted seatrout" = c(0, 0, 0, 0, 0, 0), 
        "Spot" = c(0.11, 0.41, 3.02e-05, 0.02, 0.00021, 0.00271), 
        "Gizzard shad" = c(0, 0.17, 0, 0, 0, 0), 
        "Red drum" = c(0, 0, 0, 0, 0, 0), 
        "Bay anchovy" = c(0.00164, 0, 0, 0, 0.000127, 8.84e-05), 
        "Atlantic cutlassfish" = c(0, 0, 0, 0, 0.01, 0.49), 
        "Sand seatrout" = c(0, 0, 0, 0.04, 0.03, 0), 
        "Blue crab" = c(494.27, 583.35, 705.43, 476.09, 3103.18, 1699.67)), 
        .Names = c("Gulf menhaden", 
            "Hardhead catfish", "White shrimp", "Atlantic croaker", "Black drum", 
            "Gafftopsail catfish", "Striped mullet", "Brown shrimp", "Spotted seatrout", 
            "Spot", "Gizzard shad", "Red drum", "Bay anchovy", "Atlantic cutlassfish", 
            "Sand seatrout", "Blue crab"), 
        row.names = c(NA, 6L), 
        class = "data.frame")

Physical covariates head (created using dput)

RegPhysDriversTimeSeries2 <- 
    structure(list(
      AvgSalinity = c(14.88, 14.84, 5.7, 4.8, 9.5, 11.41), 
      AvgTurbidity = c(29.5, 53.53, 109.71, 109.48, 73.69, 39.37), 
      AvgDO = c(11.19, 8.18, 8.37, 14.39, 10.61, 7.94)),
      .Names = c("AvgSalinity", "AvgTurbidity", "AvgDO"), 
      row.names = c(NA, 6L),
      class = "data.frame")

Answer