Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

assign-sample_names

Replace OTU identifier names


Description

Replace OTU identifier names

Usage

sample_names(x) <- value

## S4 replacement method for signature 'ANY,ANY'
sample_names(x) <- value

## S4 replacement method for signature 'ANY,character'
sample_names(x) <- value

## S4 replacement method for signature 'otu_table,character'
sample_names(x) <- value

## S4 replacement method for signature 'sample_data,character'
sample_names(x) <- value

## S4 replacement method for signature 'phyloseq,character'
sample_names(x) <- value

Arguments

x

(Required). An object defined by the phyloseq-package that describes OTUs in some way.

value

(Required). A character vector to replace the current sample_names.

Examples

data("esophagus")
sample_names(esophagus)
# plot_tree(esophagus, color="sample_names", ladderize="left")
sample_names(esophagus) <- paste("Sa-", sample_names(esophagus), sep="")
sample_names(esophagus)
# plot_tree(esophagus, color="sample_names", ladderize="left") 
## non-characters are first coerced to characters.
sample_names(esophagus) <- 1:nsamples(esophagus)
sample_names(esophagus)
# plot_tree(esophagus, color="sample_names", ladderize="left") 
## Cannot assign non-unique or differently-lengthed name vectors. Error.
# sample_names(esophagus) <- sample(c(TRUE, FALSE), nsamples(esophagus), TRUE)
# sample_names(esophagus) <- sample(sample_names(esophagus), nsamples(esophagus)-1, FALSE)

phyloseq

Handling and analysis of high-throughput microbiome census data

v1.34.0
AGPL-3
Authors
Paul J. McMurdie <joey711@gmail.com>, Susan Holmes <susan@stat.stanford.edu>, with contributions from Gregory Jordan and Scott Chamberlain
Initial release
2019-04-23

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.