[R] A question on graphical representation

David Carlson dcarlson at tamu.edu
Sat Mar 1 22:54:10 CET 2014


One possibility would be to use the absolute value of the
differences. Then they would be all positive:

abs(Info$Attr1 - Info$Attr2)
[1]  0.46  3.21  0.01  0.99  1.07 10.08

-------------------------------------
David L Carlson
Department of Anthropology
Texas A&M University
College Station, TX 77840-4352

-----Original Message-----
From: r-help-bounces at r-project.org
[mailto:r-help-bounces at r-project.org] On Behalf Of Ron Michael
Sent: Saturday, March 1, 2014 12:51 PM
To: r-help at r-project.org
Subject: [R] A question on graphical representation

Hi,

Let say I Have following data:

> Info <- structure(list(Person = structure(1:6, .Label = c("A",
"B", "C", 
+ "D", "E", "F"), class = "factor"), Attr1 = c(0.52, 0.14, 0.63,

+ 0.43, 0.89, 18.46), Attr2 = c(0.06, 3.35, 0.62, 1.42, 1.96,
8.38
+ )), .Names = c("Person", "Attr1", "Attr2"), row.names = c(NA, 
+ -6L), class = "data.frame")
> Info
  Person Attr1 Attr2
1      A  0.52  0.06
2      B  0.14  3.35
3      C  0.63  0.62
4      D  0.43  1.42
5      E  0.89  1.96
6      F 18.46  8.38
> Diff <- Info[, 'Attr1'] - Info[, 'Attr2']
> Diff
[1]  0.46 -3.21  0.01 -0.99 -1.07 10.08
> Overall_Diff <- sum(Diff)
> Overall_Diff
[1] 5.28



Now we see that the overall difference between attribute-1 and
attribute-2 for persons A-F is 5.28. Now I was asked this
question: tell me out of that overall difference, how much is
attributed to person A, person B,.... person F? In case the
'Diff' variable all have positive values, I probably consider
making a pie-chart. However this is not possible (probably) in
this present case, because some values are negative and some
values are positive.

So my question is how to build a robust graphical representation
to answer this question?

Your help will be highly appreciated.

Thanks for your pointer.

______________________________________________
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