Skip to content

Instantly share code, notes, and snippets.

View csgallego's full-sized avatar

Cecile Gallego csgallego

  • ICIJ
  • Washington, DC
View GitHub Profile
@csgallego
csgallego / yazstate
Created January 22, 2014 23:31
Statistics on FDA's AERS data on Yaz/Yasmin (Bayer).
#We start by opening the file drug12q4 (4th quaterly report from the year 2012) that lists the number or complaints for each drug. The information is separated by dollar signs so we add a separator. We noticed that there was a problem with one quotation mark and we solve this problem by adding quote.
drug12q4 = read.csv("aers_ascii_2012q4/ascii/drug12q4.txt",sep="$",as.is=TRUE,quote="")
#We want to look at all the drugs that are a form of Yaz/Yasmin/Ocella (they might be under different names)
Yaz12q4 = grepl("(^yaz.*)|(^yasm.*)|(^ocel.*)|(^safy*)|(beyaz)",drug12q4$DRUGNAME,ignore.case=TRUE)
#We create a table of Yaz12q4.
table(drug12q4$DRUGNAME[Yaz12q4])
#We sum to see how many complaints there were against Yaz/Yasmin/Ocella in the 4th quarter of 2012.