I am trying to remove samples from my  otu_table  in a phyloseq object  ps . This is so I can match the samples in my  sample_data  (which does not have the samples stated below as I removed them due to NAs). I'm using this:
to_remove <- c("Sample1", "Sample5", "Sample10", "Sample30")
# using z first to see if it works 
z <- prune_samples(ps@otu_table, !(sample_names() %in% to_remove))
but I get an error:
# Error in (function (classes, fdef, mtable) : unable to find an inherited method for function ‘prune_samples’ for signature ‘"otu_table", "logical"’
How do I fix this?