incremental updates

added label control to plot_ord_odds
This commit is contained in:
agdamsbo 2019-11-08 09:45:15 +01:00
parent e5392893f9
commit 2fc5ae9c8f
5 changed files with 13 additions and 5 deletions

View File

@ -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.9021 Version: 0.1.0.9022
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.

View File

@ -5,6 +5,8 @@
#' @param title plot title #' @param title plot title
#' @param dec decimals for labels #' @param dec decimals for labels
#' @param lbls labels for variable names. Carefull, as the right order is not checked automatically! #' @param lbls labels for variable names. Carefull, as the right order is not checked automatically!
#' @param hori labels the horizontal axis (this i the y axis as the plot is rotated)
#' @param vert labels the horizontal axis (this i the x axis as the plot is rotated)
#' @param short flag to half number of ticks on horizontal axis. #' @param short flag to half number of ticks on horizontal axis.
#' @param input can be either "model", which is a olr model (polr()), or "df", which is a dataframe whith three columns for OR, lower CI and upper CI- #' @param input can be either "model", which is a olr model (polr()), or "df", which is a dataframe whith three columns for OR, lower CI and upper CI-
#' @keywords forestplot #' @keywords forestplot
@ -12,7 +14,7 @@
#' @examples #' @examples
#' plot_ord_odds() #' plot_ord_odds()
plot_ord_odds<-function(x, title = NULL,dec=3,lbls=NULL,short=FALSE,input="model"){ plot_ord_odds<-function(x, title = NULL,dec=3,lbls=NULL,hori="OR (95 % CI)",vert="Variables",short=FALSE,input="model"){
require(ggplot2) require(ggplot2)
@ -48,6 +50,6 @@ plot_ord_odds<-function(x, title = NULL,dec=3,lbls=NULL,short=FALSE,input="model
scale_y_log10(breaks=ticks, labels = ticks) + scale_y_log10(breaks=ticks, labels = ticks) +
geom_hline(yintercept = 1, linetype=2) + geom_hline(yintercept = 1, linetype=2) +
coord_flip() + coord_flip() +
labs(title = title, x = "Variables", y = "OR (95 % CI)") + labs(title = title, x = vert, y = hori) +
theme_bw() theme_bw()
} }

View File

@ -4,7 +4,8 @@
\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, short = FALSE, plot_ord_odds(x, title = NULL, dec = 3, lbls = NULL,
hori = "OR (95 \% CI)", vert = "Variables", short = FALSE,
input = "model") input = "model")
} }
\arguments{ \arguments{
@ -16,6 +17,10 @@ plot_ord_odds(x, title = NULL, dec = 3, lbls = NULL, short = FALSE,
\item{lbls}{labels for variable names. Carefull, as the right order is not checked automatically!} \item{lbls}{labels for variable names. Carefull, as the right order is not checked automatically!}
\item{hori}{labels the horizontal axis (this i the y axis as the plot is rotated)}
\item{vert}{labels the horizontal axis (this i the x axis as the plot is rotated)}
\item{short}{flag to half number of ticks on horizontal axis.} \item{short}{flag to half number of ticks on horizontal axis.}
\item{input}{can be either "model", which is a olr model (polr()), or "df", which is a dataframe whith three columns for OR, lower CI and upper CI-} \item{input}{can be either "model", which is a olr model (polr()), or "df", which is a dataframe whith three columns for OR, lower CI and upper CI-}

View File

@ -20,7 +20,7 @@ strobe_diff_byvar(meas, var, group, adj, data, dec = 2)
\item{groups}{groups to compare, as string.} \item{groups}{groups to compare, as string.}
} }
\description{ \description{
Printable table of three dimensional regression analysis of group vs var for meas. By var. Printable table of three dimensional regression analysis of group vs var for meas. By var. Includes p-values.
} }
\examples{ \examples{
strobe_diff_byvar() strobe_diff_byvar()

View File

@ -32,3 +32,4 @@ updatePackageVersion <- function(packageLocation ="."){
## Return the updated version number to screen ## Return the updated version number to screen
return(vFinal) return(vFinal)
} }