ascii2char: Converting ASCII encoded values to character values.

Share:

Description

ascii2char calculates character representations for given phred values. char2ascii returns phred values for given ASCII encoded representations (the reverse transformation of ascii2char).

Usage

1
2
ascii2char(x,multiple = FALSE)
char2ascii(c)

Arguments

x

numeric. Vector with ASCII values. All values must be in 1:255. Other values produce an error.

multiple

logical. For 'FALSE' (the default), all characters are combined into one single string (i.e. a character vector of length 1). For 'TRUE', single characters are combined into a vector.

c

character. Vector of length 1 (Longer vectors will generate Warnings).

Details

The functions are only wrappers for convenience. char2ascii is defined as strtoi(charToRaw(c), base = 16L). ascii2char is defined as rawToChar(as.raw(x), multiple).

Value

ascii2char returns character. char2ascii returns integer.

Author(s)

Wolfgang Kaisers

References

Ewing B, Green P Base-Calling of Automated Sequencer Traces Using Phred. II. Error Probabilities Genome Research 1998 8(3): 186-194

See Also

getPhredTable

Examples

1
2
3
4
5
ascii2char(97:101,multiple=FALSE)
ascii2char(97:101,multiple=TRUE)
char2ascii("abcde")
char2ascii(paste("a","b","c",collapse=""))
ascii2char(char2ascii("abcde"))

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.