import CSV Files containing German Umlauts into R

2019-06-21 08:40发布

问题:

I am working with R Studio and need to import a csv File for Text mining. The File is windows-1252 encoded and contains German Umlauts.

However I cannot get R to import these Umlauts correctly. using read.table(X,fileEncoding="UTF-8") results in an error.

What am I missing?

----UPDATE----

The File I am trying to read is: https://drive.google.com/file/d/0B4kGh2YwTmb9U3hkei1TTHlUME0/edit?usp=sharing

Using this R Code:

Sys.setlocale("LC_CTYPE", "german") dataset <- read.table("../processed/DE_all_CDM_201405050001_DE_all_CDM2014-05-05_rcout.csv", encoding="UTF-8", header=TRUE, sep=";", stringsAsFactors=F, as.is=T) dataset <- dataset[,c(1,11,30)] Encoding(dataset[,2]) <- "UTF-8"

回答1:

Ok, I just found out that this is a R Studio GUI issue. If I run my code in the R console it würls fine.



标签: r import