Skip to content
Prev 161166 / 398500 Next

New to R - Errors in plotting

Hello -

In you example, what are the classes of x and y?

  x<-1:4
  y<-5:8
  plot(x,y)

class(x)
class(y)

In your 'real' data, what are the classes of A and B

class(A)
class(B)

One may be a factor?

How are you reading your data into R, read.table?  Make sure your data 
are numeric, then plot them, and it should do what you'd like.

Since you're new to R, one of my tips would be to learn the class() and 
str() functions.  Many functions, such as plot, operate differently 
depending on the class of data given to them, therefore it's very 
important to know the classes of your data objects.
BKMooney wrote: