Skip to content

Instantly share code, notes, and snippets.

View benilton's full-sized avatar

Benilton Carvalho benilton

  • Universidade Estadual de Campinas (UNICAMP)
  • Campinas
  • X @benilton
View GitHub Profile
Overall rank Country or region Score GDP per capita Social support Healthy life expectancy Freedom to make life choices Generosity Perceptions of corruption
1 Finland 7.769 1.340 1.587 0.986 0.596 0.153 0.393
2 Denmark 7.600 1.383 1.573 0.996 0.592 0.252 0.410
3 Norway 7.554 1.488 1.582 1.028 0.603 0.271 0.341
4 Iceland 7.494 1.380 1.624 1.026 0.591 0.354 0.118
5 Netherlands 7.488 1.396 1.522 0.999 0.557 0.322 0.298
6 Switzerland 7.480 1.452 1.526 1.052 0.572 0.263 0.343
7 Sweden 7.343 1.387 1.487 1.009 0.574 0.267 0.373
8 New Zealand 7.307 1.303 1.557 1.026 0.585 0.330 0.380
9 Canada 7.278 1.365 1.505 1.039 0.584 0.285 0.308
Overall rank Country or region Score GDP per capita Social support Healthy life expectancy Freedom to make life choices Generosity Perceptions of corruption
1 Finland 7.632 1.305 1.592 0.874 0.681 0.202 0.393
2 Norway 7.594 1.456 1.582 0.861 0.686 0.286 0.340
3 Denmark 7.555 1.351 1.590 0.868 0.683 0.284 0.408
4 Iceland 7.495 1.343 1.644 0.914 0.677 0.353 0.138
5 Switzerland 7.487 1.420 1.549 0.927 0.660 0.256 0.357
6 Netherlands 7.441 1.361 1.488 0.878 0.638 0.333 0.295
7 Canada 7.328 1.330 1.532 0.896 0.653 0.321 0.291
8 New Zealand 7.324 1.268 1.601 0.876 0.669 0.365 0.389
9 Sweden 7.314 1.355 1.501 0.913 0.659 0.285 0.383
We can make this file beautiful and searchable if this error is corrected: It looks like row 6 should actually have 12 columns, instead of 6. in line 5.
"Country","Happiness.Rank","Happiness.Score","Whisker.high","Whisker.low","Economy..GDP.per.Capita.","Family","Health..Life.Expectancy.","Freedom","Generosity","Trust..Government.Corruption.","Dystopia.Residual"
"Norway",1,7.53700017929077,7.59444482058287,7.47955553799868,1.61646318435669,1.53352355957031,0.796666502952576,0.635422587394714,0.36201223731041,0.315963834524155,2.27702665328979
"Denmark",2,7.52199983596802,7.58172806486487,7.46227160707116,1.48238301277161,1.55112159252167,0.792565524578094,0.626006722450256,0.355280488729477,0.40077006816864,2.31370735168457
"Iceland",3,7.50400018692017,7.62203047305346,7.38596990078688,1.480633020401,1.6105740070343,0.833552122116089,0.627162635326385,0.475540220737457,0.153526559472084,2.32271528244019
"Switzerland",4,7.49399995803833,7.56177242040634,7.42622749567032,1.56497955322266,1.51691174507141,0.858131289482117,0.620070576667786,0.290549278259277,0.367007285356522,2.2767162322998
"Finland",5,7.4689998626709,7.52754207581282,7.41045764952898,1.4435719
Country Region Happiness Rank Happiness Score Lower Confidence Interval Upper Confidence Interval Economy (GDP per Capita) Family Health (Life Expectancy) Freedom Trust (Government Corruption) Generosity Dystopia Residual
Denmark Western Europe 1 7.526 7.46 7.592 1.44178 1.16374 0.79504 0.57941 0.44453 0.36171 2.73939
Switzerland Western Europe 2 7.509 7.428 7.59 1.52733 1.14524 0.86303 0.58557 0.41203 0.28083 2.69463
Iceland Western Europe 3 7.501 7.333 7.669 1.42666 1.18326 0.86733 0.56624 0.14975 0.47678 2.83137
Norway Western Europe 4 7.498 7.421 7.575 1.57744 1.1269 0.79579 0.59609 0.35776 0.37895 2.66465
Finland Western Europe 5 7.413 7.351 7.475 1.40598 1.13464 0.81091 0.57104 0.41004 0.25492 2.82596
Canada North America 6 7.404 7.335 7.473 1.44015 1.0961 0.8276 0.5737 0.31329 0.44834 2.70485
Netherlands Western Europe 7 7.339 7.284 7.394 1.46468 1.02912 0.81231 0.55211 0.29927 0.47416 2.70749
New Zealand Australia and New Zealand 8 7.334 7.264 7.404 1.36066 1.17278 0.83096 0.58147 0.41904 0.49401 2.47
We can make this file beautiful and searchable if this error is corrected: It looks like row 10 should actually have 12 columns, instead of 9. in line 9.
Country,Region,Happiness Rank,Happiness Score,Standard Error,Economy (GDP per Capita),Family,Health (Life Expectancy),Freedom,Trust (Government Corruption),Generosity,Dystopia Residual
Switzerland,Western Europe,1,7.587,0.03411,1.39651,1.34951,0.94143,0.66557,0.41978,0.29678,2.51738
Iceland,Western Europe,2,7.561,0.04884,1.30232,1.40223,0.94784,0.62877,0.14145,0.4363,2.70201
Denmark,Western Europe,3,7.527,0.03328,1.32548,1.36058,0.87464,0.64938,0.48357,0.34139,2.49204
Norway,Western Europe,4,7.522,0.0388,1.459,1.33095,0.88521,0.66973,0.36503,0.34699,2.46531
Canada,North America,5,7.427,0.03553,1.32629,1.32261,0.90563,0.63297,0.32957,0.45811,2.45176
Finland,Western Europe,6,7.406,0.0314,1.29025,1.31826,0.88911,0.64169,0.41372,0.23351,2.61955
Netherlands,Western Europe,7,7.378,0.02799,1.32944,1.28017,0.89284,0.61576,0.31814,0.4761,2.4657
Sweden,Western Europe,8,7.364,0.03157,1.33171,1.28907,0.91087,0.6598,0.43844,0.36262,2.37119
New Zealand,Australia and New Zealand,9,7.286,0.03371,1.25018,1.31967,0.90837,0.639
## Instalação r2u
shell_call <- function(command, ...) {
result <- system(command, intern = TRUE, ...)
cat(paste0(result, collapse = "\n"))
}
download.file("https://github.com/eddelbuettel/r2u/raw/master/inst/scripts/add_cranapt_jammy.sh",
"add_cranapt_jammy.sh")
Sys.chmod("add_cranapt_jammy.sh", "0755")
@benilton
benilton / disciplinas.csv
Created November 28, 2023 01:59
disciplinas.csv
ID_DISCIPLINA NOME CREDITOS
101 Cálculo I 4
102 Geometria Analítica 3
103 Introdução à Estatística 4
104 Introdução à Programação 3
@benilton
benilton / alunos.csv
Created November 28, 2023 01:57
alunos.csv
RA NOME IDADE
1 Aluno 1 22
2 Aluno 2 22
3 Aluno 3 20
4 Aluno 4 18
5 Aluno 5 18
6 Aluno 6 18
7 Aluno 7 23
8 Aluno 8 24
9 Aluno 9 20
@benilton
benilton / matriculas.csv
Created November 28, 2023 01:54
matriculas.csv
RA ID_DISCIPLINA NOTA
1 103 8.47873798410574
1 104 8.240893199201459
1 102 7.367557990149967
2 102 4.522722120123589
2 104 5.8967811482064425
2 103 7.910598501938372
2 101 5.144043571160878
3 104 7.454273506962975
3 103 7.029228995597566
@benilton
benilton / setup_me315.R
Created November 28, 2023 01:46
Configura Google Colab para R
## Instalação r2u
shell_call <- function(command, ...) {
result <- system(command, intern = TRUE, ...)
cat(paste0(result, collapse = "\n"))
}
download.file("https://github.com/eddelbuettel/r2u/raw/master/inst/scripts/add_cranapt_jammy.sh",
"add_cranapt_jammy.sh")
Sys.chmod("add_cranapt_jammy.sh", "0755")