[R] How is label parameter used in text() when passing it a vector?
mviljamaa at kapsi.fi
Thu Oct 20 19:33:38 CEST 2016
I have a slight doubt with using text() with the label parameter having
to contain a vector of of integers (specifically integers in the range
[1, 21] corresponding to factors of my categorical variable that I want
to numbers to tell).
What I'm currently plotting is the following command:
text(dta[trt == 0 & skin == 1 & gender == 0,]$age,invlogit(predict(fit5,
newdata=dta[trt == 0 & skin == 1 & gender == 0,])),label=1:21, col =
dta[trt == 0 & skin == 1 & gender == 0,]$exposure)
(it's a plot of a logistic model)
$exposure is the categorical variable that takes values of integers in
the range [1, 21]. The coloring seems to work, but I'm not sure whether
label=1:21 makes it so that it actually labels the point with the
corresponding exposure level or whether it just walks through 1 to 21
and 1 to 21 over and over again.
Can someone explain?
Also how can I get the label parameter to put the number of the level of
the exposure as the corresponding point?
More information about the R-help