How to change factor to string in R <p>I am working with a data frame that is a list of sequences</p> <pre><code>Alpha_Helix = xmlParse("AlphaTbl.Xml") all_seq = getNodeSet(Alpha_Helix, path = "//Protein/sequence", ) all_seq = xmlToDataFrame(all_seq) </code></pre> <p>I want to find the length of the sequences in each row and then carry out some other work with the sequences but am having trouble accessing them.</p> <p>When I try:</p> <pre><code>length(all_seq$text[1]) [1] 1 nchar(all_seq$text) Error in nchar(all_seq$text) : 'nchar()' requires a character vector nchar(all_seq$text[1]) Error in nchar(all_seq$text[1]) : 'nchar()' requires a character vector as.character(all_seq) # Works [1] "c(117, 91, 8)" </code></pre> <p>How can I access the strings too?</p>