Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #70 work branch #79

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Prev Previous commit
Next Next commit
whups a few errors in anlyz_fda_ndc.Rmd
  • Loading branch information
[email protected] committed Jan 20, 2018
commit e20ae1bb47ea0c5b31f06182d958d8b00deb4b03
17 changes: 5 additions & 12 deletions R/analysis-vis/explore_fda_nda_product/anlyz_fda_ndc.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,6 @@ names(ndc.dat)

##Preliminary Exploration
###How many drugs have multiple active ingredients?
```{r}
occurences <- sapply( ndc.dat$productid, function(x) {
occur <- ndc.dat[ ndc.dat$productid==x, c("nonproprietaryname") ]
return( length( occur ) )
})
````

Every entry in the original dataset corresponded to a unique **productid**...
```{r}
length( unique(ndc.dat$productid) )
Expand Down Expand Up @@ -73,19 +66,19 @@ spd.dat[, upper.cols] <- sapply( spd.dat[, upper.cols], safe.lower )
head(spd.dat)
````

There seems to be some weird **drugname_brand** and **drugname_generic** entries. I'm going to the **proprietaryname** column If there are any matches I'm going to pull the corresponding **productids** and hold them in a vector.
There seems to be some weird **drugname_brand** and **drugname_generic** entries. I'm going to the search for them in the **proprietaryname** column If there are any matches I'm going to pull the corresponding **productids** and hold them in a vector.
```{r}
ndc.pid <- function(x){
if (x %in% ndc.dat) {
sub.ndc <- subset( ndc.dat, proprietaryname == x )
return( unique(sub.ndc$productid) )
sub.ndc <- ndc.dat[ ndc.dat$proprietaryname == x , c('productid') ]
return( unlist ( unique(sub.ndc$productid) ) )
}
}

hold <- unlist( lapply(spd.dat$drugname_brand, ndc.pid ) )
hold <- unlist( sapply(spd.dat$drugname_brand, ndc.pid ) )

````