sample_names<- {phyloseq} | R Documentation

## 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)

[Package phyloseq version 1.26.1 Index]