[R] factor levels with umlauts

Christian Bieli christian.bieli at unibas.ch
Tue Oct 10 13:13:39 CEST 2006


Thanks for your answer.
I went round the problem by directly connect to the sql-database instead 
of generating a .csv file and then upload it.
This works perfectly with the RODBC package and is much more suitable, too.

Kind regards
Christian

Prof Brian Ripley schrieb:
> On Fri, 6 Oct 2006, Christian Bieli wrote:
>
>> Hi all
>>
>> I have to generate some test data for import in an sql database. The
>> database is meant for web-based data entry in a study taking place in a
>> german speaking region, so factor levels of the variables include 
>> umlauts.
>> The variables in the dataframe t.muster are generated e.g. like this:
>>
>> t.muster$screening <- rep("ausgefüllt",50)
>>
>> and exported to a .csv file by:
>>
>> write.table(t.muster,"MakeMuster041006/MusterDaten.csv",
>>    col.names=FALSE,row.names=FALSE,na="",sep=";")
>>
>> After export the factor level including an umlaut of t.muster$screening
>> look like this in the sql-database as well as in an excel spreadsheet:
>>
>> ausgefüllt
>
> I think the problem is rather how you imported them.  That is the 
> UTF-8 representation of the "ausgefüllt" viewed in a single-byte 
> locale.  R on Windows does not handle UTF-8, so something else has 
> done the conversion.
>
> [...]
>



More information about the R-help mailing list