[R] Why points() is defined specially for a 1 by 2 matrix?

Richard M. Heiberger rmh at temple.edu
Mon Oct 19 05:26:28 CEST 2009


 > points(x[4,],pch=2)# this is plotted as two points

drops what it sees as an unnecessary dimension.

Use

 > points(x[4,, drop=FALSE], pch=2)

See FAQ 7.5

tmp <- matrix(1:2)
tmp
tmp[,1]
tmp[,1,drop=FALSE]




More information about the R-help mailing list