Here is what I have so far. I have to get my graph (in the picture) to look like the bottom picture! How can I get the order of the countries, title, and color like the picture?
- Have the countries and their corresponding data go in order of (New Zeland, Taiwan, Australia, Iceland, United Kingdom, Canada, Vietnam, Italy, India, Japan, Germany, United States, Estonia, Indonesia, Philippines, South Africa, Serbia, Argentina, Tunisia, Ecuador) because New Zeland has the highest number and Ecuador has the lowest number.
- Change the color of each bar
- Add title
ANY SPECIFIC CODE YOU CAN PROVIDE AS IT RELATES TO MY DATASET WILL BE MUCH APPRECIATED!
View project_data_1 Data Set
View(ProjectData_1)
Install and Load Packages
library(ggplot2)
library(sjstats)
library(car)
library(pwr)
Labeling Variables
Countries <- ProjectData_1$Entity
TestPerCase <- ProjectData_1$cumulative_tests_per_case
Create New DataFrame
Countries <- c("New Zeland", "Taiwan", "Australia", "Iceland", "United Kingdom", "Canada", "Vietnam", "Italy",
"India", "Japan", "Germany", "United States", "Estonia", "Indonesia","Philippines", "South Afria", "Serbia",
"Argentina", "Tunisia", "Ecuador")
TestPerCase <- c(500, 250, 250, 41.7, 32.3, 27, 26.3, 23.8, 18.5, 15.4, 14.7, 13.7, 10.5, 8.7, 8.1, 6.5, 5.4, 4.9, 4.4, 4.6)
NewProjectData1 <-data.frame(Countries, TestPerCase)
print(NewProjectData1)
Create Bar Graph
Data1BarGraph <- ggplot (NewProjectData1, aes(x=Countries, y=TestPerCase)) +
geom_bar(stat = "identity")
Data1BarGraph + coord_flip()
I have to get my graph (the top one) to look like the bottom graph-->