On Tue, 2007-11-27 at 13:01 -0500, Carlos Gershenson wrote: > Hi all, > > Let us have: > > x<-1:10 > y<-x/2 > plot(table(x), type="p") > points(table(y), pch=2) > > > Why does the last command plots the values of table(y) using the x > coordinates of table(x)??? > Am I doing something wrong? > What would be a way of plotting the points of table(y) on their place? > > #this problem also occurs with: > plot(table(y), type="p") > points(table(x), pch=2) > > > Thank you very much, > Carlos
Hi Carlos In your command plot(table(y), type="p"), you plot a numeric part of table(y), in this case: y 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 1 1 1 1 1 1 1 1 1 1 So you plot the number 1 always. Same for table (x). Have two possible solutions: plot(as.numeric(names(table(x))), type="p") points(as.numeric(names(table(y))), pch=2) OR x<-1:10 y<-x/2 plot(x, type="p") points(y, pch=2) If you need more help send a mail -- Bernardo Rangel Tura, M.D,MPH,Ph.D National Institute of Cardiology Brazil ______________________________________________ [email protected] 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.

