2.3 Displaying frequency distributions
To display frequency tables, we will use the freq command from the summarytools package. Note the way you specify a variable name: dataset$variableName. You have named the dataset. The creator of the dataset has given variables a name. Look at the file in the viewer or the codebook for the details. Here is an example:
freq(EthiopiaHaven$Q11)
freq(EthiopiaHaven$Q261)
freq(EthiopiaHaven$H_URBRURAL)
freq(EthiopiaHaven$G_TOWNSIZE2)
If you are using states data or Gapminder data, you will need to add one more step. You will need to filter your data to worth with only one year at a time. Here is an example with states data:
myStatesData %>%
filter(year == 2000)
freq(myStatesData$region)
freq(myStatesData$firms)
