Skip to content
Prev 701 / 63424 Next

R-alpha: Minor plotting problems

1) There's a curious asymmetry between points and lines, in that you can
do
lines(...,type='p')
but not
points(...,type='l')
(and more importantly, not points(..., type='b'), which probably
*could* arise in real work)

This isn't deliberate, is it?

2) Did I remember to report the adverse effect of having plot(x,y)
coerce its argument to numeric? Several of my students managed to set
the data type to "character" in data.entry(), do a plot(bw,rmr) with
no apparent problem, and *then* become absolutely perplexed when
lm(rmr~bw) yields

Error in model.frame(formula, data, substitute(list(...)), subset,
na.action) : invalid variable type

3) The first few lines of hist() should be

        if (!is.numeric(x)) 
                stop("hist: x must be numeric")
        eval(main)
        eval(xlab)
        x <- x[!is.na(x)]
 
The two 'eval's are necessary to avoid strange side effects of
modifying x.