happiness | R Documentation |
Data set consisting of 498 rows and 12 columns containing data from the World Happiness Report over three years.
data("happiness")
data.frame()
with 12 columns:
Time
:year of the World Happiness Report.
Region
:region of the world.
Country
:country.
Happiness
:happiness score measured in the respective
year (see Time
) by asking “How would you rate your
happiness on a scale of 0 to 10 where 10 is happiest?”.
Rank
:rank of the country based on Happiness
.
GDP
:extent to which the gross domestic product per
capita contributed to the calculation of Happiness
.
Family
:extent to which family contributed to the
calculation of Happiness
.
Health
:extent to which life expectancy contributed to the
calculation of Happiness
.
Freedom
:extent to which freedom contributed to the
calculation of Happiness
.
Corruption
:extent to which the perception of corruption
contributed to the calculation of Happiness
.
Generosity
:extent to which generosity
contributed to the calculation of Happiness
.
Dystopia
:extent to which the dystopia residual
contributed to the calculation of Happiness
. Dystopia
is an imaginary country with the world's
least-happy people (which can act as a benchmark against which all
countries can be favorably compared).
GDP, Family, Health, Freedom, Corruption and Generosity describe the extent to which these factors contribute in evaluating the happiness in each country. If added together with Dystopia, one receives the happiness score.
The data set was obtained from https://www.kaggle.com/unsdsn/world-happiness on 2018-04-20 in three different .csv files (one for each year). Joint columns (variables) where then built, the rows expanded (to be the same for each year) and sorted acorrding to Region and Country. Finally, Time was added to obtain a single data set.
https://www.kaggle.com/unsdsn/world-happiness
data("happiness")
stopifnot(all.equal(rowSums(happiness[,c("GDP", "Family", "Health", "Freedom",
"Corruption", "Generosity",
"Dystopia")]),
happiness[, "Happiness"], tol = 5e-5))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.