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
Encoding("Tomáš Rosický") # with latin1 response
but was not sure where to go from there to get the original name with accents back. Played around with iconv without success
I would be satisfied (and might even prefer) an output of "Tomas Rosicky"
To be able to use special characters within a function such as gsub, we have to add two backslashes (i.e. \\) in front of the special character. …the next R syntax replaces the question mark… Looks good! We can use the previous type of R code for basically any special character.
To add accent marks to letters in foreign words, Microsoft Word users can utilize the following keyboard shortcuts to add the accent marks. For example, to get the character ñ, press the Ctrl and Shift Keys while pressing the ~ key (tilde key). Then, release all three keys and quickly press the n key.
For example, to type a ô, hold down CTRL, SHIFT and ^, release and type o.
You've read in a page encoded in UTF-8. if x
is your column of names, use Encoding(x) <- "UTF-8"
.
You should use this:
df$colname <- iconv(df$colname, from="UTF-8", to="LATIN1")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With