0

I have worked on that for over a week now and it is not working still. I am using the package ''RAM'' in r and more specifically the OTU.diversity function:

*Summarize Diversity Indices for OTU Tables

Description

These functions calculate diversity indices for all samples and append outputs as new columns to metadata table.

Usage

OTU.diversity(data, meta) Arguments data a list of OTU tables. meta the metadata to append the outputs.

Details

This function summarize the following diversity indices: specnumber, shannon, simpson, invsimpson, true diversity, evenness, chao and ACE indices, for a given otu table.

Value

This function return vectors of diversity indices for each sample, which are appended to a given metadata table.*

My command line is:

tabletemp <- read.table(paste(pathDataAn, "ITS.table.tsv", sep = ""),
                  sep = "\t", header = TRUE, dec = ".", comment.char = "", quote = "", stringsAsFactors = TRUE,
                  as.is = TRUE, check.names = FALSE, colClasses=c("row.names"="character", "taxonomy"="character"))
tabletemp$row.names <- NULL
metatemp <-  read.table(paste(pathDataAn, "ITS.meta.tsv", sep = ""),
                  sep = "\t", header = TRUE, dec = ".", comment.char = "", quote = "", stringsAsFactors = TRUE,
                  as.is = TRUE)
temp2 <- OTU.diversity(list(data=tabletemp), metatemp)

and the output says this:

Error in .valid.meta(otu, meta = meta) : Sample names for otu1 and meta differ. They may be out of order. In otu1, not in meta: EM13S01RV EM13S02RV EM13S03FW EM13S03RV...(lists of all my samples) In meta, not in otu1:

1, 2, 3, ...

I have verified that each header is the same and in the exact same order. They all are correctly arranged. Please help me, I do not understand why it does not seem to read these tables properly.

  • I know this may be hard for your case, but can you please include data and/or code that will provide us with a [reproducible example](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) ? – Ben Bolker Nov 18 '16 at 14:44

1 Answers1

0

over the weekend I figured that I needed to tell the software that columns headers (OTU table) match rows names (metadata table)

rownames(metatemp) <- colnames(tabletemp)[-ncol(tabletemp)]