[R] Simple x,y Plot

Peter Ehlers ehlers at ucalgary.ca
Sun Jul 29 18:53:36 CEST 2012


On 2012-07-29 08:18, sappy wrote:
> Dear Community,
>
> i have read in a table with two column from a *txt-File. What i get is a
> data-frame wit two column.
> After that i allocate this 2 column to x and y. Plotting this, i obtain a
> picture that looks like a bar plot (something like a grid).
> Is that because x and y is in factor-formatted? A conversion with
> "asnumeric" doesnt work. I get a vector with "NA".

Why don't you run str(daten) on the data.frame to see what you
actually imported? It's a good idea to always run a str() after
reading data.

And I wouldn't use 'real' as a colClass (although it does have
an 'as' method); I don't see it mentioned on the help page for
read.table.

Peter Ehlers

>
> Here is my code:
>
> daten<-read.table("C:/Users/Robert/Desktop/regen.txt", header=FALSE,
> colClasses=c("real","real"))
> x<-daten[,1]
> y<-daten[,2]
> plot(x,y)
>
> Greetings
>
>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/Simple-x-y-Plot-tp4638262.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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