[R] ploting a comparison of two scores, including the labels in the plot
Hans Ekbrand
hans.ekbrand at gmail.com
Thu Nov 1 14:12:58 CET 2007
Hello r-help!
I have data with two kind of ratings on status of 100 occupations. The
first kind of rating is on the percieved "objective" status that these
occupations have in society at large, and the second kind or rating is
on the status that the respondents think that these occuption *should*
have.
The ratings were originally integer values in the rage 1-9, but in the
current data, I use their mean values.
Here is an printout for the first 10 occupations: (the occupation
names are in swedish)
> data.frame(myobj[1:10, c("YRKE", "SAMHM", "INDM")], row.names = "YRKE")
SAMHM INDM
Ambassadör 8.32 7.2771
Läkare ("doctor") 8.15 8.1029
Domare ("judge") 8.14 7.5965
Professor 8.13 7.5618
Advokat ("lawyer") 7.95 7.1876
Pilot 7.81 7.4380
Verkställande direktör 7.78 6.8361
Forskare ("scientist" 7.60 7.6630
Civilingenjör ("engineer") 7.47 6.8802
Statsråd ("minister") 7.41 6.3916
>
I would like to make a plot with two lists. The first list should list
the occupations ordered by "SAMHM" (as in the printout above) and the
values of SAMH. The linespacing in this list should be increased by
the difference in SAMH between the the occupations (i.e. between
"Ambassadör" and "Läkare" (eng. "doctor") there should be a larger
linespaceing than between "Läkare" and "Domare" (eng. "judge")).
The second list should be like the first, but based on "INDM" instead
of "SAMH".
These two list should ideally be plotted side by side with lines
connecting each occuption.
Here is an ascii-art illustration of what I intend (excluding the
connecting lines, which are hard to draw with ascii :-)
--------------------------------------
Ambassadör
Läkare ("doctor")
Domare ("judge")
Professor Läkare
Advokat ("lawyer")
Pilot
Verkställande direktör
Forskare ("scientist") Forskare
Domare
Civilingenjör ("engineer") Professor
Statsråd ("minister") Pilot
Ambassadör
Advokat
Civilingenjör
Verkställande direktör
Statsråd
----------------------------------------------
If printing strings (labels) with different linespacing turns out to
be problematic, another solution would be to print a list of the
occupations ordered by "SAMH", points of "SAMH" values (with
Y="SAMH"), points of "INDM" (with Y="INDM") and a list of occupations
ordered by "INDM", with a line for each occupation connecting the
labels with the points and the two points that represents the
occupation.
Since there are a lot of functions for ploting and I am new to R, I
would like advise on what packages/functions that should be used to
get what I want (if what I want is possible to achieve with R, if it
is not, then please let me know).
Sample code is, of course, also very much appreciated.
kind regards,
--
Hans Ekbrand (http://sociologi.cjb.net) <hans at sociologi.cjb.net>
A. Because it breaks the logical sequence of discussion
Q. Why is top posting bad?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : https://stat.ethz.ch/pipermail/r-help/attachments/20071101/e2c9cdd9/attachment.bin
More information about the R-help
mailing list