First update for some time. On road to major revision.

This commit is contained in:
agdamsbo 2021-03-29 08:58:26 +02:00
parent 5803d4f3bd
commit e4be92daab
14 changed files with 70 additions and 31 deletions

BIN
.DS_Store vendored

Binary file not shown.

View File

@ -1,7 +1,7 @@
Package: daDoctoR Package: daDoctoR
Title: Functions For Health Research Title: Functions For Health Research
Version: 0.19.14 Version: 0.21.1
Year: 2019 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>
Description: R functions for convenient data management an danalysis in health research. Description: R functions for convenient data management an danalysis in health research.
@ -10,4 +10,4 @@ Suggest: shiny
License: GPL (>= 2) License: GPL (>= 2)
Encoding: UTF-8 Encoding: UTF-8
LazyData: true LazyData: true
RoxygenNote: 6.1.1 RoxygenNote: 7.1.1

View File

@ -6,9 +6,9 @@
#' @keywords age #' @keywords age
#' @export #' @export
#' @examples #' @examples
#' ##Kim Larsen #' ##Kim Larsen (cpr is known from album)
#' dob<-dob_extract_cpr("231045-0637") #' dob<-dob_extract_cpr("231045-0637")
#' date<-as.Date("2018-09-29") #' date<-as.Date("2018-09-30")
#' trunc(age_calc(dob,date)) #' trunc(age_calc(dob,date))
age_calc<-function (dob, enddate = Sys.Date(), units = "years", precise = TRUE) age_calc<-function (dob, enddate = Sys.Date(), units = "years", precise = TRUE)

View File

