I am doing some web scraping of names into a dataframe
For a name such as \"Tomáš Rosický, I get a result \"Tomáš Rosický\"
I tried
Enco
A way to export accents correctly:
enc2utf8(as(dataframe$columnname, "character"))
You've read in a page encoded in UTF-8. if x is your column of names, use Encoding(x) <- "UTF-8".
To do a correct read of the file use the scan function:
namb <- scan(file='g:/testcodering.txt', fileEncoding='UTF-8',
what=character(), sep='\n', allowEscapes=T)
cat(namb)
This also works:
namc <- readLines(con <- file('g:/testcodering.txt', "r",
encoding='UTF-8')); close(con)
cat(namc)
This will read the file with the correct accents
You should use this:
df$colname <- iconv(df$colname, from="UTF-8", to="LATIN1")