I'm trying to import a csv file with a data frame:
pc2020 <- read.table("pc2020.csv", sep = ";", header = TRUE)
This works ok, but the enconding is wrong, thus, I get all messed up accentuated characters.
So, I'm trying with:
pc2020 <- read.table("pc2020.csv", sep = ";", header = TRUE, fileEncoding = "UTF-8")
That returns:
Error in read.table("pc2020.csv", sep = ";", header = TRUE, fileEncoding = "UTF-8") :
no lines available in input
In addition: Warning message:
In read.table("pc2020.csv", sep = ";", header = TRUE, fileEncoding = "UTF-8") :
invalid input found on input connection 'pc2020.csv'
You can use read.csv()
function with the same attributes you used with read.table
. Except fileEncoding
- in read.csv()
you should write just encoding = "UTF-8"
.
Also Duck's answer is suitable, too.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.