I have discovered that some strings within my data frame contain hidden line break characters, though I can't tell exactly which (when loaded into gVim they simply show up as line breaks). The following code:
gsub("[\r\n]", "", x)
successfully removes the line breaks from within the strings. However, it also removes the line breaks separating the cells, making my data frame atomic instead of recursive. How can I target only the line breaks within the strings while keeping my data frame intact?
Here's a sample of the data:
dataframe$string_column <- sapply(dataframe$string_column, function(x) { gsub("[\r\n]", "", x) })
. That way it gets applied to the elements of the column rather than the entire dataframe – Punintended