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

Peng Yu pengyu.ut at gmail.com
Mon Oct 19 05:46:10 CEST 2009


On Sun, Oct 18, 2009 at 10:26 PM, Richard M. Heiberger <rmh at temple.edu> wrote:
>> 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]

Can I specify 'drop' to FALSE by default so that I don't have to
specify it explicitly?




More information about the R-help mailing list