JohnsonHsieh / iNEXT

R package for interpolation and extrapolation
https://JohnsonHsieh.github.com/iNEXT
57 stars 26 forks source link

Incidence_raw error message #29

Open andyspeak opened 6 years ago

andyspeak commented 6 years ago

I have tree species data from 3 assemblages which have around 90 plots each. I wanted to take the incidence_raw approach and managed to get my data exactly the same format as the ciliates example dataset. Therefore I have a list of 3 matrices, each matrices being species - plot with a 0 for absence and 1 for presence. However iNEXT never works and the error message says: Error in data.frame(site = rownames(out), out) : arguments imply differing number of rows: 0, 3

Does anyone have an idea what my problem is? I can alter the data to run an incidence_freq analysis but I think I will lose some information doing it this way.

update - I tried with incidence_freq, with a list of vectors, and got the exact same error message! update 2 - I finally got it to work with incidence_freq but by naming the list elements. I tried different combinations for my incidence_raw data though and still doesnt work. Please explain EXACTLY what format the data need to be in for it to work.

BErfanian commented 6 years ago

Hi, First enter your data as species*plot matrix, then use a transform function like decostand in vegan to convert your data to P/A, then use the as.abucount function of iNEXT to make incidence-fre data, Then sort your data (descending), make a list using the sorted data and implement the number of sample in the beginning of each data of your 3 assemblages, some thing like below: " $ class1 (number of samples), (your sorted incidence-fre data) " Then use iNEXT function, good luck.

austenapigo commented 6 years ago

Hi Andy,

I ran into the same issue and it took me awhile to figure this out.

(1) You should load the function described here (ggiNEXT.iNEXT) into your R environment: https://github.com/JohnsonHsieh/iNEXT/issues/25 (2) Your list of data frames or matrices must be named (just like the ciliates example). You can try skipping the names(data.list) part below and you'll get the same error message as you stated above.

I've listed an example below with the BCI dataset from the vegan package --

library(ggplot2) library(vegan) library(iNEXT)

data(BCI) t.BCI <- as.data.frame(t(BCI))

BCI.1 <- t.BCI[1:225, 1:15] BCI.1 <- as.matrix((BCI.1 > 0) + 0)

BCI.2 <- t.BCI[1:225, 16:27] BCI.2 <- as.matrix((BCI.2 > 0) + 0)

BCI.3 <- t.BCI[1:225, 28:30] BCI.3 <- as.matrix((BCI.3 > 0) + 0)

data.list <- list(BCI.1, BCI.2, BCI.3)

names(data.list) <- c("BCI.1", "BCI.2", "BCI.3")

out.raw <- iNEXT(data.list, datatype="incidence_raw", endpoint=100) ggiNEXT.iNEXT(out.raw)

thalita-arruda commented 3 years ago

Thanks a lot Austen. It just worked for me :)