[R] import .csv file into R

R. Michael Weylandt michael.weylandt at gmail.com
Thu Feb 16 17:56:23 CET 2012


If you don't need to refer to colnames you should be fine.

If you do need to subset by colnames, you can still do it with `[`,
but you'll have trouble if you want to use the $ trick, unless you use
back-ticks. Don't worry about these things if they aren't troubling
you now though.

Michael

On Thu, Feb 16, 2012 at 11:48 AM, Marion Wenty <marion.wenty at gmail.com> wrote:
> David, thanks for the tips, though, I tried these arguments but it didn'
> work.
>
> Michael, thanks for your advice which worked, so far. I am using my object
> to create a barplot afterwards, which automatically puts the colnames
> besides the bars. Maybe this is still a good solution for my purpose as I
> don't need to work with the colnames afterwards?
>
> Thanks a lot!
>
> Marion
>
>
> Versuch es mal mit den Argumenten sep=";"  (oder das jeweilige Zeichen, das
> deine Felder abtrennt)
> und dec='.'  (oder ein anderes Zeichen für deine Kommastellen)
>
> Gruss
>
> 2012/2/16 R. Michael Weylandt <michael.weylandt at gmail.com>
>>
>> check.names=FALSE
>>
>> but it's discouraged because it will make it hard to refer to column
>> names inside R.
>>
>> Michael
>>
>> On Thu, Feb 16, 2012 at 11:18 AM, Marion Wenty <marion.wenty at gmail.com>
>> wrote:
>> > Dear r-helpers,
>> >
>> > I read  a .csv file into R
>> >
>> > with the following command:
>> >
>> > A<-read.csv2(file="Mappe3.csv")
>> >
>> > It worked fine, except that I would like to get rid of the points
>> > between
>> > the words and get spaces instead like I have got in the .csv file.
>> >
>> > At the moment it looks like the following:
>> >
>> > habe.mich.gut.mit.KlassenkollegInnen.verstanden
>> > hatte.gutes.Verhältnis.zu.Eltern
>> > fühlte.mich.von.LehrerInnen.respektiert
>> > 1                                              88
>> >         86                                      74
>> >  fühlte.mich.von.LehrerInnen.ausreichend.gefördert
>> > Eltern.konnten.mir.beim.Lernen.helfen
>> > 1                                                62
>> >                41
>> >
>> >
>> > So far I couldn't find out how to do this. Could anyone help me with
>> > this?
>> >
>> >
>> > Many Thanks in advance!
>> >
>> >
>> > Marion
>> >
>> >        [[alternative HTML version deleted]]
>> >
>> >
>> > ______________________________________________
>> > R-help at r-project.org mailing list
>> > https://stat.ethz.ch/mailman/listinfo/r-help
>> > PLEASE do read the posting guide
>> > http://www.R-project.org/posting-guide.html
>> > and provide commented, minimal, self-contained, reproducible code.
>> >
>
>



More information about the R-help mailing list