Alice B. Popejoy and Stephanie M. Fullerton collected data on the genomes of thousands of people to find variants associated with disease traits.This study was conducted to develop more precise medicine for the more diverse population. The data was collected through GWAS (genome-wide association studies). In 2016, this process was repeated to account for the new studies and samples added to the GWAS Catalog, which included slightly more diversity in population.
Pie charts for the data collected in 2009 and 2016, which encompasses the European, Asian, and non-European ancestry.
#2009 Pie Graph
data2009_vector <- c(96, 3,1)
label1 <- c("European\nancestry","\nAsian ancestry","Other non-European\nancestry")
pie(data2009_vector, label1)
#2016 Pie Graph
data2016_vector <- c(81, 14,5)
label2 <- c("European\nancestry","Asian\nancestry","Other\nnon-European\nancestry")
pie(data2016_vector, label2)
Make adjustments to the pie charts to make them visually more appealing or ugly.
# set up par()
par(mfrow = c(1,2), mar = c(2,3,1,5))
#pie graphs 1
# add main, init.angle, radius, and col
pie(x = data2009_vector,
labels = label1,
init.angle = -82,
radius = 1,
col = c(2,3,4),
main = "2009 Analysis of GWAS")
# pie graph 2
# add main, init.angle, radius, and col
pie(x = data2016_vector,
labels = label2,
init.angle = -82,
radius = 1,
col = c(2,3,4),
main = "2016 Analysis of GWAS")
Code for how stracked bar graphs are made
# data
dat2016 <- c(14, 3,1,0.54,0.28,0.08,0.05)
dat2016_rev <- rev(dat2016)
barplotdata2016 <- matrix(c(dat2016_rev))
# labels
labels_x <- rev(c("Asian","African","Mixed", "Hispanic &\nLatin American",
"Pacific Islander","Arab & Middle East","Native peoples"))
par(mfrow = c(1,1))
barplot(barplotdata2016,
width = 0.01,
xlim = c(0,0.1),
axes = F,
col = c(1,2,3,4,5,6,7),
legend.text = labels_x)