print_pred_stratu updated to include all flags for print_pred

This commit is contained in:
AG Damsbo 2021-10-06 11:05:55 +02:00
parent 32054658bb
commit 030f2196d7
3 changed files with 13 additions and 5 deletions

View File

@ -1,6 +1,6 @@
Package: daDoctoR Package: daDoctoR
Title: Functions For Health Research Title: Functions For Health Research
Version: 0.21.11 Version: 0.21.12
Year: 2021 Year: 2021
Author: Andreas Gammelgaard Damsbo <agdamsbo@pm.me> Author: Andreas Gammelgaard Damsbo <agdamsbo@pm.me>
Maintainer: Andreas Gammelgaard Damsbo <agdamsbo@pm.me> Maintainer: Andreas Gammelgaard Damsbo <agdamsbo@pm.me>

View File

@ -16,15 +16,15 @@
#' mtcars$am<-factor(mtcars$am) #' mtcars$am<-factor(mtcars$am)
#' print_pred_stratum(meas="mpg",strat="vs",adj=c("disp","wt","am"),data=mtcars,include.stratum=TRUE) #' print_pred_stratum(meas="mpg",strat="vs",adj=c("disp","wt","am"),data=mtcars,include.stratum=TRUE)
print_pred_stratum<-function(meas,adj,strat,data,dec,include.stratum=TRUE){ print_pred_stratum<-function(meas,adj,strat,data,dec=2,n.by.adj=FALSE,p.val=FALSE){
require(daDoctoR) require(daDoctoR)
require(dplyr) require(dplyr)
if (include.stratum==TRUE){ if (include.stratum==TRUE){
ls<-list(all=print_pred(meas = meas,adj=c(strat,adj),data=data)) ls<-list(all=print_pred(meas = meas,adj=c(strat,adj),data=data,dec=dec,n.by.adj=n.by.adj,p.val=p.val))
} }
if (include.stratum==FALSE) { if (include.stratum==FALSE) {
ls<-list(all=print_pred(meas = meas,adj=adj,data=data)) ls<-list(all=print_pred(meas = meas,adj=adj,data=data,dec=dec,n.by.adj=n.by.adj,p.val=p.val))
} }
strt<-data[, c(strat)] strt<-data[, c(strat)]

View File

@ -4,7 +4,15 @@
\alias{print_pred_stratum} \alias{print_pred_stratum}
\title{Extension to the print_pred function, for by stratum analysis.} \title{Extension to the print_pred function, for by stratum analysis.}
\usage{ \usage{
print_pred_stratum(meas, adj, strat, data, dec, include.stratum = TRUE) print_pred_stratum(
meas,
adj,
strat,
data,
dec = 2,
n.by.adj = FALSE,
p.val = FALSE
)
} }
\arguments{ \arguments{
\item{meas}{binary outcome measure variable, column name in data.frame as a string. Can be numeric or factor. Result is calculated accordingly.} \item{meas}{binary outcome measure variable, column name in data.frame as a string. Can be numeric or factor. Result is calculated accordingly.}