Replies: 1 comment
-
Your colnames (specifically the first one) seem to contain some undesired patterns - try renaming. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am trying to create a task object from a phyloseq object (contains OTU table, metadata, and read counts). I have pulled out what I need and made it into a data frame with the rows being the sample names and the columns being the bacteria type count. Then I have a column attached at the end with the metadata that I am trying to predict from. This is how I set it up:
#Generating relative abundance table
phyloseq_relative_abundance <- transform_sample_counts(phyloseq_genus, function(x) x/sum(x))
taxa_are_rows(phyloseq_relative_abundance) ##Taxa should be in column
#phyloseq_relative_abundance <- load("phyloseq_object.rds")
asv_relative_abundance <- otu_table(phyloseq_relative_abundance)
asv_relative_abundance<-t(asv_relative_abundance)
asv_relative_abundance<-as.data.frame(asv_relative_abundance)
metadata <- sample_data(phyloseq_relative_abundance);metadata ## metadata
metadata<-as.data.frame(metadata)
metadata<-metadata[,2];metadata
#Creating one table containing all the information we need for the classification
model_decomp<- as.data.frame(cbind(asv_relative_abundance, "stage.number" = metadata$stage.number))
When I go to make the training task object:
trainTask<- makeClassifTask(data =model_decomp, target = "stage.number")
I get this:
Error in makeTask(type = type, data = data, weights = weights, blocking = blocking, :
Assertion on 'data' failed: Must have colnames according to R's variable naming conventions, but element 1 does not comply.
I have tried to make that metadata column a factor and that doesn't; work either. I am trying to run a multiclass regression.
Beta Was this translation helpful? Give feedback.
All reactions