2

I'm learning to use the iNEXT package and when I run the code, I get this error:

Error in if (t > sum(y)) { : missing value where TRUE/FALSE needed

Here is a little fragment of my datase:

Localidad   n   MorfoSp1    MorfoSp2    MorfoSp3    MorfoSp4    MorfoSp6    MorfoSp7    MorfoSp8    MorfoSp9    MorfoSp10   MorfoSp11   MorfoSp12   MorfoSp13   MorfoSp14   MorfoSp15   MorfoSp16   MorfoSp17   MorfoSp18   MorfoSp19   MorfoSp20   MorfoSp21   MorfoSp22   MorfoSp23   MorfoSp24   MorfoSp25   MorfoSp26   MorfoSp27   MorfoSp28   MorfoSp29   MorfoSp30   MorfoSp31   MorfoSp32
Yat1    1   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   1
Yat1    2   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0
Yat1    2   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0

While using this code

    test=as.data.frame(t(Yat))

    names(test) <- as.matrix(test[1, ])
    test <- test[-1, ]
    test[] <- lapply(test, function(x) type.convert(as.character(x)))
    test

    iNEXT(test, q=1, datatype = "incidence_freq")
    read.table(Yat, header = T, as.is = F)

What could bring this error and how can I fix it or if the error is within the data.

  • 2
    Welcome to SO! You should provide a [minimal reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example). It should be [minimal, but complete and verifiable example](https://stackoverflow.com/help/minimal-reproducible-example). Your question should be clear and specific. Take the [tour](https://stackoverflow.com/tour) and read [How do I ask a good question?](https://stackoverflow.com/help/how-to-ask) --- This is most probably a problem with your `test` dataframe. You need to share that with us so we can help you. Read the link on how to share. – M-- Mar 13 '20 at 22:05
  • If the error is happening in your call to `iNEXT` (meaning it is nowhere in your own code), then I suggest you need to file an [issue with the `iNEXT` maintainers](https://github.com/JohnsonHsieh/iNEXT/issues). If the error is happening anywhere else, this is likely a duplicate of https://stackoverflow.com/q/7355187. – r2evans Mar 13 '20 at 22:16

0 Answers0