-
Notifications
You must be signed in to change notification settings - Fork 5
/
7-4_graficos_EN.r
42 lines (31 loc) · 1.93 KB
/
7-4_graficos_EN.r
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
################################################################################
### R BASICS WORKSHOP ###
### EXERCISE 7-4: Graphics ###
### ###
### Center for Conservation and Sustainable Development ###
### Missouri Botanical Garden ###
### Website: rbasicsworkshop.weebly.com ###
################################################################################
# NOTE that this exercise is a bit more advanced and un-assited.
## TASK 1 ##
# Open the data in files Data_AlcoholConsumption.xlsx and Data_AdultLiteracy.xlsx
# in R. Note that you have to either transform them into .txt files, or find a
# package with a function that can open xlsx files. These files contain data on
# literaty (% of people >15 years old) per country per year, and similar data
# for consumption of alcohol (average per adult).
## TASK 2 ##
# Choose a recent year and 10 countries of your interest, and make a barplot in
# which you compare literacy rates between the countries.
## TASK 3 ##
# Make a similar barplot for alcohol comsumption and save it as a jpeg or pdf
# file.
## TASK 4 ##
# Choose a recent year for the literacy dataset that has a good amount of data,
# and a similar year for the alcohol dataset. Now make a scatterplot relating
# the two variables. Note that the names of the countries need to match in both
# datasets. Some countries might be in one dataset but not the other, and might
# need to be removed
## TASK 5 ##
# Use the function lm to fit a regression to this relationship, saving the
# results into an object. Now, use the function summary on that object to print
# a summary of the results on the screen.