-
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 netMetagetTRTS to accept session as data
- Loading branch information
Showing
1 changed file
with
23 additions
and
23 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,23 +1,23 @@ | ||
#' @title Helper Function to get possible reference categories fot the netmeta model | ||
#' @description | ||
#' Helper Function to get possible reference categories to be used in the netmeta model | ||
#' This function is used to populate the gui with reference options | ||
#' @param d | ||
#' A \code{string} representing the dataset name for which the reference categories should be retrieved | ||
#' @return create a json file containing the reference categories in the opencpu session which can then be retrieved in another call | ||
#' @author Robert Studtrucker | ||
#' @export | ||
netMetagetTRTS <- function(d) { | ||
#Todo check if there is a better way to do this | ||
requireNamespace("jsonlite") | ||
|
||
#load the in variable d defined dataset from the package | ||
dat <- checkData(d) | ||
|
||
combined_treat<-c() | ||
combined_treat<-c(combined_treat,dat["treat1"],recursive = TRUE,use.names=FALSE) | ||
combined_treat<-c(combined_treat,dat["treat2"],recursive = TRUE,use.names=FALSE) | ||
|
||
trts<-unique(combined_treat)[!is.na(unique(combined_treat))] | ||
jsonlite::write_json(trts, "trts.json") | ||
} | ||
#' @title Helper Function to get possible reference categories fot the netmeta model | ||
#' @description | ||
#' Helper Function to get possible reference categories to be used in the netmeta model | ||
#' This function is used to populate the gui with reference options | ||
#' @param d | ||
#' A \code{string} representing the dataset name for which the reference categories should be retrieved | ||
#' @return create a json file containing the reference categories in the opencpu session which can then be retrieved in another call | ||
#' @author Robert Studtrucker | ||
#' @export | ||
netMetagetTRTS <- function(d) { | ||
#Todo check if there is a better way to do this | ||
requireNamespace("jsonlite") | ||
|
||
#load the in variable d defined dataset from the package | ||
dat <- d | ||
|
||
combined_treat<-c() | ||
combined_treat<-c(combined_treat,dat["treat1"],recursive = TRUE,use.names=FALSE) | ||
combined_treat<-c(combined_treat,dat["treat2"],recursive = TRUE,use.names=FALSE) | ||
|
||
trts<-unique(combined_treat)[!is.na(unique(combined_treat))] | ||
jsonlite::write_json(trts, "trts.json") | ||
} |