[R] Problems with labels and scaling in star diagrams

Greg Snow Greg.Snow at imail.org
Mon Apr 19 21:11:15 CEST 2010


For number 2, do the scaling yourself so that all values are between 0 and 1, then use scale=FALSE in the call to stars.

For number 3 try stardata[1,,drop=FALSE]

Don't have a good suggestion for 1 (though you could look at the code to see where the legend is plotted and move that code to the regular stars for your own custom copy of the function).

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at imail.org
801.408.8111


> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of Euan Reavie
> Sent: Friday, April 16, 2010 7:33 PM
> To: r-help at r-project.org
> Subject: [R] Problems with labels and scaling in star diagrams
> 
> 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.
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-
> guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list