[R] Dotchart and its arguments

Robert Zimbardo robertz|mb@rdo @end|ng |rom gm@||@com
Thu Feb 21 05:12:09 CET 2019


Hi all

I was recently trying to customise a dotchart of a matrix

dats <- matrix(1:6, nrow=2, dimnames=list(R=letters[1:2], C=letters[14:16]))
dotchart(dats)

with pch and pt.cex and noticed some irregularities, namely that R
doesn't use the values in the positions it uses for plotting also for
the arguments of the dotchart function:

dotchart(dats, pch=as.character(dats))       # wrong
dotchart(dats, pch=as.character(dats[,3:1])) # right
dotchart(dats, pch=as.character(dats[,3:1]), pt.cex=dats)       # wrong
dotchart(dats, pch=as.character(dats[,3:1]), pt.cex=dats[,3:1]) # right

Is this a bug or a feature (whose purpose then I don't get)?

Thanks



More information about the R-help mailing list