@ -1,14 +1,20 @@
#' Print regression results according to STROBE #' Print regression results according to STROBE
#' #'
#' Printable table of three dimensional regression analysis of group vs var for meas. By group. #' Printable table of two dimensional regression analysis of group vs variable for outcome measure. By group. Includes p-value
#' @param meas outcome meassure variable name in data-data.frame as a string. Can be numeric or factor. Result is calculated accordingly. #' Group and variable has to be dichotomous factor.
#' @param meas outcome measure variable name in data-data.frame as a string. Can be numeric or factor. Result is calculated accordingly.
#' @param var binary exposure variable to compare against (active vs placebo). As string. #' @param var binary exposure variable to compare against (active vs placebo). As string.
#' @param group group to compare, as string. #' @param group binary group to compare, as string.
#' @param adj variables to adjust for, as string. #' @param adj variables to adjust for, as string.
#' @param data dataframe of data. #' @param data dataframe to subset from.
#' @param dec decimals for results, standard is set to 2. Mean and sd is dec-1. pval has 3 decimals. #' @param dec decimals for results, standard is set to 2. Mean and sd is dec-1. pval has 3 decimals.
#' @keywords strobe #' @keywords strobe
#' @export #' @export
#' @examples
#' data('mtcars')
#' mtcars$vs<-factor(mtcars$vs)
#' mtcars$am<-factor(mtcars$am)
#' strobe_diff_bygroup(meas="mpg",var="vs",group = "am",adj=c("disp","wt"),data=mtcars)
strobe_diff_bygroup<-function(meas,var,group,adj,data,dec=2){ strobe_diff_bygroup<-function(meas,var,group,adj,data,dec=2){

View File

@ -15,6 +15,9 @@ library(shiny)
library(ggplot2) library(ggplot2)
source("https://raw.githubusercontent.com/agdamsbo/daDoctoR/master/R/hwe_geno.R") source("https://raw.githubusercontent.com/agdamsbo/daDoctoR/master/R/hwe_geno.R")
# source("https://raw.githubusercontent.com/agdamsbo/daDoctoR/master/inst/shiny-examples/hwe_calc/ui.R")
# source(list.files(system.file("shiny-examples", "hwe_calc", package = "daDoctoR"), pattern="ui.R", full.names=TRUE))
# Define server logic required to draw a histogram # Define server logic required to draw a histogram
server <- function(input, output, session) { server <- function(input, output, session) {
@ -88,5 +91,6 @@ server <- function(input, output, session) {
} }
# Run the application # Run the application
shinyApp(ui = ui, server = server) shinyApp(ui = ui, server = server)

View File

@ -15,9 +15,9 @@ age_calc(dob, enddate = Sys.Date(), units = "years", precise = TRUE)
For age calculations. For age calculations.
} }
\examples{ \examples{
##Kim Larsen ##Kim Larsen (cpr is known from album)
dob<-dob_extract_cpr("231045-0637") dob<-dob_extract_cpr("231045-0637")
date<-as.Date("2018-09-29") date<-as.Date("2018-09-30")
trunc(age_calc(dob,date)) trunc(age_calc(dob,date))
} }
\keyword{age} \keyword{age}

View File

@ -4,8 +4,7 @@
\alias{euler_plot} \alias{euler_plot}
\title{Creates Euler model from list of identifier numbers.} \title{Creates Euler model from list of identifier numbers.}
\usage{ \usage{
euler_plot(x, total, dec = 1, label = as.character(c(1:5)), euler_plot(x, total, dec = 1, label = as.character(c(1:5)), shape = "ellipse")
shape = "ellipse")
} }
\arguments{ \arguments{
\item{x}{list of variables included. Has to be vectors of identifier numbers.} \item{x}{list of variables included. Has to be vectors of identifier numbers.}

View File

@ -4,9 +4,18 @@
\alias{plot_biv_olr} \alias{plot_biv_olr}
\title{Forrest plot from ordinal logistic regression, version2 of plot_ord_ords().} \title{Forrest plot from ordinal logistic regression, version2 of plot_ord_ords().}
\usage{ \usage{
plot_biv_olr(meas, vars, data, title = NULL, dec = 3, lbls = NULL, plot_biv_olr(
hori = "OR (95 \% CI)", vert = "Variables", short = FALSE, meas,
analysis = c("biv", "multi")) vars,
data,
title = NULL,
dec = 3,
lbls = NULL,
hori = "OR (95 \% CI)",
vert = "Variables",
short = FALSE,
analysis = c("biv", "multi")
)
} }
\arguments{ \arguments{
\item{meas}{outcome meassure variable name or response in data-data.frame as a string. Should be factor, preferably ordered.} \item{meas}{outcome meassure variable name or response in data-data.frame as a string. Should be factor, preferably ordered.}

View File

@ -4,9 +4,16 @@
\alias{plot_ord_odds} \alias{plot_ord_odds}
\title{Forrest plot from ordinal logistic regression.} \title{Forrest plot from ordinal logistic regression.}
\usage{ \usage{
plot_ord_odds(x, title = NULL, dec = 3, lbls = NULL, plot_ord_odds(
hori = "OR (95 \% CI)", vert = "Variables", short = FALSE, x,
input = c("model", "df")) title = NULL,
dec = 3,
lbls = NULL,
hori = "OR (95 \% CI)",
vert = "Variables",
short = FALSE,
input = c("model", "df")
)
} }
\arguments{ \arguments{
\item{x}{input data.} \item{x}{input data.}

View File

@ -4,8 +4,18 @@
\alias{rep_biv} \alias{rep_biv}
\title{A repeated function for bivariate analyses} \title{A repeated function for bivariate analyses}
\usage{ \usage{
rep_biv(y, v1, string, data, method = "pval", logistic = FALSE, rep_biv(
ci = FALSE, cut = 0.1, v2 = NULL, v3 = NULL) y,
v1,
string,
data,
method = "pval",
logistic = FALSE,
ci = FALSE,
cut = 0.1,
v2 = NULL,
v3 = NULL
)
} }
\arguments{ \arguments{
\item{y}{Effect meassure.} \item{y}{Effect meassure.}

View File

@ -4,8 +4,7 @@
\alias{rep_glm} \alias{rep_glm}
\title{A repeated logistic regression function} \title{A repeated logistic regression function}
\usage{ \usage{
rep_glm(meas, vars = NULL, string, ci = FALSE, data, rep_glm(meas, vars = NULL, string, ci = FALSE, data, fixed.var = FALSE)
fixed.var = FALSE)
} }
\arguments{ \arguments{
\item{meas}{Effect meassure. Input as c() of columnnames, use dput().} \item{meas}{Effect meassure. Input as c() of columnnames, use dput().}

View File

@ -4,8 +4,7 @@
\alias{rep_lm} \alias{rep_lm}
\title{A repeated linear regression function} \title{A repeated linear regression function}
\usage{ \usage{
rep_lm(meas, vars = NULL, string, ci = FALSE, data, rep_lm(meas, vars = NULL, string, ci = FALSE, data, fixed.var = FALSE)
fixed.var = FALSE)
} }
\arguments{ \arguments{
\item{meas}{Effect meassure. Input as c() of columnnames, use dput().} \item{meas}{Effect meassure. Input as c() of columnnames, use dput().}

View File

@ -7,19 +7,26 @@
strobe_diff_bygroup(meas, var, group, adj, data, dec = 2) strobe_diff_bygroup(meas, var, group, adj, data, dec = 2)
} }
\arguments{ \arguments{
\item{meas}{outcome meassure variable name in data-data.frame as a string. Can be numeric or factor. Result is calculated accordingly.} \item{meas}{outcome measure variable name in data-data.frame as a string. Can be numeric or factor. Result is calculated accordingly.}
\item{var}{binary exposure variable to compare against (active vs placebo). As string.} \item{var}{binary exposure variable to compare against (active vs placebo). As string.}
\item{group}{group to compare, as string.} \item{group}{binary group to compare, as string.}
\item{adj}{variables to adjust for, as string.} \item{adj}{variables to adjust for, as string.}
\item{data}{dataframe of data.} \item{data}{dataframe to subset from.}
\item{dec}{decimals for results, standard is set to 2. Mean and sd is dec-1. pval has 3 decimals.} \item{dec}{decimals for results, standard is set to 2. Mean and sd is dec-1. pval has 3 decimals.}
} }
\description{ \description{
Printable table of three dimensional regression analysis of group vs var for meas. By group. Printable table of two dimensional regression analysis of group vs variable for outcome measure. By group. Includes p-value
Group and variable has to be dichotomous factor.
}
\examples{
data('mtcars')
mtcars$vs<-factor(mtcars$vs)
mtcars$am<-factor(mtcars$am)
strobe_diff_bygroup(meas="mpg",var="vs",group = "am",adj=c("disp","wt"),data=mtcars)
} }
\keyword{strobe} \keyword{strobe}

View File

@ -4,8 +4,7 @@
\alias{strobe_pred} \alias{strobe_pred}
\title{Regression model of predictors according to STROBE, bi- and multivariate.} \title{Regression model of predictors according to STROBE, bi- and multivariate.}
\usage{ \usage{
strobe_pred(meas, adj, data, dec = 2, n.by.adj = FALSE, strobe_pred(meas, adj, data, dec = 2, n.by.adj = FALSE, p.val = FALSE)
p.val = FALSE)
} }
\arguments{ \arguments{
\item{meas}{binary outcome meassure variable, column name in data.frame as a string. Can be numeric or factor. Result is calculated accordingly.} \item{meas}{binary outcome meassure variable, column name in data.frame as a string. Can be numeric or factor. Result is calculated accordingly.}