diff --git a/NAMESPACE b/NAMESPACE index 4e2f402..38efd0e 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -27,3 +27,4 @@ export(checkData) export(checkParameter) export(createData) export(testListParameter) +export(testpredParameter) diff --git a/R/rmaMVModel.R b/R/rmaMVModel.R index e353e22..adc1cec 100644 --- a/R/rmaMVModel.R +++ b/R/rmaMVModel.R @@ -36,6 +36,20 @@ rmaMVModel <- function(yi,vi,measure,d,pred1=NULL,pred2=NULL,nesting=NULL) { if(!is.null(nesting)){ nesting <- jsonlite::fromJSON(nesting) } + if(!is.null(pred1)){ + # Parse the JSON string into a list + pred1<-jsonlite::fromJSON(pred1) + + # Convert the list to a vector + pred1 <- unlist(pred1) + } + if(!is.null(pred2)){ + # Parse the JSON string into a list + pred2<-jsonlite::fromJSON(pred2) + + # Convert the list to a vector + pred2 <- unlist(pred2) + } checkParameter(dat,c(yi,vi)) diff --git a/R/testFunctions.R b/R/testFunctions.R index 1549e80..144a46c 100644 --- a/R/testFunctions.R +++ b/R/testFunctions.R @@ -20,3 +20,17 @@ testListParameter <- function(nesting = NULL) { nest2 <- list(~1 | outcome_ID, ~1 | sample_ID, ~1 | report_ID) print(nest2) } + + +testpredParameter<-function(pred1){ + + + # Parse the JSON string into a list + pred1<-jsonlite::fromJSON(pred1) + + # Convert the list to a vector + pred1 <- unlist(pred1) + + print(pred1) + pred1["value"] +}