-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
changed rma function to accept session key instead of dataset name
- Loading branch information
Showing
1 changed file
with
41 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,41 @@ | ||
#' @title rma uni model | ||
#' @description | ||
#' Using metafor package to fit a rma uni model. | ||
#' @param yi | ||
#' A \code{string} of the variable which holds the vector of length k with the observed effect sizes or outcomes in the selected dataset (d) | ||
#' @param vi | ||
#' A \code{string} of the variable which holds the vector of length k with the corresponding sampling variances in the selected dataset (d) | ||
#' @param d | ||
#' A \code{string} representing the dataset name that should be used for fitting. | ||
#' @return | ||
#' rma uni model | ||
#' also creates a json file (imgHeight.json) that is used in a later api call to define the height of the plots | ||
#' @author Robert Studtrucker | ||
#' @export | ||
rma <- function(yi,vi,measure,d,effect="Effect") { | ||
#library('metafor') | ||
#library("ggplot2") | ||
#library('jsonlite') | ||
#library('psych') | ||
|
||
requireNamespace("metafor") | ||
requireNamespace("ggplot2") | ||
requireNamespace("jsonlite") | ||
requireNamespace("psych") | ||
|
||
#load the in variable d defined dataset from the package | ||
dat <- checkData(d) | ||
checkParameter(dat,c(yi,vi)) | ||
dat <- dat[order(dat$r_year),] | ||
|
||
if(measure == "COR") { | ||
# z-standardisierte Daten erstellen | ||
temp_dat <- metafor::escalc(measure="ZCOR", ri=dat[,yi], vi=dat[,vi], ni=dat[,"o_ni"], data=dat, var.names=c("o_zcor","o_zcor_var")) | ||
|
||
# Modell berechnen | ||
rma_model <- metafor::rma.uni(temp_dat[,"o_zcor"],temp_dat[,"o_zcor_var"], measure="ZCOR",slab=paste(dat$r_author, dat$r_year)) | ||
|
||
}else{ | ||
rma_model <- metafor::rma.uni(yi=dat[,yi],vi=dat[,vi],measure=measure,slab=paste(dat$r_author, dat$r_year)) | ||
|
||
} | ||
} | ||
#' @title rma uni model | ||
#' @description | ||
#' Using metafor package to fit a rma uni model. | ||
#' @param yi | ||
#' A \code{string} of the variable which holds the vector of length k with the observed effect sizes or outcomes in the selected dataset (d) | ||
#' @param vi | ||
#' A \code{string} of the variable which holds the vector of length k with the corresponding sampling variances in the selected dataset (d) | ||
#' @param d | ||
#' A \code{string} representing the dataset name that should be used for fitting. | ||
#' @return | ||
#' rma uni model | ||
#' also creates a json file (imgHeight.json) that is used in a later api call to define the height of the plots | ||
#' @author Robert Studtrucker | ||
#' @export | ||
rma <- function(yi,vi,measure,d,effect="Effect") { | ||
#library('metafor') | ||
#library("ggplot2") | ||
#library('jsonlite') | ||
#library('psych') | ||
|
||
requireNamespace("metafor") | ||
requireNamespace("ggplot2") | ||
requireNamespace("jsonlite") | ||
requireNamespace("psych") | ||
|
||
#load the in variable d defined dataset from the package | ||
dat <- d | ||
checkParameter(dat,c(yi,vi)) | ||
dat <- dat[order(dat$r_year),] | ||
|
||
if(measure == "COR") { | ||
# z-standardisierte Daten erstellen | ||
temp_dat <- metafor::escalc(measure="ZCOR", ri=dat[,yi], vi=dat[,vi], ni=dat[,"o_ni"], data=dat, var.names=c("o_zcor","o_zcor_var")) | ||
|
||
# Modell berechnen | ||
rma_model <- metafor::rma.uni(temp_dat[,"o_zcor"],temp_dat[,"o_zcor_var"], measure="ZCOR",slab=paste(dat$r_author, dat$r_year)) | ||
|
||
}else{ | ||
rma_model <- metafor::rma.uni(yi=dat[,yi],vi=dat[,vi],measure=measure,slab=paste(dat$r_author, dat$r_year)) | ||
} | ||
} |