Learn R Programming

tidysq (version 1.2.3)

as.character.sq: Convert sq object into character vector

Description

Coerces sequences from an sq object to character vector of sequences.

Usage

# S3 method for sq
as.character(x, ..., NA_letter = getOption("tidysq_NA_letter"))

Value

A character vector where each element represents the content of respective sequence in input sq object.

Arguments

x

[sq]
An object this function is applied to.

...

further arguments to be passed from or to other methods.

NA_letter

[character(1)]
A string that is used to interpret and display NA value in the context of sq class. Default value equals to "!".

Details

This method for sq class allows converting sequences from the sq object into a character vector of length equal to the length of input. Each element of resulting vector is a separate sequence. All attributes of the input sq are lost during the conversion to character vector.

See Also

Functions from output module: as.matrix.sq(), as.sq(), export_sq(), write_fasta()

Examples

Run this code
# Creating an object to work on:
sq_dna <- sq(c("CTGAATGCAGTACCGTAAT", "ATGCCGTAAATGCCAT", "CAGACCANNNATAG"),
             alphabet = "dna_ext")

# Converting sq object into a character vector:
as.character(sq_dna)

Run the code above in your browser using DataLab