-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
36172f3
commit 947e311
Showing
5 changed files
with
76 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
|
||
## Type 1=etabar | ||
## Type 2=Etabar SE | ||
## Type 3=P val | ||
## Type 4=%Eta shrinkage SD version | ||
## Type 5=%EPS shrinkage SD version | ||
## Type 6=%Eta shrinkage based on empirical Bayes Variance (SD version) | ||
## Type 7=number of subjects used. | ||
## Type 8=%Eta shrinkage variance version | ||
## Type 9=%Eta shrinkage based on empirical Bayes Variance (variance version) | ||
## Type 10=%EPS shrinkage variance version | ||
## Type 11=%Relative information | ||
|
||
|
||
|
||
file.shk <- fnExtension(file.lst,"shk") | ||
lines.shk <- readLines(file.shk) | ||
idx.tabstart <- grep("^TABLE NO",lines.shk) | ||
idx.tabstart | ||
dt.ts2 <- data.table(idx=c(idx.tabstart,length(lines.shk)+1)) | ||
dt.ts3 <- data.table(start=dt.ts2[-.N],end=dt.ts2[-1]-1) | ||
dt.ts3[,tableno:=sub(" *TABLE NO\\. +([1-9][0-9]*).*","\\1",lines.shk[start.idx])] | ||
dt.ts3 | ||
## dt.ts3[,fread(text=lines.shk[(start.idx+1):end.idx]),by=tableno] | ||
list.shk <- lapply( | ||
split(dt.ts3,by="tableno") | ||
,function(x)fread(text=x[,lines.shk[(start.idx+1):end.idx]])) | ||
lapply(names(list.shk),function(name)list.shk[[name]][,tableno:=name]) | ||
|
||
shk <- list.shk[[length(list.shk)]] | ||
shk | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
NMrelate <- function(file.mod,type="eta"){ | ||
|
||
type <- toupper(type) | ||
str.regex <- switch(type, | ||
ETA="[^H]ETA" | ||
,THETA="THETA") | ||
lines <- c(NMreadSection(file.mod,section="PRED",keep.comments=FALSE), | ||
NMreadSection(file.mod,section="PK",keep.comments=FALSE)) | ||
|
||
|
||
dt.code <- data.table(line.eta = lines[grepl(str.regex,lines)]) | ||
## remove spaces | ||
dt.code[,line2:=gsub(" ","",line.eta)] | ||
|
||
dt.code <- dt.code[,.(text.eta=regmatches(line2, gregexpr(paste0(str.regex,"\\(([0-9]+)\\)"),line2)) |> unlist()),by=.(line.eta,line2)] | ||
|
||
|
||
dt.code[,i:=as.numeric(sub(paste0(".*",str.regex,"\\(([1-9][0-9]*)\\)"),"\\1",text.eta))] | ||
|
||
dt.code[,LHS:=sub("(.*)=.*","\\1",line2)] | ||
|
||
dt.code.eta <- dt.code[,.(label=paste(unique(LHS),collapse=", "), | ||
code=paste(line2,collapse=", ") | ||
),by=.(i,LHS)] | ||
|
||
## if a LHS is affected by multiple ETAs we number them | ||
dt.code.eta[,nrep.LHS:=.N,by=.(LHS)] | ||
dt.code.eta[nrep.LHS>1,label:=paste0(label," - ",type,"(",i,")")] | ||
|
||
dt.code.eta[order(i)] | ||
|
||
} |