Related
I have this matrix of pathway analysis. Genes in each pathway gets 1 if not 0. I also have fold change for genes. I tried to plot this but fold change being confused with absence and pretense of genes like :
I have tried
heatmap(m)
dput(m)
structure(c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1,
1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0,
0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 1, 0,
1, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1,
1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0,
1, 1, 1, 1, -0.903826171835163, -0.247705285294349, -0.401239527828149,
-1.20189443333319, -0.758305343685411, -1.10106389326754, -0.585488441571586,
-0.610209849183418, -1.28841166063443, -1.2443689942311, -0.44380661806954,
-0.393767679922636, -0.9865911233588, -1.16638985537113, -0.846196153682942,
-1.08069734237831, -0.585488441571586, -0.501442757103725, -1.09515274600357,
-1.28841166063443, -0.758305343685411, -0.358909656766957, -0.435604213681894,
-0.233037798755743, -0.401239527828149, -1.28841166063443, -0.563163557390339,
-1.08069734237831, -0.247705285294349, -0.903826171835163, -0.9865911233588,
0.377359646511066, 0.453386357728066, 1.70862112102298, 0.532342427101257,
1.61935728655752, 1.15211775940032, 0.265720938549918, 0.420856476956162,
0.377359646511066, 0.350765937539292, 0.276646264257092), .Dim = c(42L,
8L), .Dimnames = list(c("CCL2", "CCL4", "CD40", "CLCF1", "CSF3",
"CXCL5", "CXCL6", "CXCL8", "IL1B", "IL6", "IL6R", "LTB", "OSM",
"TNFRSF1B", "TNFSF10", "FOS", "FOSL1", "MMP3", "PTGS2", "TNFAIP3",
"BCL2A1", "BIRC3", "CFLAR", "DDX58", "GADD45B", "TIRAP", "EDN1",
"SOCS3", "IGF2", "JAK1", "NR4A1", "CACNA1D", "CALML5", "CALML6",
"CCNA2", "CCND2", "CDK6", "MAPK1", "RBL1", "CDC6", "CDKN2C",
"SMC3"), c("Cytokine-cytokine receptor interaction", "IL-17 signaling",
"NF-kappa B signaling", "TNF signaling", "PI3K-Akt signaling",
"Cellular senescence", "Cell cycle", "Log2FC")))
> head(m)
Cytokine-cytokine receptor interaction IL-17 signaling
CCL2 1 1
CCL4 1 0
CD40 1 0
CLCF1 1 0
CSF3 1 1
CXCL5 1 1
NF-kappa B signaling TNF signaling PI3K-Akt signaling
CCL2 0 1 0
CCL4 1 0 0
CD40 1 0 0
CLCF1 0 0 0
CSF3 0 0 1
CXCL5 0 1 0
Cellular senescence Cell cycle Log2FC
CCL2 0 0 -0.9038262
CCL4 0 0 -0.2477053
CD40 0 0 -0.4012395
CLCF1 0 0 -1.2018944
CSF3 0 0 -0.7583053
CXCL5 0 0 -1.1010639
>
Can you help to solve this?
heatmap(as.matrix(m[,1:7])) should do the trick.
I have 8 age categories as 8 separate columns. Each column has a value between 1 and 3. I want to compute a new column that holds the average age per row.
This is my data:
structure(list(`2.5` = c(0, 0, 0, 1, 1, 2, 1, 2, 0, 0, 1, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 2, 0,
0, 2, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 2, 0, 0, 0, 0,
0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, 0, 0, 2, 0, 0, 0,
0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 2, 0, 2, 2,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 2, 0, 2, 0, 1, 0, 0, 0, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0,
0, 1, 0, 0, 0, 0, 2, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 2, 0, 0, 0,
0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 3,
0, 0, 1), `9` = c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0,
1, 0, 0, 0, 0, 2, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
0, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,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 1, 0, 2, 0, 0, 0, 2, 0, 1,
2, 0, 2, 0, 1, 1, 0, 0, 0, 2, 0, 0, 1, 2, 2, 2, 0, 2, 0,
0, 0, 0, 0, 1, 2, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 2, 0, 0,
0, 0, 0, 0, 0, 0, 0, 2, 0, 1, 2, 2, 2, 0, 0, 0, 0, 0, 0,
0, 0, 2, 0, 1, 0, 2, 0, 0, 0, 2, 2, 0, 0, 0, 1, 0, 0, 1,
0, 0, 1, 1, 2, 0, 0, 1, 0, 0, 2, 0, 0, 0, 0, 0, 1, 0, 0,
0, 1, 2, 0, 1, 0, 1, 0, 0), `72` = c(2, 0, 0, 0, 1, 0, 0,
0, 0, 0, 0, 2, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 2,
0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 2, 0, 1,
0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 2, 0, 2, 0, 0, 0, 2,
0, 0, 2, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 2, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0,
0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 2, 1, 0, 0,
0, 1, 0, 2, 0, 0, 0, 1, 0, 0, 0, 2, 1, 0, 0, 0, 0, 1, 0,
0, 2, 1, 0, 0, 0, 0)), row.names = c(NA, -204L), class = c("data.table",
"data.frame"))
First, create a temporary data frame where you calculate the ages from column names. Then, with rowSums calculate average ages. (Supposed your data frame is called d.)
tmp <- do.call(cbind, lapply(seq(d), function(x) d[x] * as.numeric(colnames(d)[x])))
d$mu <- rowSums(tmp) / rowSums(d)
head(d)
# 2.5 9 15.5 21.5 29.5 42 57 72 mu
# 1 0 0 0 0 0 0 0 2 72.00000
# 2 0 0 0 0 1 0 1 0 43.25000
# 3 0 0 0 0 2 0 0 0 29.50000
# 4 1 0 0 0 0 2 0 0 28.83333
# 5 1 0 0 0 1 1 0 1 36.50000
# 6 2 0 0 0 0 2 0 0 22.25000
apply is a useful option, where 1 tells it to compute by row. It also seems to play nicely with data.tables:
df$means <- apply(df, 1, function(r) sum(r * as.double(names(df))) / sum(r))
#### OUTPUT ####
2.5 9 15.5 21.5 29.5 42 57 72 means
1: 0 0 0 0 0 0 0 2 72.00000
2: 0 0 0 0 1 0 1 0 43.25000
3: 0 0 0 0 2 0 0 0 29.50000
4: 1 0 0 0 0 2 0 0 28.83333
5: 1 0 0 0 1 1 0 1 36.50000
---
200: 0 0 0 0 0 0 1 1 64.50000
201: 3 0 0 0 0 2 0 0 18.30000
202: 0 0 1 0 0 1 1 0 38.16667
203: 0 0 0 0 1 1 0 0 35.75000
204: 1 1 0 0 0 2 0 0 23.87500
Here is a base R one-liner where we multiply values in the columns of dataframe by its names, calculate the sum of column values and divide by its rowSums.
df$result <- colSums(t(df) * as.numeric(names(df)))/rowSums(df)
head(df)
# 2.5 9 15.5 21.5 29.5 42 57 72 result
#1 0 0 0 0 0 0 0 2 72.00000
#2 0 0 0 0 1 0 1 0 43.25000
#3 0 0 0 0 2 0 0 0 29.50000
#4 1 0 0 0 0 2 0 0 28.83333
#5 1 0 0 0 1 1 0 1 36.50000
#6 2 0 0 0 0 2 0 0 22.25000
I'm trying to do some factor analysis on some ordinal data I have, i.e. Likert scale questionnaires going from 0 to 5.
I have been reading about how this should be approached since it is not continuous data. I then found the following paper:
http://pareonline.net/pdf/v19n5.pdf
And from that, even though he uses a different program than R, it seems that when dealing with ordinal data, it is a must to use the polychoric correlation, and he also suggests minimum rank factor analysis for the factor method. I'm a bit unsure if the Promin rotation he suggests is available in R ?
Anyway, when trying to perform this analysis in R I try to use the following code from the psych package:
fa(data, cor = "poly", fm = "minrank")
However, when doing so I get the error (even if I put in the term nfactors = <some number>:
Error in glb.algebraic(S) : 'Cov' is not symmetric
I also get a lot of warnings saying In log(P) : NaNs produced.
I have no idea what is wrong here, and how to fix it ? My data set (the one I'm using now) is just a 219 x 19 matrix with values going from 0 to 5, and no blank cells at all.
Am I doing something wrong here, or...?
EDIT:
The header of the data:
# A tibble: 6 x 19
`Pt id` Q1 Q2 Q3 Q4 Q7 Q8 Q10 Q12 Q15 Q17 Q18 Q20 Q21 Q22 Q23 Q24
<dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 304 5 4 5 0 3 5 0 4 1 4 4 4 4 4 4 4
2 474 5 1 5 0 3 5 0 4 1 4 0 0 0 4 4 0
3 509 5 5 4 5 3 5 0 4 1 0 0 4 4 4 4 4
4 232 5 1 4 0 3 1 0 4 0 0 0 0 0 3 3 0
5 254 5 2 3 0 3 4 0 2 1 0 0 0 1 2 2 0
6 372 5 2 3 0 3 2 0 2 0 0 1 0 0 4 4 0
# ... with 2 more variables: Q25 <dbl>, Q26 <dbl>
And all the data from dput:
structure(list(`Pt id` = c(304, 474, 509, 232, 254, 372, 388,
493, 283, 296, 305, 468, 257, 258, 362, 353, 471, 210, 213, 234,
314, 319, 332, 336, 339, 350, 357, 359, 363, 365, 370, 385, 411,
417, 436, 455, 461, 462, 495, 521, 317, 211, 204, 299, 373, 405,
423, 328, 349, 497, 202, 207, 215, 239, 245, 250, 293, 294, 297,
303, 310, 326, 341, 369, 379, 416, 430, 433, 442, 448, 456, 477,
486, 503, 520, 337, 382, 407, 498, 249, 262, 266, 438, 510, 320,
309, 267, 292, 335, 206, 216, 237, 251, 269, 324, 343, 355, 360,
375, 395, 399, 403, 404, 412, 424, 440, 457, 500, 288, 244, 279,
311, 342, 389, 447, 508, 291, 318, 439, 209, 224, 229, 275, 277,
330, 368, 390, 394, 406, 459, 469, 476, 479, 523, 201, 203, 205,
218, 219, 222, 225, 226, 227, 231, 236, 238, 242, 247, 248, 260,
261, 264, 271, 272, 278, 285, 298, 300, 301, 306, 323, 327, 329,
331, 333, 340, 345, 347, 351, 356, 358, 361, 364, 366, 367, 371,
376, 377, 378, 384, 397, 398, 400, 401, 402, 408, 413, 414, 419,
420, 425, 431, 437, 441, 444, 450, 451, 452, 453, 458, 460, 463,
466, 470, 483, 487, 492, 502, 505, 506, 511, 515, 517), Q1 = c(5,
5, 5, 5, 5, 5, 5, 5, 5, 5, 1, 5, 3, 4, 5, 5, 4, 0, 5, 5, 0, 0,
5, 5, 0, 3, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 0, 0, 0, 0, 5, 3, 0,
4, 4, 0, 3, 1, 4, 3, 0, 3, 5, 5, 0, 5, 2, 0, 0, 3, 0, 3, 0, 0,
4, 5, 4, 5, 5, 1, 0, 0, 0, 5, 0, 0, 2, 5, 4, 1, 1, 0, 3, 5, 1,
5, 0, 3, 1, 5, 3, 0, 1, 0, 0, 0, 0, 4, 1, 1, 0, 0, 1, 5, 0, 3,
0, 3, 5, 5, 0, 1, 4, 1, 0, 1, 4, 3, 0, 1, 0, 0, 2, 2, 4, 0, 1,
3, 3, 0, 4, 0, 0, 1, 0, 2, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 3,
2, 3, 0, 0, 5, 3, 0, 3, 0, 3, 0, 2, 0, 0, 0, 0, 0, 0, 3, 0, 0,
5, 4, 3, 0, 3, 3, 0, 0, 0, 0, 0, 0, 0, 1, 5, 0, 0, 2, 0, 0, 0,
0, 0, 1, 0, 0, 5, 0, 1, 2, 0, 0, 0, 0, 1, 0, 0, 5, 1, 0, 0, 0,
0, 0), Q2 = c(4, 1, 5, 1, 2, 2, 4, 4, 1, 2, 1, 1, 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 0, 0, 0,
1, 0, 0, 0, 0, 3, 0, 0, 0, 0), Q26 = c(3, 0, 2, 0, 2, 0,
1, 1, 0, 1, 1, 0, 3, 0, 0, 0, 2, 0, 1, 0, 0, 0, 0, 0, 0,
0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 2, 0, 0, 0, 0, 0, 0, 1,
2, 1, 1, 0, 2, 2, 0, 0, 0, 4, 0, 4, 0, 0, 0, 0, 0, 1, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 2, 0, 0, 2, 0, 1, 0,
1, 0, 3, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0,
0, 0, 0, 0, 2, 0, 2, 0, 0, 0, 0, 1, 0, 2, 4, 0, 0, 0, 0,
0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 0, 0,
0, 2, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0,
0, 1, 0, 1, 0, 0, 2, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1,
1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)), .Names = c("Pt id",
"Q1", "Q2", "Q3", "Q4", "Q7", "Q8", "Q10", "Q12", "Q15", "Q17",
"Q18", "Q20", "Q21", "Q22", "Q23", "Q24", "Q25", "Q26"), row.names = c(NA,
-213L), class = c("tbl_df", "tbl", "data.frame"))
So basically some questionnaires/Likert scale values coupled to a patient ID.
I have information from science papers, where there are binary data on funding source (government (GVT) - yes/no), and categorical data on lead author nationality (LEAD).
This code counts the number of GTV funded papers per lead nation:
gvt.funding=aggregate(data.frame(count=sysrev$GVT),
list(value=sysrev$GVT),length)
gvt.not=format(round(((gvt_funding[1,2]/(gvt_funding[1,2]+
gvt_funding[2,2]))*100),1),nsmall=1)
gvt.yes=format(round(((gvt_funding[2,2]/(gvt_funding[1,2]+
gvt_funding[2,2]))*100),1),nsmall=1)
This code produces the following table:
gvt.not gvt.yes gvt.not(%) gvt.yes(%)
CAN 39 143 21.42857 78.571429
DEU 7 7 50.00000 50.000000
DNK 9 35 20.45455 79.545455
GBR 10 5 66.66667 33.333333
JPN 2 8 20.00000 80.000000
NOR 20 49 28.98551 71.014493
RUS 13 1 92.85714 7.142857
USA 84 104 44.68085 55.319149
TOTAL 214 373 36.45656 63.543441
I need a table aggregated pr year looking like this:
YEAR CAN-GVTyes CAN% DEU-GVTyes DEU% USA-GVTyes USA% etc.
2015 .... .. .... .. .... ..
2014 .... .. .... .. .... ..
2013 .... .. .... .. .... ..
etc
Appreciate any help. Below is an DPUT excerpt of data:
structure(list(YR = c(2015, 2015, 2015, 2015, 2015, 2015, 2015,
2015, 2015, 2015, 2015, 2015, 2014, 2014, 2014, 2014, 2014, 2014,
2014, 2014, 2014, 2014, 2014, 2014, 2014, 2014, 2014, 2014, 2014,
2014, 2014, 2014, 2014, 2014, 2013, 2013, 2013, 2013, 2013, 2013,
2013, 2013, 2013), NRAUTH = c(6, 7, 3, 22, 10, 4, 23, 4, 4, 11,
9, 6, 7, 9, 4, 6, 1, 3, 5, 4, 7, 5, 3, 2, 2, 4, 7, 4, 26, 6,
2, 4, 6, 5, 7, 5, 7, 3, 3, 2, 6, 3, 3), LEAD = structure(c(12L,
5L, 2L, 2L, 12L, 12L, 12L, 11L, 12L, 2L, 5L, 5L, 4L, 4L, 12L,
12L, 11L, 9L, 2L, 2L, 12L, 12L, 1L, 8L, 2L, 12L, 12L, 10L, 4L,
1L, 6L, 12L, 12L, 12L, 4L, 5L, 7L, 2L, 3L, 12L, 12L, 2L, 2L), .Label = c("AUS",
"CAN", "COS", "DEU", "DNK", "GBR", "GRL", "KOR", "NOR", "POL",
"RUS", "USA"), class = "factor"), CAN = c(0, 1, 1, 1, 1, 1, 1,
0, 0, 1, 1, 0, 0, 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S", "NATX",
"ALL", "AB", "BB", "BS", "CS", "DS", "EG", "FB", "GB", "KB",
"KS", "LS", "LP", "MC", "NB", "NW", "SB", "SH", "VM", "WH", "GVT",
"NGO", "COM", "ACA", "FUNDX", "FUNDNN", "POPSTAT", "POPABU",
"POPTR", "BOUND", "HARV", "CC", "HAB", "HABP", "POLL", "SHIP",
"TOUR", "BEH", "REPEC", "ZOO", "PHYS", "TEK", "HWC", "PRED",
"METH", "DIS", "ANA", "POPGEN", "EVO", "RESIMP", "ISSUE", "PROT",
"PA", "PEFF"), row.names = c(NA, -43L), class = "data.frame")
In my data (DPUT below) I have many categorical binary parameters holding various information about scientific papers. These are all 0=absent/no or 1=present/yes. Does the study have government funding, yes or no? Is harvest discussed in the paper, yes or no? And so on, for more than 30 parameters. I also have the nationality of the lead author. One thing I am trying to do is to have a look at the total fraction of studies being funded from governments (GVT), and the same fraction per country.
This code gives a matrix on the number of studies not funded by GVT, and those funded by GVT:
gvt_funding=aggregate(data.frame(count=sysrevt$GVT),list(value=sysrevt$GVT),length)
which gives the matrix:
value count
0 32
1 66
Then I calculate the percentage of total:
gvt.not=format(round(((gvt_funding[1,2]/(gvt_funding[1,2]+
gvt_funding[2,2]))*100),1),nsmall=1)
gvt.yes=format(round(((gvt_funding[2,2]/(gvt_funding[1,2]+
gvt_funding[2,2]))*100),1),nsmall=1)
Now I want to append these percentages in a new column in the matrix, change the name of these two columns to "TOTAL"and "TOTAL%", and then to calculate the same ratios and percentages for all nations (as shown by the column "LEAD"), and append these ratios and percentages to the same matrix with matching column titles.
It is quite possible that there are several more elegant ways to do this, but this is as far as I have come...
Here's the data:
structure(list(YR = c(2015, 2015, 2015, 2015, 2015, 2015, 2015,
2015, 2015, 2015, 2015, 2015, 2014, 2014, 2014, 2014, 2014, 2014,
2014, 2014, 2014, 2014, 2014, 2014, 2014, 2014, 2014, 2014, 2014,
2014, 2014, 2014, 2014, 2014, 2013, 2013, 2013, 2013, 2013, 2013,
2013, 2013, 2013), NRAUT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0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), PA = c(0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), PEFF = c(0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)), .Names = c("YR",
"NRAUTH", "LEAD", "CAN", "DNK", "GRL", "USA", "NOR", "RUS", "NATX",
"ALL", "AB", "BB", "BS", "CS", "DS", "EG", "FB", "GB", "KB",
"KS", "LS", "LP", "MC", "NB", "NW", "SB", "SH", "VM", "WH", "GVT",
"NGO", "COM", "ACA", "FUNDX", "FUNDNN", "POPSTAT", "POPABU",
"POPTR", "BOUND", "HARV", "CC", "HAB", "HABP", "POLL", "SHIP",
"TOUR", "BEH", "REPEC", "ZOO", "PHYS", "TEK", "HWC", "PRED",
"METH", "DIS", "ANA", "POPGEN", "EVO", "RESIMP", "ISSUE", "PROT",
"PA", "PEFF"), row.names = c(NA, -43L), class = "data.frame")
Like this?
tab <- addmargins(table(sysrevt$LEAD, sysrevt$GVT), 1)
tab <- cbind(tab, 100 * prop.table(tab, 1))
colnames(tab) <- c('gvt.not', 'gvt.yes', 'gvt.not(%)', 'gvt.yes(%)')
rownames(tab)[nrow(tab)] <- 'TOTAL'
round(tab, 2)
The output is
gvt.not gvt.yes gvt.not(%) gvt.yes(%)
AUS 1 1 50.00 50.00
CAN 1 8 11.11 88.89
COS 1 0 100.00 0.00
DEU 1 3 25.00 75.00
DNK 0 4 0.00 100.00
GBR 1 0 100.00 0.00
GRL 0 1 0.00 100.00
KOR 1 0 100.00 0.00
NOR 0 1 0.00 100.00
POL 1 0 100.00 0.00
RUS 1 1 50.00 50.00
USA 7 9 43.75 56.25
TOTAL 15 28 34.88 65.12