each OECD country) with its name, rather than the default dataset number. The last line is the geom_text() function that I use to specify that I want to label each observation (i.e. Click here to learn about adding legends. I add a legend to examine where countries with different democracy scores (taken from the Polity Index) are located on the globalization plane. Click here to learn more about adding a regression line to a plot. I use the geom_smooth() function with the “lm” method to add a best fitting regression line through the points on the plot. Then I use the next three lines to add titles to axes and graph In the aes() function, we enter the two variables we want to plot. + geom_text(hjust = 0, nudge_x = 0.5, size = 4, aes(label = country)) + geom_point(aes(colour = polity_score), size = 2) + labs(color = "Polity Score") + scale_y_continuous("Social Globalization Index") + scale_x_continuous("Economic Globalization Index") + ggtitle("Relationship between Globalization Index Scores among OECD countries in 2000") Next add the following code: fin <- ggplot(oecd2000, aes(economic_globalization, social_globalization)) The KOF Globalisation Index, introduced by Dreher (2006) measures globalization along the economic, social and political dimension for most countries in the worldįirst, as always, we install and load the necessary package. I will look at the relationship between economic globalization and social globalization in OECD countries in the year 2000. For me, it’s most helpful to see where different countries are in relation to each other and to see any interesting outliers.įor this, I can use the geom_text() function from the ggplot2 package. Sometimes the best way to examine the relationship between our variables of interest is to plot it out and give it a good looking over.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |