Combining objects

Thanks a bunch, FJCC.
This is proofing to be a great task.

I am stuck again. Here it is:
I convert to the matrix and then combined all the objects and then change it to one table

class (otu_table_p)
[1] "data.frame"

class (taxonomy_p)
[1] "data.frame"
class (metadata_p)
[1] "data.frame"
otu_table_p = as.matrix (otu_table_p)
taxonomy_p = as.matrix (taxonomy_p)
class (otu_table_p)
[1] "matrix"
class (metadata_p)
[1] "data.frame"
[1] "matrix"
AFM_tree = read_tree ("C:/Users/User/Desktop/qiime2-1st/phyloseq/tree.nwk" , errorIfNULL=FALSE)
[1] "phylo"
AFM_otu = otu_table (otu_table_p, taxa_are_rows = TRUE)
AFM_tax = tax_table (taxonomy_p)
AFM_sampledata = sample_data (metadata_p)

physeq_AFM = phyloseq(AFM_otu, AFM_tax, AFM_sampledata, AFM_tree)

Error in validObject(.Object) : invalid class “phyloseq” object:
Component sample names do not match.
Try sample_names()

I cannot get where I made the mistake.
Kindly help, thanks.

hi everyone

Still waiting to get help with this.


What are the objects? What packages are you using? Can you provide a reproducible example?

Thanks for your reply.

I think my major issue is the versions of packages.
I need help with how to merge packages versions with R Studio
I am using R studio version 3.6.1
I need to use packages such as phyloseq, ggplot2, tibble, dplyr, etc
I have this message when I was trying to load the packages:

Attaching package: ‘dplyr’

The following objects are masked from ‘package:stats’:

filter, lag

The following objects are masked from ‘package:base’:

intersect, setdiff, setequal, union

Warning message:
package ‘dplyr’ was built under R version 3.6.3

Warning message:
package ‘tibble’ was built under R version 3.6.3

Please, how do I resolve a package version with a particular R Stuudio?
Thanks and regards.
(Please note R Studio version is 3.6.1)

The dplyr packages just mask the base packages, but that shouldn't be an issue. You can just use them if you want, using base::union.

Your R version of 3.6.3 is really old. R is in the 4s now:

Hi William
Thanks for your help.

Everything works after uninstalling/reinstalling and updating both R and RStudio on my machine.


1 Like

This topic was automatically closed 7 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.