mirror of
https://github.com/agdamsbo/daDoctoR.git
synced 2024-11-22 03:40:23 +01:00
fix to counting. whoop whoop
This commit is contained in:
parent
59ae3c2f99
commit
19c73b34e6
@ -1,7 +1,7 @@
|
|||||||
Package: daDoctoR
|
Package: daDoctoR
|
||||||
Type: Package
|
Type: Package
|
||||||
Title: FUNCTIONS FOR HEALTH RESEARCH
|
Title: FUNCTIONS FOR HEALTH RESEARCH
|
||||||
Version: 0.1.0.9006
|
Version: 0.1.0.9007
|
||||||
Author@R: c(person("Andreas", "Gammelgaard Damsbo", email = "agdamsbo@pm.me", role = c("cre", "aut")))
|
Author@R: c(person("Andreas", "Gammelgaard Damsbo", email = "agdamsbo@pm.me", role = c("cre", "aut")))
|
||||||
Maintainer: Andreas Gammelgaard Damsbo <agdamsbo@pm.me>
|
Maintainer: Andreas Gammelgaard Damsbo <agdamsbo@pm.me>
|
||||||
Description: I am a Danish medical doctor involved in neuropsychiatric research.
|
Description: I am a Danish medical doctor involved in neuropsychiatric research.
|
||||||
|
@ -58,8 +58,8 @@ strobe_olr<-function(meas,var,adj,data,dec=2){
|
|||||||
nall<-as.numeric(nrow(dat[!is.na(dat[,2]),]))
|
nall<-as.numeric(nrow(dat[!is.na(dat[,2]),]))
|
||||||
nl<-levels(m)[r]
|
nl<-levels(m)[r]
|
||||||
pro<-round(n/nall*100,0)
|
pro<-round(n/nall*100,0)
|
||||||
n<-paste0(n," (",pro,"%)")
|
rt<-paste0(n," (",pro,"%)")
|
||||||
nr<-rbind(nr,cbind(nl,n))
|
nr<-rbind(nr,cbind(nl,rt))
|
||||||
}
|
}
|
||||||
|
|
||||||
mms<-data.frame(cbind(nr,or_ci,pv))
|
mms<-data.frame(cbind(nr,or_ci,pv))
|
||||||
@ -92,20 +92,23 @@ strobe_olr<-function(meas,var,adj,data,dec=2){
|
|||||||
ns<-names(dat2)[i]
|
ns<-names(dat2)[i]
|
||||||
for (r in 1:length(levels(vec))){
|
for (r in 1:length(levels(vec))){
|
||||||
vr<-levels(vec)[r]
|
vr<-levels(vec)[r]
|
||||||
dr<-vec[vec==vr]
|
dr<-vec[vec==vr&!is.na(vec)]
|
||||||
n<-as.numeric(length(dr))
|
n<-as.numeric(length(dr))
|
||||||
# nall<-as.numeric(nrow(dat[!is.na(dat2[,c(ns)]),]))
|
nall<-as.numeric(nrow(dat[!is.na(dat2[,c(ns)]),]))
|
||||||
nl<-paste0(ns,levels(vec)[r])
|
nl<-paste0(ns,levels(vec)[r])
|
||||||
# pro<-round(n/nall*100,0)
|
pro<-round(n/nall*100,0)
|
||||||
# rt<-paste0(n," (",pro,"%)")
|
rt<-paste0(n," (",pro,"%)")
|
||||||
nq<-rbind(nq,cbind(nl,n))
|
nq<-rbind(nq,cbind(nl,rt))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!is.factor(dat2[,i])){
|
if (!is.factor(dat2[,i])){
|
||||||
num<-dat2[,i]
|
num<-dat2[,i]
|
||||||
ns<-names(dat2)[i]
|
ns<-names(dat2)[i]
|
||||||
nall<-as.numeric(nrow(dat[!is.na(dat2[,c(ns)]),]))
|
n<-as.numeric(nrow(dat[!is.na(dat2[,c(ns)]),]))
|
||||||
nq<-rbind(nq,cbind(ns,nall))
|
nall<-as.numeric(nrow(dat))
|
||||||
|
pro<-round(n/nall*100,0)
|
||||||
|
rt<-paste0(n," (",pro,"%)")
|
||||||
|
nq<-rbind(nq,cbind(ns,rt))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -122,7 +125,7 @@ strobe_olr<-function(meas,var,adj,data,dec=2){
|
|||||||
res<-cbind(aor_ci,apv)
|
res<-cbind(aor_ci,apv)
|
||||||
rest<-data.frame(names=row.names(res),res,stringsAsFactors = F)
|
rest<-data.frame(names=row.names(res),res,stringsAsFactors = F)
|
||||||
|
|
||||||
numb<-data.frame(names=nq[,c("nl")],N=nq[,c("n")],stringsAsFactors = F)
|
numb<-data.frame(names=nq[,c("nl")],N=nq[,c("rt")],stringsAsFactors = F)
|
||||||
namt<-data.frame(names=rnames,stringsAsFactors = F)
|
namt<-data.frame(names=rnames,stringsAsFactors = F)
|
||||||
|
|
||||||
coll<-left_join(left_join(namt,numb,by="names"),rest,by="names")
|
coll<-left_join(left_join(namt,numb,by="names"),rest,by="names")
|
||||||
|
Loading…
Reference in New Issue
Block a user