Skip to content

Commit

Permalink
changed netMetagetTRTS to accept session as data
Browse files Browse the repository at this point in the history
  • Loading branch information
Rostu committed Dec 2, 2024
1 parent 205f548 commit 724989d
Showing 1 changed file with 23 additions and 23 deletions.
46 changes: 23 additions & 23 deletions R/netMetaGetTRTS.R
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")
}

0 comments on commit 724989d

Please sign in to comment.