Error in colSums(abund) : 'x' must be numeric

Hi! I know this is a common error, but I've been trying different things for a few days now and am still unable to solve my problem. I have this code:
myotutable <- read.csv("weightedandtaxa.csv", header = TRUE)
mymetadata <- read.delim("Qiime_18S_merged_copy.tsv", header = TRUE)
d <- amp_load(otutable = myotutable,
metadata = mymetadata)
Which is supposed to merge "myotutable" and "mymetadata" to form a new file called "d" which can be used for a number of visualizations! However, I keep getting the error message "Error in colSums(abund) : 'x' must be numeric". I'm not sure which file this error is referring to or how to fix it. My two files look like :

For my metadata table.

I'm supposed to be able to match the sample data from mymetadata with the taxonomic data from myotu, but it's not able to work. I tried running:

myotutable <- read.csv("weightedandtaxa.csv", header = TRUE)
mymetadata <- read.delim("Qiime_18S_merged_copy.tsv", header = TRUE)
mymetadata$Date <- as.character(metadata$Date)
mymetadata$Year <- as.character(metadata$Year)
mymetadata$Depth <- as.character(metadata$Depth)
mymetadata$Salinity <- as.numeric(metadata$Salinity)
mymetadata$Temperature <- as.numeric(metadata$Temperature)
mymetadata$Nitrate_and_Nitrite <- as.numeric(metadata$Nitrate_and_Nitrite)
mymetadata$Silicate <- as.numeric(metadata$Silicate)
mymetadata$Phosphate <- as.numeric(metadata$Phosphate)
mymetadata$Line <- as.character(metadata$Line)
d <- amp_load(otutable = myotutable,
metadata = mymetadata)

To define each category of data, but that didn't help. I'm very new to R, so any help will be much appreciated!

Hi, can you provide reproducible examples of your datasets?

Hi,
Thanks for your reply! I've been trying all morning to get a reproducible dataset, but my code

datapasta::df_paste(head(myotutable, 5)[,c('OTU', 'Phyla', 'Class', 'Order', 'Family', 'Genus', 'Species', 'Confidence', 'Gak 1 - Bottom', 'Gak 1 - DCM', 'Gak 1 - PC', 'Gak 1 - surface', 'Gak 11 - Bottom', 'Gak 11 - DCM')])

Keeps giving the error "Error in [.data.frame(head(myotutable, 5), , c("OTU", "Phyla", "Class", :
undefined columns selected".

The code

dput(head(myotutable, 1)[c("OTU", "Phyla", "Class", "Order", "Family", "Genus", "Species", "Confidence", "Gak 1 - Bottom", "Gak 1 - DCM", "Gak 1 - PC", "Gak 1 - surface", "Gak 11 - Bottom", "Gak 11 - DCM"),])

provides a response, but it does not contain any datapoints and is too long to be usable here. I'm hoping to provide a reprex to help my main problem but this code is proving difficult.
Screen Shot 2021-11-10 at 10.13.27 AM
Thanks for your help!

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.