Hello,

Below is some output that shows my issue.

I have a variable x that I read from a file (more on this below)

x
[1] "NEW YORK NEW ENGLAND"
gsub(" -", "-", x)            # this does not work!
[1] "NEW YORK NEW ENGLAND"
Encoding(x)                   # is x in a special encoding? no
[1] "unknown"
y = "NEW YORK -NEW ENGLAND"   # I type in variable y
gsub(" -", "-", y)            # and gsub works as expected
[1] "NEW YORK-NEW ENGLAND"


I'm sure the problem has to do with the way I read the variable x. But even if I change the encoding for x to ASCII, I still cannot do the sub. I get x by reading a pdf file with pdftotext so you will not be able to replicate my issue.

Thanks for any suggestions,
Adrian

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to