Treating "#" as a regular character when reading data

125 views Asked by At

I'm almost certain this has been asked before but due to a certain social media app I drowning in unrelated search results.

So the data set that I'm importing contains actual "#", as in Apartment #404, and I'd like to if possible preserve the character but R thinks it's an end of line or something. At first it would bomb out on the first occurrence, then I set fill=TRUE and now it just ignores the rest of the line after that.

How does one instruct R to treat #'s as regular characters?

1

There are 1 answers

0
MrFlick On

If you are not using "#" as a comment symbol in your data, you can use

read.table(..., comment.char="")

That should treat "#" like any other character.