mirror of
https://github.com/agdamsbo/daDoctoR.git
synced 2024-11-24 12:41:54 +01:00
new var.names
This commit is contained in:
parent
91f3c0a483
commit
93fea3a8a6
@ -1,7 +1,7 @@
|
||||
Package: daDoctoR
|
||||
Type: Package
|
||||
Title: FUNCTIONS FOR HEALTH RESEARCH
|
||||
Version: 0.1.0.9028
|
||||
Version: 0.1.0.9029
|
||||
Author: c(person("Andreas", "Gammelgaard Damsbo", email = "agdamsbo@pm.me", role = c("cre", "aut")))
|
||||
Maintainer: Andreas Gammelgaard Damsbo <agdamsbo@pm.me>
|
||||
Description: I am a Danish medical doctor involved in neuropsychiatric research.
|
||||
|
@ -161,13 +161,22 @@ strobe_pred<-function(meas,adj,data,dec=2,n.by.adj=FALSE,p.val=FALSE){
|
||||
|
||||
suppressWarnings(re<-left_join(df,dfcr,by="names"))
|
||||
|
||||
rona<-c()
|
||||
for (i in 1:length(ads)){
|
||||
if (is.factor(ads[,i])){
|
||||
rona<-c(rona,names(ads[i]),levels(ads[,i]))
|
||||
if (!is.factor(ads[,i])){
|
||||
rona<-c(rona,names(ads[i]),"Per unit increase")
|
||||
}
|
||||
}}
|
||||
|
||||
if (p.val==TRUE){
|
||||
ref<-data.frame(re[,1],re[,2],re[,5],re[,6],re[,3],re[,4])
|
||||
ref<-data.frame(c(NA,rona),re[,2],re[,5],re[,6],re[,3],re[,4])
|
||||
|
||||
names(ref)<-c("Variable",paste0("N=",n.meas),"Crude OR (95 % CI)","p-value","Mutually adjusted OR (95 % CI)","A p-value")
|
||||
}
|
||||
else{
|
||||
ref<-data.frame(re[,1],re[,2],re[,5],re[,3])
|
||||
ref<-data.frame(c(NA,rona),re[,2],re[,5],re[,3])
|
||||
|
||||
names(ref)<-c("Variable",paste0("N=",n.meas),"Crude OR (95 % CI)","Mutually adjusted OR (95 % CI)")
|
||||
}
|
||||
@ -319,13 +328,22 @@ strobe_pred<-function(meas,adj,data,dec=2,n.by.adj=FALSE,p.val=FALSE){
|
||||
|
||||
suppressWarnings(re<-left_join(df,dfcr,by="names"))
|
||||
|
||||
rona<-c()
|
||||
for (i in 1:length(ads)){
|
||||
if (is.factor(ads[,i])){
|
||||
rona<-c(rona,names(ads[i]),levels(ads[,i]))
|
||||
if (!is.factor(ads[,i])){
|
||||
rona<-c(rona,names(ads[i]),"Per unit increase")
|
||||
}
|
||||
}}
|
||||
|
||||
if (p.val==TRUE){
|
||||
ref<-data.frame(re[,1],re[,2],re[,5],re[,6],re[,3],re[,4])
|
||||
ref<-data.frame(c(NA,rona),re[,2],re[,5],re[,6],re[,3],re[,4])
|
||||
|
||||
names(ref)<-c("Variable",paste0("N=",n.meas),"Difference (95 % CI)","p-value","Mutually adjusted difference (95 % CI)","A p-value")
|
||||
}
|
||||
else{
|
||||
ref<-data.frame(re[,1],re[,2],re[,5],re[,3])
|
||||
ref<-data.frame(c(NA,rona),re[,2],re[,5],re[,3])
|
||||
|
||||
names(ref)<-c("Variable",paste0("N=",n.meas),"Difference (95 % CI)","Mutually adjusted difference (95 % CI)")
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user