[R] substitution of the ASCII character "squared" AKA "^2" AKA (alt+0178) with a tractable one

Rui Barradas rui1174 at sapo.pt
Tue Apr 10 16:25:55 CEST 2012


To use the octal code works with me.

# I've created a file with that byte only.
x <- readLines("ascii0178")
y <- c(as.character(1:4), x, as.character(6:10))

grep("\262", y) # should return 5
gsub("\262", "HERE", y)

Hope this helps,

Rui Barradas

View this message in context: http://r.789695.n4.nabble.com/substitution-of-the-ASCII-character-squared-AKA-2-AKA-alt-0178-with-a-tractable-one-tp4545664p4545777.html
Sent from the R help mailing list archive at Nabble.com.

More information about the R-help mailing list