Skip to content

Commit

Permalink
.get_phlabresults_data_from_NASIS_db: fix for #324
Browse files Browse the repository at this point in the history
  • Loading branch information
brownag committed Dec 13, 2023
1 parent 3dfc9b3 commit a5375d4
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions R/get_phlabresults_data_from_NASIS_db.R
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ LEFT OUTER JOIN phlabresults_View_1 phl on phl.phiidref = ph.phiid
d.dups_char <- do.call(
"rbind", by(d.dups_char, d.dups_char[[var]], function(x) {
data.frame(
peiid = unique(x[['peiid']]),
lapply(x[2:ncol(x)], function(x2) x2[which.max(x$hzthk)])
peiid = unique(x[['peiid']]),
lapply(x[2:ncol(x)], function(x2) x2[max(c(1, which.max(x$hzthk)), na.rm = TRUE)])
)})
)

Expand All @@ -79,9 +79,9 @@ LEFT OUTER JOIN phlabresults_View_1 phl on phl.phiidref = ph.phiid
d.dups_ph <- do.call(
"rbind",
by(d.dups_ph, d.dups_ph[[var]], function(x) { data.frame(
peiid = unique(x[['peiid']]),
phiid = unique(x[['phiid']]),
lapply(x[3:ncol(x)], function(x2) -log10(weighted.mean(1/10^x2, weights = x$hzthk, na.rm = TRUE)))
peiid = unique(x[['peiid']]),
phiid = unique(x[['phiid']]),
lapply(x[3:ncol(x)], function(x2) -log10(weighted.mean(1/10^x2, weights = x$hzthk, na.rm = TRUE)))
)})
)

Expand Down

0 comments on commit a5375d4

Please sign in to comment.