Introduction

This data shows the divesity breakdown of participants in GWAS in both 2009 and 2016. The 2009 data was collected by A.C. Need and D.B. Goldstein, and the 2016 data was collected by Alice B. Popejoy and Stephanie M. Fullerton. It was collected by analysis of sample descriptions in the GWAS Catalog. The process was repeated in 2016 to see how diversity has changed through the years regarding GWAS. Write a brief introduction about the data being plotted, including the information

Create data

Vectors of data labels are created for pie graphs

euro_non_euro2009 <- c(96,3,1)
labels1 <- c("European\nancestry\n\n","\n\nAsian\nancestry","\n\n\nOther\nNon-European\nancestry")
euro_non_euro2016 <- c(81,14,5)

Pie graphs

Pie graphs are created and title, radius, initial angle and color are adjusted

# set up par() to allow 2 graphs to be displayed next to each other
par(mfrow = c(1,2), mar = c(2,3,1,5))

#pie graphs 1
# add main, init.angle, radius, and col
pie(euro_non_euro2009, labels = labels1, main = "2009", init.angle = -82, radius = 1, col = c(4,2,3))

# pie graph 2
# add main, init.angle, radius, and col
pie(euro_non_euro2016, labels = labels1, main = "2016", init.angle = -57, radius = 1, col = c(4,2,3))

Bar graphs

If you want, you can examine this code below to see how stacked 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)