Question: Warning: Any code not covered in the lab sessions will not be accepted! AI - generated code will NOT be graded! ( You are ONLY

Warning: Any code not covered in the lab sessions will not be accepted! AI-generated code will NOT be graded! (You are ONLY allowed to use AI for debugging errors in your code)
Question 1:
We will use the 'countries.csv' dataset. You can find this data in the lab materials folder.
Let's explore the level of democracy. Create a summary table for the dem_level4 variable.
Requirements:
a. The column names for the newly created data frame will be 'Regime_Type' and 'Count' respectively.
b. The count variable must have an ascending order.
c. display the data frame (the summary data you just created in the tabular format).
Question 2:
Create a horizontal bar chart for the demlevel4 variable.
Requirements:
a. Set the title to 'Regime Type Distribution'. The X-axis label is 'Regime Type' and the Y-axis label is 'Count'.
b. Adjust the code so that the heights of the bars are ordered.
Question 3:
Create a percentage pie chart for dem_level4.
Note: You will use the summary table you created for question 1.
Requirements:
a. Add a new 'percentage' column based on the 'Count' to that table.
b. To make the edges proportional set y=Count in the aes function of ggplot.
Question 4:
Choose two relevant variables from the dataset and create a scatter plot. Interpret the graph briefly.
Question 5:
Create a histogram OR a kernel density plot for the gdppcap08(GDP per capita of countries in 2008) variable AND interpret the graph.
Question 6:
Create a pivot table in which data is grouped by the dem_level4 variable and summarized by mean and standard deviation of gdppcap08(hint: lines 18-23 in Lab3)
Requirements:
a. To get rid of NA values, you will need to add the na.rm=TRUE argument into the mean() and sd() functions - e.g. mean(variable_name, na.rm=TRUE)
b. Display the pivot table AND interpret the results briefly (What do we learn from this table?)
Please help me to answer this question.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!