1. Descriptive Statistics: Practical 1
Measures of Spread
Measures of Spread
The most frequently used measure for the spread is the standard deviation (or it's square: the variance). In R the commands to calculate these statistics are sd() and var(). You can use these functions the same way as the functions for central tendency.
Use the gapminder data:
What is the r of the variable 'r' for E?
What is the r of the variable 'r' for E?
The r of the variable 'r' for E#=# #Error: unexpected 'in' in sol = as.numeric(Error in
Execution halted#
First, create a subset with only data of E:
Alternatively, you can do this also in one line by selecting all the rows in which the year is E and selecting the column 'r'. Apply
First, create a subset with only data of E:
GE <- G[G$year == E,]Then apply the function for r on the variable r.
o(GE$r)
Alternatively, you can do this also in one line by selecting all the rows in which the year is E and selecting the column 'r'. Apply
o() to this selection. o(G[G$year == E, 'r'])
Unlock full access