Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Treating "#" as a regular character when reading data

Tags:

r

hashtag

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?

like image 587
Paul Ledin Avatar asked Sep 12 '26 17:09

Paul Ledin


1 Answers

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.

like image 55
MrFlick Avatar answered Sep 14 '26 06:09

MrFlick



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!