Uncategorized

Data Literacy & Visualization

Basics of R
CIA Factbook Data
Revisit the CIA factbook dataset that you used for Assignment 1. (If you didn’t save it
or if your variable was not numeric, visit https://www.cia.gov/the-world-factbook/
references/guide-to-country-comparisons/ and choose a variable to get a csv. dataset
again). Import the dataset into R. Please answer the following questions with R and copy
the commands that you use for answering each question.
1. (.5 pt) Is the variable of interest correctly read as a numeric object? (if not, contact
the instructor for help)
2. (.5 pt) What are the average value of that variable?
3. (.5 pt) Does that average value happen to be the actual value of any country?
4. (.5 pt) How many countries are there whose value is below the average?
5. (.5 pt) Which country has the lowest value?
6. (.5 pt) Which country is ranked 10th, 30th, and 50th respectively?
7. (1 pt) Which country ranks higher in the variable that you choose, Namibia or
Botswana (the data might be missing in your dataset, but at least you need to
write down the R command that you use for inquiry)?
Presidential Approval Basics
Revisit the 538 polling dataset that you used for Assignment 1. Import the dataset into
R. Please answer the following questions with R and copy the commands that you
use for answering each question.
1
1. (.5 pt) Is the dataset properly read in? How many observations and variables are
in the dataset?
2. (.5 pt) What are the dierent values of population?
3. (1 pt) What is the average approval for polls of each population? Does there
appear to be much of a dierence? (Hint: Create and save a subset of the data for
each methodology using indexing, subsetting, or ltering and nd the mean of that
new dataset.)
Presidential Approval Advanced
Use the same 538 dataset to address the following questions. Again, copy the commands that you use. When asked for the correlation between two variables, use the
function cor( x , y ) for the specic x and y that you want to compare. Make sure to use
the form `dataset$variable’ to indicate a variable that exists within a dataset.
1. (.5 pt) Using approve and disapprove, create a new variable in the dataset measuring
the dierence of approve to disapprove (subtract the variables). Using this new
variable, create a second new variable by taking the opposite (*-1). What is the
correlation between these two newly created variables?
2. (.5 pt) Using approve and disapprove, create a new variable in the dataset measuring
the ratio of approve to disapprove (divide the variables). Using this new variable,
create a second new variable by taking the inverse (∧-1). What is the correlation
between these two newly created variables?
3. (1 pt) What was the approve-disapprove ratio and dierence (two variables you just
created) for the polls that had the largest and smallest sample size?
2

Essay Mill

Share
Published by
Essay Mill

Recent Posts

Childbirth

For this short paper activity, you will learn about the three delays model, which explains…

4 weeks ago

Literature

 This is a short essay that compares a common theme or motif in two works…

4 weeks ago

Hospital Adult Medical Surgical Collaboration Area

Topic : Hospital adult medical surgical collaboration area a. Current Menu Analysis (5 points/5%) Analyze…

4 weeks ago

Predictive and Qualitative Analysis Report

As a sales manager, you will use statistical methods to support actionable business decisions for Pastas R Us,…

4 weeks ago

Business Intelligence

Read the business intelligence articles: Getting to Know the World of Business Intelligence Business intelligence…

4 weeks ago

Alcohol Abuse

The behaviors of a population can put it at risk for specific health conditions. Studies…

4 weeks ago