mirror of
https://github.com/agdamsbo/daDoctoR.git
synced 2024-11-21 11:20:23 +01:00
First update for some time. On road to major revision.
This commit is contained in:
parent
5803d4f3bd
commit
e4be92daab
@ -1,7 +1,7 @@
|
||||
Package: daDoctoR
|
||||
Title: Functions For Health Research
|
||||
Version: 0.19.14
|
||||
Year: 2019
|
||||
Version: 0.21.1
|
||||
Year: 2021
|
||||
Author: 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.
|
||||
@ -10,4 +10,4 @@ Suggest: shiny
|
||||
License: GPL (>= 2)
|
||||
Encoding: UTF-8
|
||||
LazyData: true
|
||||
RoxygenNote: 6.1.1
|
||||
RoxygenNote: 7.1.1
|
||||
|
@ -6,9 +6,9 @@
|
||||
#' @keywords age
|
||||
#' @export
|
||||
#' @examples
|
||||
#' ##Kim Larsen
|
||||
#' ##Kim Larsen (cpr is known from album)
|
||||
#' dob<-dob_extract_cpr("231045-0637")
|
||||
#' date<-as.Date("2018-09-29")
|
||||
#' date<-as.Date("2018-09-30")
|
||||
#' trunc(age_calc(dob,date))
|
||||
|
||||
age_calc<-function (dob, enddate = Sys.Date(), units = "years", precise = TRUE)
|
||||
|
@ -1,14 +1,20 @@
|
||||
#' Print regression results according to STROBE
|
||||
#'
|
||||
#' Printable table of three dimensional regression analysis of group vs var for meas. By group.
|
||||
#' @param meas outcome meassure variable name in data-data.frame as a string. Can be numeric or factor. Result is calculated accordingly.
|
||||
#' 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.
|
||||
#' @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 group group to compare, as string.
|
||||
#' @param group binary group to compare, 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.
|
||||
#' @keywords strobe
|
||||
#' @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){
|
||||
|
||||
|
@ -15,6 +15,9 @@ library(shiny)
|
||||
library(ggplot2)
|
||||
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
|
||||
|
||||
server <- function(input, output, session) {
|
||||
@ -88,5 +91,6 @@ server <- function(input, output, session) {
|
||||
}
|
||||
|
||||
# Run the application
|
||||
|
||||
shinyApp(ui = ui, server = server)
|
||||
|
||||
|
@ -15,9 +15,9 @@ age_calc(dob, enddate = Sys.Date(), units = "years", precise = TRUE)
|
||||
For age calculations.
|
||||
}
|
||||
\examples{
|
||||
##Kim Larsen
|
||||
##Kim Larsen (cpr is known from album)
|
||||
dob<-dob_extract_cpr("231045-0637")
|
||||
date<-as.Date("2018-09-29")
|
||||
date<-as.Date("2018-09-30")
|
||||
trunc(age_calc(dob,date))
|
||||
}
|
||||
\keyword{age}
|
||||
|
@ -4,8 +4,7 @@
|
||||
\alias{euler_plot}
|
||||
\title{Creates Euler model from list of identifier numbers.}
|
||||
\usage{
|
||||
euler_plot(x, total, dec = 1, label = as.character(c(1:5)),
|
||||
shape = "ellipse")
|
||||
euler_plot(x, total, dec = 1, label = as.character(c(1:5)), shape = "ellipse")
|
||||
}
|
||||
\arguments{
|
||||
\item{x}{list of variables included. Has to be vectors of identifier numbers.}
|
||||
|
@ -4,9 +4,18 @@
|
||||
\alias{plot_biv_olr}
|
||||
\title{Forrest plot from ordinal logistic regression, version2 of plot_ord_ords().}
|
||||
\usage{
|
||||
plot_biv_olr(meas, vars, data, title = NULL, dec = 3, lbls = NULL,
|
||||
hori = "OR (95 \% CI)", vert = "Variables", short = FALSE,
|
||||
analysis = c("biv", "multi"))
|
||||
plot_biv_olr(
|
||||
meas,
|
||||
vars,
|
||||
data,
|
||||
title = NULL,
|
||||
dec = 3,
|
||||
lbls = NULL,
|
||||
hori = "OR (95 \% CI)",
|
||||
vert = "Variables",
|
||||
short = FALSE,
|
||||
analysis = c("biv", "multi")
|
||||
)
|
||||
}
|
||||
\arguments{
|
||||
\item{meas}{outcome meassure variable name or response in data-data.frame as a string. Should be factor, preferably ordered.}
|
||||
|
@ -4,9 +4,16 @@
|
||||
\alias{plot_ord_odds}
|
||||
\title{Forrest plot from ordinal logistic regression.}
|
||||
\usage{
|
||||
plot_ord_odds(x, title = NULL, dec = 3, lbls = NULL,
|
||||
hori = "OR (95 \% CI)", vert = "Variables", short = FALSE,
|
||||
input = c("model", "df"))
|
||||
plot_ord_odds(
|
||||
x,
|
||||
title = NULL,
|
||||
dec = 3,
|
||||
lbls = NULL,
|
||||
hori = "OR (95 \% CI)",
|
||||
vert = "Variables",
|
||||
short = FALSE,
|
||||
input = c("model", "df")
|
||||
)
|
||||
}
|
||||
\arguments{
|
||||
\item{x}{input data.}
|
||||
|
@ -4,8 +4,18 @@
|
||||
\alias{rep_biv}
|
||||
\title{A repeated function for bivariate analyses}
|
||||
\usage{
|
||||
rep_biv(y, v1, string, data, method = "pval", logistic = FALSE,
|
||||
ci = FALSE, cut = 0.1, v2 = NULL, v3 = NULL)
|
||||
rep_biv(
|
||||
y,
|
||||
v1,
|
||||
string,
|
||||
data,
|
||||
method = "pval",
|
||||
logistic = FALSE,
|
||||
ci = FALSE,
|
||||
cut = 0.1,
|
||||
v2 = NULL,
|
||||
v3 = NULL
|
||||
)
|
||||
}
|
||||
\arguments{
|
||||
\item{y}{Effect meassure.}
|
||||
|
@ -4,8 +4,7 @@
|
||||
\alias{rep_glm}
|
||||
\title{A repeated logistic regression function}
|
||||
\usage{
|
||||
rep_glm(meas, vars = NULL, string, ci = FALSE, data,
|
||||
fixed.var = FALSE)
|
||||
rep_glm(meas, vars = NULL, string, ci = FALSE, data, fixed.var = FALSE)
|
||||
}
|
||||
\arguments{
|
||||
\item{meas}{Effect meassure. Input as c() of columnnames, use dput().}
|
||||
|
@ -4,8 +4,7 @@
|
||||
\alias{rep_lm}
|
||||
\title{A repeated linear regression function}
|
||||
\usage{
|
||||
rep_lm(meas, vars = NULL, string, ci = FALSE, data,
|
||||
fixed.var = FALSE)
|
||||
rep_lm(meas, vars = NULL, string, ci = FALSE, data, fixed.var = FALSE)
|
||||
}
|
||||
\arguments{
|
||||
\item{meas}{Effect meassure. Input as c() of columnnames, use dput().}
|
||||
|
@ -7,19 +7,26 @@
|
||||
strobe_diff_bygroup(meas, var, group, adj, data, dec = 2)
|
||||
}
|
||||
\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{group}{group to compare, as string.}
|
||||
\item{group}{binary group to compare, 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.}
|
||||
}
|
||||
\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}
|
||||
|
@ -4,8 +4,7 @@
|
||||
\alias{strobe_pred}
|
||||
\title{Regression model of predictors according to STROBE, bi- and multivariate.}
|
||||
\usage{
|
||||
strobe_pred(meas, adj, data, dec = 2, n.by.adj = FALSE,
|
||||
p.val = FALSE)
|
||||
strobe_pred(meas, adj, data, dec = 2, n.by.adj = FALSE, p.val = FALSE)
|
||||
}
|
||||
\arguments{
|
||||
\item{meas}{binary outcome meassure variable, column name in data.frame as a string. Can be numeric or factor. Result is calculated accordingly.}
|
||||
|
Loading…
Reference in New Issue
Block a user