convert string characters to list in R

I need convert strings like string below to list.

a = "ATTCCGGAACTTAA" ##string

b = list("A","T","T","C","C","G","G","A","A","C","T","T","A","A"). ##list

2

2 Answers

An option is to split with strsplit and convert to list with as.list

as.list(strsplit(a, "")[[1]]) 

You can try it with utf8ToInt and intToUtf8:

b <- Map(intToUtf8, as.list(utf8ToInt(a))) 

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like