Do you know your data?
The previous exercise dealt about socio-economic indicators and access to education of different individuals. The edu_equal_1
dataset that you've built is already available in the workspace. Now that you have it in R, it's pretty easy to get some basic insights.
For example, you can ask yourself how many observations (e.g., how many people) have an age
higher than 40 and are literate
? When you call
str(edu_equal_1)
You'll see that age
is an integer, and literate
is a factor, with the levels "yes" and "no". The following expression thus answers the question:
nrow(subset(edu_equal_1, age > 40 & literate == "yes"))
Up to you to answer a similar question now:
How many observations/individuals of Bulgarian ethnicity have an income above 1000?
This exercise is part of the course
Intermediate Importing Data in R
Hands-on interactive exercise
Turn theory into action with one of our interactive exercises
