Description Usage Arguments Details Value Author(s) Examples
The returned object is a JSON representation of a JavaScript object having components 'mtd', 'trial' and 'ds' – the last of which stands for 'dose-survival'.
1 2 | ## S3 method for class 'de'
as_d3_data(x, ...)
|
x |
The 'de' object to be transformed |
... |
Unused; included to match signature of generic method |
The (unhelpful) default behavior of function r2d3
is to effect this
transformation so as to reduce the size of transmitted data, then restore
the original form upon receipt using JavaScript method
HTMLWidgets.dataframeToD3()
. See
https://rstudio.github.io/r2d3/articles/data_conversion.html.
The returned value is a JSON string corresponding to a list of data frames:
mtd |
Data frame with columns c('id','mtd') |
trial |
Data frame with 'id', 'period', 'dose', 'dlt'.) |
ds |
Data frame with columns 'period','surv','lower','upper','dose'. |
David C. Norris
1 2 3 4 5 6 7 8 9 | library(DTAT)
de <- de.sim(testing=TRUE)
data <- as_d3_data(de)
## Read 'data' back into a list and check a few things
check <- jsonlite::fromJSON(data)
stopifnot(max(abs(attr(de,'mtd') - check$mtd)) < 1e-4)
stopifnot(max(abs(attr(de,'doses') - check$doses)) < 1e-4)
stopifnot(max(abs(attr(de,'mtd_quantiles') - check$mtd_quantiles)) < 1e-4)
stopifnot(all(de[[length(de)]] - check$trial == 0))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.