Subsetting summary statistics by group with the describe
function
# Creates summary statistics for each continent grouping, and puts results in list named "summary_stats_by_continent"
summary_stats_by_continent<-describeBy(pt_copy, pt_copy$continent)
# Accessing continent-level summary statistics for africa from the "summary_stats_by_continent" list
summary_stats_by_continent[["africa"]]
## vars n mean sd median trimmed mad min max range skew
## oecd 1 11 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 NaN
## country* 2 11 6.00 3.32 6.00 6.00 4.45 1.00 11.00 10.00 0.00
## pind 3 11 0.77 0.42 1.00 0.83 0.00 0.00 1.00 1.00 -1.06
## pindo 4 11 0.77 0.42 1.00 0.83 0.00 0.00 1.00 1.00 -1.06
## ctrycd 5 11 647.55 154.90 684.00 685.56 56.34 199.00 754.00 555.00 -2.13
## col_uk 6 11 0.82 0.40 1.00 0.89 0.00 0.00 1.00 1.00 -1.43
## t_indep 7 11 36.64 19.77 35.00 33.89 5.93 9.00 89.00 80.00 1.38
## col_uka 8 11 0.69 0.35 0.86 0.74 0.02 0.00 0.92 0.92 -1.31
## col_espa 9 11 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 NaN
## col_otha 10 11 0.15 0.33 0.00 0.07 0.00 0.00 0.96 0.96 1.58
## legor_uk 11 11 0.82 0.40 1.00 0.89 0.00 0.00 1.00 1.00 -1.43
## legor_so 12 11 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 NaN
## legor_fr 13 11 0.18 0.40 0.00 0.11 0.00 0.00 1.00 1.00 1.43
## legor_ge 14 11 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 NaN
## legor_sc 15 11 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 NaN
## prot80 16 11 22.17 20.23 25.80 19.96 19.57 0.10 64.20 64.10 0.46
## catho80 17 11 19.46 13.67 18.70 18.07 13.20 1.90 49.60 47.70 0.71
## confu 18 11 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 NaN
## avelf 19 11 0.71 0.14 0.73 0.73 0.15 0.38 0.84 0.46 -1.15
## govef 20 11 5.37 0.82 5.02 5.25 0.68 4.56 7.26 2.70 0.97
## graft 21 11 5.11 0.77 5.39 5.12 0.80 3.93 6.23 2.30 -0.17
## logyl 22 11 7.93 0.78 7.75 7.90 0.53 6.95 9.13 2.18 0.42
## loga 23 11 7.38 0.66 7.33 7.37 0.55 6.28 8.58 2.29 0.03
## yrsopen 24 11 0.21 0.29 0.16 0.15 0.18 0.00 1.00 1.00 1.72
## gadp 25 11 0.55 0.12 0.54 0.55 0.12 0.37 0.74 0.37 0.28
## engfrac 26 11 0.02 0.04 0.00 0.02 0.00 0.00 0.09 0.09 0.95
## eurfrac 27 11 0.07 0.17 0.00 0.03 0.00 0.00 0.57 0.57 2.24
## frankrom 28 11 2.90 0.51 2.94 2.86 0.56 2.19 3.95 1.77 0.54
## latitude 29 11 -9.14 15.17 -15.81 -9.58 8.49 -29.13 14.77 43.90 0.44
## gastil 30 11 3.59 1.16 4.00 3.66 1.32 1.61 4.89 3.28 -0.48
## cgexp 31 10 27.00 7.63 25.50 27.10 8.58 14.65 38.57 23.92 0.06
## cgrev 32 9 26.15 10.36 23.81 26.15 6.14 17.24 50.85 33.61 1.40
## ssw 33 6 1.67 1.46 0.94 1.67 0.58 0.44 3.80 3.36 0.52
## rgdph 34 11 1899.87 1832.60 1116.28 1522.39 738.30 530.22 6666.77 6136.54 1.50
## trade 35 11 77.34 32.13 69.17 76.87 27.13 30.83 128.12 97.29 0.31
## prop1564 36 11 54.23 4.91 53.23 53.51 2.96 49.05 65.95 16.90 1.19
## prop65 37 11 3.28 1.16 2.80 3.06 0.65 2.34 6.26 3.92 1.47
## federal 38 11 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 NaN
## eduger 39 11 73.95 23.54 73.55 73.64 25.47 40.05 110.67 70.62 0.08
## spropn 40 10 0.27 0.42 0.00 0.21 0.00 0.00 1.00 1.00 0.92
## yearele 41 8 1982.50 13.48 1990.50 1982.50 5.19 1965.00 1994.00 29.00 -0.41
## yearreg 42 8 1982.50 13.48 1990.50 1982.50 5.19 1965.00 1994.00 29.00 -0.41
## seats 43 11 151.20 109.96 122.22 136.21 86.65 37.33 400.00 362.67 0.92
## maj 44 11 0.73 0.47 1.00 0.78 0.00 0.00 1.00 1.00 -0.88
## pres 45 11 0.64 0.50 1.00 0.67 0.00 0.00 1.00 1.00 -0.49
## lyp 46 11 7.22 0.81 7.02 7.15 0.88 6.27 8.80 2.53 0.53
## semi 47 11 0.18 0.40 0.00 0.11 0.00 0.00 1.00 1.00 1.43
## majpar 48 11 0.18 0.40 0.00 0.11 0.00 0.00 1.00 1.00 1.43
## majpres 49 11 0.55 0.52 1.00 0.56 0.00 0.00 1.00 1.00 -0.16
## propres 50 11 0.09 0.30 0.00 0.00 0.00 0.00 1.00 1.00 2.47
## dem_age 51 11 1975.82 24.77 1989.00 1981.11 7.41 1910.00 1994.00 84.00 -1.57
## lat01 52 11 0.17 0.08 0.18 0.17 0.05 0.00 0.32 0.32 -0.28
## age 53 11 0.12 0.12 0.05 0.09 0.04 0.03 0.45 0.42 1.57
## polityIV 54 11 2.34 5.56 0.22 2.42 6.75 -6.00 10.00 16.00 0.07
## spl 55 8 -1.55 4.52 -1.54 -1.55 1.91 -6.77 8.23 15.00 0.98
## cpi9500 56 9 5.70 1.15 5.90 5.70 1.14 3.93 7.55 3.61 0.01
## du_60ctry 57 11 0.27 0.47 0.00 0.22 0.00 0.00 1.00 1.00 0.88
## magn 58 11 0.71 0.41 1.00 0.75 0.00 0.02 1.00 0.98 -0.58
## sdm 59 9 0.71 0.45 1.00 0.71 0.00 0.03 1.00 0.97 -0.67
## oecd.x 60 11 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 NaN
## mining_gdp 61 10 8.43 11.70 4.10 5.89 5.71 0.02 37.20 37.18 1.39
## gini_8090 62 9 50.25 9.95 54.00 50.25 11.86 35.36 62.30 26.94 -0.19
## con2150 63 11 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 NaN
## con5180 64 11 0.27 0.47 0.00 0.22 0.00 0.00 1.00 1.00 0.88
## con81 65 11 0.73 0.47 1.00 0.78 0.00 0.00 1.00 1.00 -0.88
## list 66 11 49.83 119.87 0.00 16.46 0.00 0.00 400.00 400.00 2.22
## maj_bad 67 11 2.73 2.05 3.83 2.80 1.56 0.00 4.89 4.89 -0.32
## maj_gin 68 9 37.31 22.84 41.35 37.31 18.75 0.00 62.00 62.00 -0.71
## maj_old 69 11 0.06 0.07 0.04 0.06 0.06 0.00 0.17 0.17 0.69
## pres_bad 70 11 2.63 2.18 3.83 2.67 1.56 0.00 4.89 4.89 -0.30
## pres_gin 71 9 26.72 26.59 35.36 26.72 39.50 0.00 62.00 62.00 0.04
## pres_old 72 11 0.04 0.05 0.03 0.03 0.04 0.00 0.17 0.17 1.66
## propar 73 11 0.18 0.40 0.00 0.11 0.00 0.00 1.00 1.00 1.43
## lpop 74 3 13.99 0.15 13.92 13.99 0.05 13.88 14.17 0.28 0.36
## continent* 75 11 1.00 0.00 1.00 1.00 0.00 1.00 1.00 0.00 NaN
## kurtosis se
## oecd NaN 0.00
## country* -1.53 1.00
## pind -0.79 0.13
## pindo -0.79 0.13
## ctrycd 3.44 46.70
## col_uk 0.08 0.12
## t_indep 1.88 5.96
## col_uka -0.14 0.10
## col_espa NaN 0.00
## col_otha 0.79 0.10
## legor_uk 0.08 0.12
## legor_so NaN 0.00
## legor_fr 0.08 0.12
## legor_ge NaN 0.00
## legor_sc NaN 0.00
## prot80 -0.80 6.10
## catho80 -0.39 4.12
## confu NaN 0.00
## avelf 0.44 0.04
## govef -0.17 0.25
## graft -1.62 0.23
## logyl -1.43 0.23
## loga -0.91 0.20
## yrsopen 2.15 0.09
## gadp -1.38 0.04
## engfrac -1.09 0.01
## eurfrac 3.76 0.05
## frankrom -0.69 0.15
## latitude -1.52 4.57
## gastil -1.45 0.35
## cgexp -1.30 2.41
## cgrev 0.71 3.45
## ssw -1.87 0.60
## rgdph 1.28 552.55
## trade -1.40 9.69
## prop1564 0.34 1.48
## prop65 1.16 0.35
## federal NaN 0.00
## eduger -1.50 7.10
## spropn -1.07 0.13
## yearele -2.00 4.77
## yearreg -2.00 4.77
## seats -0.20 33.16
## maj -1.31 0.14
## pres -1.91 0.15
## lyp -1.18 0.25
## semi 0.08 0.12
## majpar 0.08 0.12
## majpres -2.15 0.16
## propres 4.52 0.09
## dem_age 1.64 7.47
## lat01 -0.38 0.03
## age 1.64 0.04
## polityIV -1.63 1.68
## spl 0.05 1.60
## cpi9500 -1.45 0.38
## du_60ctry -1.31 0.14
## magn -1.70 0.12
## sdm -1.63 0.15
## oecd.x NaN 0.00
## mining_gdp 0.79 3.70
## gini_8090 -1.71 3.32
## con2150 NaN 0.00
## con5180 -1.31 0.14
## con81 -1.31 0.14
## list 3.64 36.14
## maj_bad -1.81 0.62
## maj_gin -1.17 7.61
## maj_old -1.39 0.02
## pres_bad -1.92 0.66
## pres_gin -1.97 8.86
## pres_old 2.10 0.02
## propar 0.08 0.12
## lpop -2.33 0.09
## continent* NaN 0.00
# Accessing continent-level summary statistics for africa from the "summary_stats_by_continent" list; alternate syntax
summary_stats_by_continent %>% pluck("africa")
## vars n mean sd median trimmed mad min max range skew
## oecd 1 11 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 NaN
## country* 2 11 6.00 3.32 6.00 6.00 4.45 1.00 11.00 10.00 0.00
## pind 3 11 0.77 0.42 1.00 0.83 0.00 0.00 1.00 1.00 -1.06
## pindo 4 11 0.77 0.42 1.00 0.83 0.00 0.00 1.00 1.00 -1.06
## ctrycd 5 11 647.55 154.90 684.00 685.56 56.34 199.00 754.00 555.00 -2.13
## col_uk 6 11 0.82 0.40 1.00 0.89 0.00 0.00 1.00 1.00 -1.43
## t_indep 7 11 36.64 19.77 35.00 33.89 5.93 9.00 89.00 80.00 1.38
## col_uka 8 11 0.69 0.35 0.86 0.74 0.02 0.00 0.92 0.92 -1.31
## col_espa 9 11 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 NaN
## col_otha 10 11 0.15 0.33 0.00 0.07 0.00 0.00 0.96 0.96 1.58
## legor_uk 11 11 0.82 0.40 1.00 0.89 0.00 0.00 1.00 1.00 -1.43
## legor_so 12 11 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 NaN
## legor_fr 13 11 0.18 0.40 0.00 0.11 0.00 0.00 1.00 1.00 1.43
## legor_ge 14 11 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 NaN
## legor_sc 15 11 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 NaN
## prot80 16 11 22.17 20.23 25.80 19.96 19.57 0.10 64.20 64.10 0.46
## catho80 17 11 19.46 13.67 18.70 18.07 13.20 1.90 49.60 47.70 0.71
## confu 18 11 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 NaN
## avelf 19 11 0.71 0.14 0.73 0.73 0.15 0.38 0.84 0.46 -1.15
## govef 20 11 5.37 0.82 5.02 5.25 0.68 4.56 7.26 2.70 0.97
## graft 21 11 5.11 0.77 5.39 5.12 0.80 3.93 6.23 2.30 -0.17
## logyl 22 11 7.93 0.78 7.75 7.90 0.53 6.95 9.13 2.18 0.42
## loga 23 11 7.38 0.66 7.33 7.37 0.55 6.28 8.58 2.29 0.03
## yrsopen 24 11 0.21 0.29 0.16 0.15 0.18 0.00 1.00 1.00 1.72
## gadp 25 11 0.55 0.12 0.54 0.55 0.12 0.37 0.74 0.37 0.28
## engfrac 26 11 0.02 0.04 0.00 0.02 0.00 0.00 0.09 0.09 0.95
## eurfrac 27 11 0.07 0.17 0.00 0.03 0.00 0.00 0.57 0.57 2.24
## frankrom 28 11 2.90 0.51 2.94 2.86 0.56 2.19 3.95 1.77 0.54
## latitude 29 11 -9.14 15.17 -15.81 -9.58 8.49 -29.13 14.77 43.90 0.44
## gastil 30 11 3.59 1.16 4.00 3.66 1.32 1.61 4.89 3.28 -0.48
## cgexp 31 10 27.00 7.63 25.50 27.10 8.58 14.65 38.57 23.92 0.06
## cgrev 32 9 26.15 10.36 23.81 26.15 6.14 17.24 50.85 33.61 1.40
## ssw 33 6 1.67 1.46 0.94 1.67 0.58 0.44 3.80 3.36 0.52
## rgdph 34 11 1899.87 1832.60 1116.28 1522.39 738.30 530.22 6666.77 6136.54 1.50
## trade 35 11 77.34 32.13 69.17 76.87 27.13 30.83 128.12 97.29 0.31
## prop1564 36 11 54.23 4.91 53.23 53.51 2.96 49.05 65.95 16.90 1.19
## prop65 37 11 3.28 1.16 2.80 3.06 0.65 2.34 6.26 3.92 1.47
## federal 38 11 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 NaN
## eduger 39 11 73.95 23.54 73.55 73.64 25.47 40.05 110.67 70.62 0.08
## spropn 40 10 0.27 0.42 0.00 0.21 0.00 0.00 1.00 1.00 0.92
## yearele 41 8 1982.50 13.48 1990.50 1982.50 5.19 1965.00 1994.00 29.00 -0.41
## yearreg 42 8 1982.50 13.48 1990.50 1982.50 5.19 1965.00 1994.00 29.00 -0.41
## seats 43 11 151.20 109.96 122.22 136.21 86.65 37.33 400.00 362.67 0.92
## maj 44 11 0.73 0.47 1.00 0.78 0.00 0.00 1.00 1.00 -0.88
## pres 45 11 0.64 0.50 1.00 0.67 0.00 0.00 1.00 1.00 -0.49
## lyp 46 11 7.22 0.81 7.02 7.15 0.88 6.27 8.80 2.53 0.53
## semi 47 11 0.18 0.40 0.00 0.11 0.00 0.00 1.00 1.00 1.43
## majpar 48 11 0.18 0.40 0.00 0.11 0.00 0.00 1.00 1.00 1.43
## majpres 49 11 0.55 0.52 1.00 0.56 0.00 0.00 1.00 1.00 -0.16
## propres 50 11 0.09 0.30 0.00 0.00 0.00 0.00 1.00 1.00 2.47
## dem_age 51 11 1975.82 24.77 1989.00 1981.11 7.41 1910.00 1994.00 84.00 -1.57
## lat01 52 11 0.17 0.08 0.18 0.17 0.05 0.00 0.32 0.32 -0.28
## age 53 11 0.12 0.12 0.05 0.09 0.04 0.03 0.45 0.42 1.57
## polityIV 54 11 2.34 5.56 0.22 2.42 6.75 -6.00 10.00 16.00 0.07
## spl 55 8 -1.55 4.52 -1.54 -1.55 1.91 -6.77 8.23 15.00 0.98
## cpi9500 56 9 5.70 1.15 5.90 5.70 1.14 3.93 7.55 3.61 0.01
## du_60ctry 57 11 0.27 0.47 0.00 0.22 0.00 0.00 1.00 1.00 0.88
## magn 58 11 0.71 0.41 1.00 0.75 0.00 0.02 1.00 0.98 -0.58
## sdm 59 9 0.71 0.45 1.00 0.71 0.00 0.03 1.00 0.97 -0.67
## oecd.x 60 11 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 NaN
## mining_gdp 61 10 8.43 11.70 4.10 5.89 5.71 0.02 37.20 37.18 1.39
## gini_8090 62 9 50.25 9.95 54.00 50.25 11.86 35.36 62.30 26.94 -0.19
## con2150 63 11 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 NaN
## con5180 64 11 0.27 0.47 0.00 0.22 0.00 0.00 1.00 1.00 0.88
## con81 65 11 0.73 0.47 1.00 0.78 0.00 0.00 1.00 1.00 -0.88
## list 66 11 49.83 119.87 0.00 16.46 0.00 0.00 400.00 400.00 2.22
## maj_bad 67 11 2.73 2.05 3.83 2.80 1.56 0.00 4.89 4.89 -0.32
## maj_gin 68 9 37.31 22.84 41.35 37.31 18.75 0.00 62.00 62.00 -0.71
## maj_old 69 11 0.06 0.07 0.04 0.06 0.06 0.00 0.17 0.17 0.69
## pres_bad 70 11 2.63 2.18 3.83 2.67 1.56 0.00 4.89 4.89 -0.30
## pres_gin 71 9 26.72 26.59 35.36 26.72 39.50 0.00 62.00 62.00 0.04
## pres_old 72 11 0.04 0.05 0.03 0.03 0.04 0.00 0.17 0.17 1.66
## propar 73 11 0.18 0.40 0.00 0.11 0.00 0.00 1.00 1.00 1.43
## lpop 74 3 13.99 0.15 13.92 13.99 0.05 13.88 14.17 0.28 0.36
## continent* 75 11 1.00 0.00 1.00 1.00 0.00 1.00 1.00 0.00 NaN
## kurtosis se
## oecd NaN 0.00
## country* -1.53 1.00
## pind -0.79 0.13
## pindo -0.79 0.13
## ctrycd 3.44 46.70
## col_uk 0.08 0.12
## t_indep 1.88 5.96
## col_uka -0.14 0.10
## col_espa NaN 0.00
## col_otha 0.79 0.10
## legor_uk 0.08 0.12
## legor_so NaN 0.00
## legor_fr 0.08 0.12
## legor_ge NaN 0.00
## legor_sc NaN 0.00
## prot80 -0.80 6.10
## catho80 -0.39 4.12
## confu NaN 0.00
## avelf 0.44 0.04
## govef -0.17 0.25
## graft -1.62 0.23
## logyl -1.43 0.23
## loga -0.91 0.20
## yrsopen 2.15 0.09
## gadp -1.38 0.04
## engfrac -1.09 0.01
## eurfrac 3.76 0.05
## frankrom -0.69 0.15
## latitude -1.52 4.57
## gastil -1.45 0.35
## cgexp -1.30 2.41
## cgrev 0.71 3.45
## ssw -1.87 0.60
## rgdph 1.28 552.55
## trade -1.40 9.69
## prop1564 0.34 1.48
## prop65 1.16 0.35
## federal NaN 0.00
## eduger -1.50 7.10
## spropn -1.07 0.13
## yearele -2.00 4.77
## yearreg -2.00 4.77
## seats -0.20 33.16
## maj -1.31 0.14
## pres -1.91 0.15
## lyp -1.18 0.25
## semi 0.08 0.12
## majpar 0.08 0.12
## majpres -2.15 0.16
## propres 4.52 0.09
## dem_age 1.64 7.47
## lat01 -0.38 0.03
## age 1.64 0.04
## polityIV -1.63 1.68
## spl 0.05 1.60
## cpi9500 -1.45 0.38
## du_60ctry -1.31 0.14
## magn -1.70 0.12
## sdm -1.63 0.15
## oecd.x NaN 0.00
## mining_gdp 0.79 3.70
## gini_8090 -1.71 3.32
## con2150 NaN 0.00
## con5180 -1.31 0.14
## con81 -1.31 0.14
## list 3.64 36.14
## maj_bad -1.81 0.62
## maj_gin -1.17 7.61
## maj_old -1.39 0.02
## pres_bad -1.92 0.66
## pres_gin -1.97 8.86
## pres_old 2.10 0.02
## propar 0.08 0.12
## lpop -2.33 0.09
## continent* NaN 0.00
# Group-level summary statistics can be assigned to their own object for easy retrieval
asia_europe_summary_statistics<-summary_stats_by_continent %>% pluck("asiae")
# retrieve summary statistics for Asia/Europe
asia_europe_summary_statistics
## vars n mean sd median trimmed mad min max range skew
## oecd 1 13 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 NaN
## country* 2 13 7.00 3.89 7.00 7.00 4.45 1.00 13.00 12.00 0.00
## pind 3 13 0.87 0.28 1.00 0.94 0.00 0.00 1.00 1.00 -2.31
## pindo 4 13 0.95 0.09 1.00 0.96 0.00 0.78 1.00 0.22 -1.12
## ctrycd 5 13 623.00 141.16 564.00 605.64 32.62 513.00 924.00 411.00 1.15
## col_uk 6 13 0.54 0.52 1.00 0.55 0.00 0.00 1.00 1.00 -0.14
## t_indep 7 13 74.31 78.67 51.00 62.91 13.34 24.00 250.00 226.00 1.64
## col_uka 8 13 0.45 0.44 0.79 0.45 0.17 0.00 0.90 0.90 -0.12
## col_espa 9 13 0.06 0.22 0.00 0.00 0.00 0.00 0.79 0.79 2.82
## col_otha 10 13 0.39 0.44 0.00 0.38 0.00 0.00 0.90 0.90 0.15
## legor_uk 11 13 0.77 0.44 1.00 0.82 0.00 0.00 1.00 1.00 -1.13
## legor_so 12 13 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 NaN
## legor_fr 13 13 0.08 0.28 0.00 0.00 0.00 0.00 1.00 1.00 2.82
## legor_ge 14 13 0.15 0.38 0.00 0.09 0.00 0.00 1.00 1.00 1.70
## legor_sc 15 13 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 NaN
## prot80 16 13 9.48 18.15 1.40 5.89 1.78 0.00 58.40 58.40 1.77
## catho80 17 13 11.38 23.52 2.80 5.81 3.56 0.00 84.10 84.10 2.28
## confu 18 13 0.38 0.51 0.00 0.36 0.00 0.00 1.00 1.00 0.42
## avelf 19 13 0.46 0.28 0.45 0.47 0.29 0.00 0.80 0.80 -0.31
## govef 20 12 4.60 1.75 4.86 4.79 1.90 0.84 6.49 5.65 -0.69
## graft 21 12 4.76 1.56 5.29 4.93 1.38 1.10 6.71 5.60 -0.85
## logyl 22 12 8.83 0.66 8.62 8.80 0.82 7.92 9.97 2.05 0.30
## loga 23 12 8.05 0.52 8.01 8.03 0.58 7.30 8.90 1.60 0.04
## yrsopen 24 13 0.72 1.09 0.41 0.48 0.60 0.00 4.09 4.09 2.19
## gadp 25 12 0.61 0.17 0.62 0.61 0.20 0.31 0.86 0.55 -0.17
## engfrac 26 13 0.01 0.02 0.00 0.00 0.00 0.00 0.09 0.09 2.63
## eurfrac 27 13 0.01 0.02 0.00 0.00 0.00 0.00 0.09 0.09 2.63
## frankrom 28 13 2.52 0.61 2.59 2.52 0.45 1.19 3.89 2.70 0.07
## latitude 29 13 14.28 16.21 13.92 15.08 16.83 -17.83 37.55 55.38 -0.41
## gastil 30 13 3.52 0.75 3.33 3.54 0.74 2.17 4.67 2.50 0.04
## cgexp 31 13 20.44 5.76 18.48 20.22 4.29 12.57 30.81 18.25 0.47
## cgrev 32 13 19.54 6.81 18.45 19.06 6.91 9.74 34.67 24.94 0.62
## ssw 33 11 1.27 1.29 0.65 1.05 0.77 0.13 4.39 4.26 1.23
## rgdph 34 13 4601.57 4223.17 2441.69 3994.20 1919.26 1147.17 14737.04 13589.87 1.11
## trade 35 13 97.78 84.61 80.63 82.35 45.68 21.88 343.39 321.50 1.79
## prop1564 36 12 60.79 6.17 60.00 60.41 7.40 53.78 71.70 17.92 0.47
## prop65 37 12 4.27 1.16 3.86 4.23 1.15 2.79 6.23 3.44 0.37
## federal 38 13 0.15 0.38 0.00 0.09 0.00 0.00 1.00 1.00 1.70
## eduger 39 12 74.16 20.58 77.72 74.91 20.56 42.15 98.74 56.59 -0.40
## spropn 40 10 0.09 0.12 0.04 0.07 0.06 0.00 0.36 0.36 1.04
## yearele 41 12 1981.94 14.46 1989.00 1984.10 4.45 1950.00 1992.22 42.22 -1.19
## yearreg 42 12 1979.00 17.19 1988.00 1980.80 5.19 1948.00 1992.00 44.00 -0.89
## seats 43 13 229.54 126.01 202.89 217.97 141.01 66.00 520.33 454.33 0.74
## maj 44 13 0.69 0.48 1.00 0.73 0.00 0.00 1.00 1.00 -0.74
## pres 45 13 0.31 0.48 0.00 0.27 0.00 0.00 1.00 1.00 0.74
## lyp 46 13 8.08 0.86 7.80 8.03 0.79 7.05 9.60 2.55 0.40
## semi 47 13 0.23 0.44 0.00 0.18 0.00 0.00 1.00 1.00 1.13
## majpar 48 13 0.57 0.49 0.89 0.59 0.16 0.00 1.00 1.00 -0.29
## majpres 49 13 0.15 0.35 0.00 0.09 0.00 0.00 1.00 1.00 1.69
## propres 50 13 0.16 0.37 0.00 0.10 0.00 0.00 1.00 1.00 1.68
## dem_age 51 13 1977.92 16.91 1988.00 1979.36 5.93 1948.00 1992.00 44.00 -0.73
## lat01 52 13 0.20 0.13 0.20 0.20 0.16 0.02 0.42 0.40 0.03
## age 53 13 0.11 0.08 0.06 0.10 0.03 0.04 0.26 0.22 0.73
## polityIV 54 13 6.24 3.08 6.22 6.65 2.14 -2.00 10.00 12.00 -1.16
## spl 55 13 -1.52 5.32 -1.70 -2.27 4.30 -7.36 12.59 19.95 1.19
## cpi9500 56 9 5.89 2.16 6.90 5.89 1.42 1.00 7.86 6.87 -1.11
## du_60ctry 57 13 0.62 0.51 1.00 0.64 0.00 0.00 1.00 1.00 -0.42
## magn 58 12 0.76 0.32 0.94 0.80 0.08 0.10 1.00 0.90 -0.87
## sdm 59 11 0.52 0.45 0.39 0.53 0.57 0.01 1.00 0.99 0.06
## oecd.x 60 13 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 NaN
## mining_gdp 61 11 2.86 5.07 1.04 1.64 0.96 0.02 16.74 16.72 1.87
## gini_8090 62 11 38.28 7.66 37.55 38.05 8.62 29.03 49.67 20.64 0.27
## con2150 63 13 0.15 0.38 0.00 0.09 0.00 0.00 1.00 1.00 1.70
## con5180 64 13 0.31 0.48 0.00 0.27 0.00 0.00 1.00 1.00 0.74
## con81 65 13 0.62 0.51 1.00 0.64 0.00 0.00 1.00 1.00 -0.42
## list 66 12 25.74 65.45 0.00 8.39 0.00 0.00 224.89 224.89 2.32
## maj_bad 67 13 2.50 1.83 3.17 2.53 1.65 0.00 4.67 4.67 -0.45
## maj_gin 68 11 28.37 19.49 32.00 29.15 20.02 0.00 49.67 49.67 -0.52
## maj_old 69 13 0.08 0.09 0.05 0.07 0.07 0.00 0.25 0.25 0.79
## pres_bad 70 13 1.05 1.71 0.00 0.85 0.00 0.00 4.28 4.28 0.97
## pres_gin 71 11 10.43 18.14 0.00 7.70 0.00 0.00 45.50 45.50 0.97
## pres_old 72 13 0.03 0.07 0.00 0.02 0.00 0.00 0.26 0.26 2.22
## propar 73 13 0.15 0.38 0.00 0.09 0.00 0.00 1.00 1.00 1.70
## lpop 74 8 16.97 2.07 16.83 16.97 1.68 13.57 20.63 7.06 0.10
## continent* 75 13 1.00 0.00 1.00 1.00 0.00 1.00 1.00 0.00 NaN
## kurtosis se
## oecd NaN 0.00
## country* -1.48 1.08
## pind 4.47 0.08
## pindo -0.77 0.03
## ctrycd -0.50 39.15
## col_uk -2.13 0.14
## t_indep 0.87 21.82
## col_uka -2.11 0.12
## col_espa 6.44 0.06
## col_otha -2.10 0.12
## legor_uk -0.76 0.12
## legor_so NaN 0.00
## legor_fr 6.44 0.08
## legor_ge 0.99 0.10
## legor_sc NaN 0.00
## prot80 1.64 5.04
## catho80 4.10 6.52
## confu -1.96 0.14
## avelf -1.35 0.08
## govef -0.68 0.51
## graft -0.04 0.45
## logyl -1.39 0.19
## loga -1.32 0.15
## yrsopen 4.17 0.30
## gadp -1.31 0.05
## engfrac 5.72 0.01
## eurfrac 5.72 0.01
## frankrom 0.65 0.17
## latitude -1.06 4.49
## gastil -1.21 0.21
## cgexp -1.34 1.60
## cgrev -0.47 1.89
## ssw 0.40 0.39
## rgdph -0.03 1171.30
## trade 2.64 23.47
## prop1564 -1.20 1.78
## prop65 -1.50 0.33
## federal 0.99 0.10
## eduger -1.42 5.94
## spropn -0.24 0.04
## yearele -0.18 4.17
## yearreg -1.10 4.96
## seats -0.21 34.95
## maj -1.56 0.13
## pres -1.56 0.13
## lyp -1.50 0.24
## semi -0.76 0.12
## majpar -1.97 0.13
## majpres 1.02 0.10
## propres 0.94 0.10
## dem_age -1.30 4.69
## lat01 -1.44 0.04
## age -1.30 0.02
## polityIV 1.31 0.86
## spl 1.10 1.48
## cpi9500 0.08 0.72
## du_60ctry -1.96 0.14
## magn -0.91 0.09
## sdm -2.06 0.14
## oecd.x NaN 0.00
## mining_gdp 2.21 1.53
## gini_8090 -1.64 2.31
## con2150 0.99 0.10
## con5180 -1.56 0.13
## con81 -1.96 0.14
## list 4.17 18.89
## maj_bad -1.56 0.51
## maj_gin -1.45 5.88
## maj_old -0.93 0.02
## pres_bad -0.90 0.48
## pres_gin -1.02 5.47
## pres_old 4.11 0.02
## propar 0.99 0.10
## lpop -0.80 0.73
## continent* NaN 0.00
The “vars” column in the summary statistics table is an index variable; it can be removed with the following:
# removes "vars" indexing variable from "asia_europe_summary_statistics"
asia_europe_summary_statistics<-asia_europe_summary_statistics %>% select(-vars)
# Prints contents of "asia_europe_summary_statistics"
asia_europe_summary_statistics
## n mean sd median trimmed mad min max range skew kurtosis
## oecd 13 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 NaN NaN
## country* 13 7.00 3.89 7.00 7.00 4.45 1.00 13.00 12.00 0.00 -1.48
## pind 13 0.87 0.28 1.00 0.94 0.00 0.00 1.00 1.00 -2.31 4.47
## pindo 13 0.95 0.09 1.00 0.96 0.00 0.78 1.00 0.22 -1.12 -0.77
## ctrycd 13 623.00 141.16 564.00 605.64 32.62 513.00 924.00 411.00 1.15 -0.50
## col_uk 13 0.54 0.52 1.00 0.55 0.00 0.00 1.00 1.00 -0.14 -2.13
## t_indep 13 74.31 78.67 51.00 62.91 13.34 24.00 250.00 226.00 1.64 0.87
## col_uka 13 0.45 0.44 0.79 0.45 0.17 0.00 0.90 0.90 -0.12 -2.11
## col_espa 13 0.06 0.22 0.00 0.00 0.00 0.00 0.79 0.79 2.82 6.44
## col_otha 13 0.39 0.44 0.00 0.38 0.00 0.00 0.90 0.90 0.15 -2.10
## legor_uk 13 0.77 0.44 1.00 0.82 0.00 0.00 1.00 1.00 -1.13 -0.76
## legor_so 13 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 NaN NaN
## legor_fr 13 0.08 0.28 0.00 0.00 0.00 0.00 1.00 1.00 2.82 6.44
## legor_ge 13 0.15 0.38 0.00 0.09 0.00 0.00 1.00 1.00 1.70 0.99
## legor_sc 13 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 NaN NaN
## prot80 13 9.48 18.15 1.40 5.89 1.78 0.00 58.40 58.40 1.77 1.64
## catho80 13 11.38 23.52 2.80 5.81 3.56 0.00 84.10 84.10 2.28 4.10
## confu 13 0.38 0.51 0.00 0.36 0.00 0.00 1.00 1.00 0.42 -1.96
## avelf 13 0.46 0.28 0.45 0.47 0.29 0.00 0.80 0.80 -0.31 -1.35
## govef 12 4.60 1.75 4.86 4.79 1.90 0.84 6.49 5.65 -0.69 -0.68
## graft 12 4.76 1.56 5.29 4.93 1.38 1.10 6.71 5.60 -0.85 -0.04
## logyl 12 8.83 0.66 8.62 8.80 0.82 7.92 9.97 2.05 0.30 -1.39
## loga 12 8.05 0.52 8.01 8.03 0.58 7.30 8.90 1.60 0.04 -1.32
## yrsopen 13 0.72 1.09 0.41 0.48 0.60 0.00 4.09 4.09 2.19 4.17
## gadp 12 0.61 0.17 0.62 0.61 0.20 0.31 0.86 0.55 -0.17 -1.31
## engfrac 13 0.01 0.02 0.00 0.00 0.00 0.00 0.09 0.09 2.63 5.72
## eurfrac 13 0.01 0.02 0.00 0.00 0.00 0.00 0.09 0.09 2.63 5.72
## frankrom 13 2.52 0.61 2.59 2.52 0.45 1.19 3.89 2.70 0.07 0.65
## latitude 13 14.28 16.21 13.92 15.08 16.83 -17.83 37.55 55.38 -0.41 -1.06
## gastil 13 3.52 0.75 3.33 3.54 0.74 2.17 4.67 2.50 0.04 -1.21
## cgexp 13 20.44 5.76 18.48 20.22 4.29 12.57 30.81 18.25 0.47 -1.34
## cgrev 13 19.54 6.81 18.45 19.06 6.91 9.74 34.67 24.94 0.62 -0.47
## ssw 11 1.27 1.29 0.65 1.05 0.77 0.13 4.39 4.26 1.23 0.40
## rgdph 13 4601.57 4223.17 2441.69 3994.20 1919.26 1147.17 14737.04 13589.87 1.11 -0.03
## trade 13 97.78 84.61 80.63 82.35 45.68 21.88 343.39 321.50 1.79 2.64
## prop1564 12 60.79 6.17 60.00 60.41 7.40 53.78 71.70 17.92 0.47 -1.20
## prop65 12 4.27 1.16 3.86 4.23 1.15 2.79 6.23 3.44 0.37 -1.50
## federal 13 0.15 0.38 0.00 0.09 0.00 0.00 1.00 1.00 1.70 0.99
## eduger 12 74.16 20.58 77.72 74.91 20.56 42.15 98.74 56.59 -0.40 -1.42
## spropn 10 0.09 0.12 0.04 0.07 0.06 0.00 0.36 0.36 1.04 -0.24
## yearele 12 1981.94 14.46 1989.00 1984.10 4.45 1950.00 1992.22 42.22 -1.19 -0.18
## yearreg 12 1979.00 17.19 1988.00 1980.80 5.19 1948.00 1992.00 44.00 -0.89 -1.10
## seats 13 229.54 126.01 202.89 217.97 141.01 66.00 520.33 454.33 0.74 -0.21
## maj 13 0.69 0.48 1.00 0.73 0.00 0.00 1.00 1.00 -0.74 -1.56
## pres 13 0.31 0.48 0.00 0.27 0.00 0.00 1.00 1.00 0.74 -1.56
## lyp 13 8.08 0.86 7.80 8.03 0.79 7.05 9.60 2.55 0.40 -1.50
## semi 13 0.23 0.44 0.00 0.18 0.00 0.00 1.00 1.00 1.13 -0.76
## majpar 13 0.57 0.49 0.89 0.59 0.16 0.00 1.00 1.00 -0.29 -1.97
## majpres 13 0.15 0.35 0.00 0.09 0.00 0.00 1.00 1.00 1.69 1.02
## propres 13 0.16 0.37 0.00 0.10 0.00 0.00 1.00 1.00 1.68 0.94
## dem_age 13 1977.92 16.91 1988.00 1979.36 5.93 1948.00 1992.00 44.00 -0.73 -1.30
## lat01 13 0.20 0.13 0.20 0.20 0.16 0.02 0.42 0.40 0.03 -1.44
## age 13 0.11 0.08 0.06 0.10 0.03 0.04 0.26 0.22 0.73 -1.30
## polityIV 13 6.24 3.08 6.22 6.65 2.14 -2.00 10.00 12.00 -1.16 1.31
## spl 13 -1.52 5.32 -1.70 -2.27 4.30 -7.36 12.59 19.95 1.19 1.10
## cpi9500 9 5.89 2.16 6.90 5.89 1.42 1.00 7.86 6.87 -1.11 0.08
## du_60ctry 13 0.62 0.51 1.00 0.64 0.00 0.00 1.00 1.00 -0.42 -1.96
## magn 12 0.76 0.32 0.94 0.80 0.08 0.10 1.00 0.90 -0.87 -0.91
## sdm 11 0.52 0.45 0.39 0.53 0.57 0.01 1.00 0.99 0.06 -2.06
## oecd.x 13 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 NaN NaN
## mining_gdp 11 2.86 5.07 1.04 1.64 0.96 0.02 16.74 16.72 1.87 2.21
## gini_8090 11 38.28 7.66 37.55 38.05 8.62 29.03 49.67 20.64 0.27 -1.64
## con2150 13 0.15 0.38 0.00 0.09 0.00 0.00 1.00 1.00 1.70 0.99
## con5180 13 0.31 0.48 0.00 0.27 0.00 0.00 1.00 1.00 0.74 -1.56
## con81 13 0.62 0.51 1.00 0.64 0.00 0.00 1.00 1.00 -0.42 -1.96
## list 12 25.74 65.45 0.00 8.39 0.00 0.00 224.89 224.89 2.32 4.17
## maj_bad 13 2.50 1.83 3.17 2.53 1.65 0.00 4.67 4.67 -0.45 -1.56
## maj_gin 11 28.37 19.49 32.00 29.15 20.02 0.00 49.67 49.67 -0.52 -1.45
## maj_old 13 0.08 0.09 0.05 0.07 0.07 0.00 0.25 0.25 0.79 -0.93
## pres_bad 13 1.05 1.71 0.00 0.85 0.00 0.00 4.28 4.28 0.97 -0.90
## pres_gin 11 10.43 18.14 0.00 7.70 0.00 0.00 45.50 45.50 0.97 -1.02
## pres_old 13 0.03 0.07 0.00 0.02 0.00 0.00 0.26 0.26 2.22 4.11
## propar 13 0.15 0.38 0.00 0.09 0.00 0.00 1.00 1.00 1.70 0.99
## lpop 8 16.97 2.07 16.83 16.97 1.68 13.57 20.63 7.06 0.10 -0.80
## continent* 13 1.00 0.00 1.00 1.00 0.00 1.00 1.00 0.00 NaN NaN
## se
## oecd 0.00
## country* 1.08
## pind 0.08
## pindo 0.03
## ctrycd 39.15
## col_uk 0.14
## t_indep 21.82
## col_uka 0.12
## col_espa 0.06
## col_otha 0.12
## legor_uk 0.12
## legor_so 0.00
## legor_fr 0.08
## legor_ge 0.10
## legor_sc 0.00
## prot80 5.04
## catho80 6.52
## confu 0.14
## avelf 0.08
## govef 0.51
## graft 0.45
## logyl 0.19
## loga 0.15
## yrsopen 0.30
## gadp 0.05
## engfrac 0.01
## eurfrac 0.01
## frankrom 0.17
## latitude 4.49
## gastil 0.21
## cgexp 1.60
## cgrev 1.89
## ssw 0.39
## rgdph 1171.30
## trade 23.47
## prop1564 1.78
## prop65 0.33
## federal 0.10
## eduger 5.94
## spropn 0.04
## yearele 4.17
## yearreg 4.96
## seats 34.95
## maj 0.13
## pres 0.13
## lyp 0.24
## semi 0.12
## majpar 0.13
## majpres 0.10
## propres 0.10
## dem_age 4.69
## lat01 0.04
## age 0.02
## polityIV 0.86
## spl 1.48
## cpi9500 0.72
## du_60ctry 0.14
## magn 0.09
## sdm 0.14
## oecd.x 0.00
## mining_gdp 1.53
## gini_8090 2.31
## con2150 0.10
## con5180 0.13
## con81 0.14
## list 18.89
## maj_bad 0.51
## maj_gin 5.88
## maj_old 0.02
## pres_bad 0.48
## pres_gin 5.47
## pres_old 0.02
## propar 0.10
## lpop 0.73
## continent* 0.00
Generating group-level summary statistics with the summarize
function from dplyr
# Generate a table that displays summary statistics for trade at the continent level and assign to object named "trade_age_by_continent"
trade_age_by_continent<-pt_copy %>% group_by(continent) %>%
summarise(meanTrade=mean(trade),sdTrade=sd(trade),
meanAge=mean(age), sdAge=sd(age),
n=n())
# prints contents of "trade_age_by_continent"
trade_age_by_continent
## # A tibble: 4 × 6
## continent meanTrade sdTrade meanAge sdAge n
## <chr> <dbl> <dbl> <dbl> <dbl> <int>
## 1 africa 77.3 32.1 0.121 0.124 11
## 2 asiae 97.8 84.6 0.110 0.0846 13
## 3 laam 68.6 32.8 0.139 0.153 23
## 4 other 78.8 40.7 0.309 0.263 38