[R] Problems with labels and scaling in star diagrams
Euan Reavie
euan.reavie at gmail.com
Sat Apr 17 03:32:54 CEST 2010
I have the following small dataset:
> stardata
NS HE EB CW RW PW
1 0 0.000 0.000 0.042 0.006 0
2 0 0.006 0.000 0.013 0.005 0
3 0 0.000 0.011 0.000 0.000 0
I have plotted the star diagrams as follows:
stars(stardata,
key.labels = dimnames(stardata)[[2]],
labels = NULL,
key.loc = NULL,
draw.segments=TRUE,
col.segments="gray",
lty="blank")
I am having three problems. I welcome solutions for any or all of
them, or recommendations for a specific package or function that would
be better suited to my needs.
1. How do I add labels (dimnames(stardata)[[2]]) to all of the
segments, the same way they are added to the segments of the key
(which I haven't included)? The hard way would be to use the text
function with six coordinates for the variables, but surely there's an
easier way?
2. It took me a while to realize that each segment is scaled based on
the maximum for that variable (column). I would like to treat each row
independently so that all segments are scaled based on the maximum for
that row. Possible?
3. I figured one way around problem 2 would be to reduce the dataset
to one row (e.g. stardata[1,]) but that gives me an error "incorrect
number of dimensions" when I try to generate the diagram. So, I seem
to be unable to plot a single star diagram; it must be two or more.
Many thanks - Euan.
Euan Reavie, University of Minnesota Duluth.
More information about the R-help
mailing list