#| message: false #| warning: false library(dplyr) library(pmplots) data <- pmplots_data_obs() data <- filter(data, ID <= 9*2) data <- mutate(data, OCC = as.integer(TIME > 12)) head(data) count(data, ID, OCC) data1 <- filter(data, ID <= 9)
pmplots:::chunk_by_cols( data, cols = "ID", id_per_chunk = 9 )
pmplots:::chunk_by_cols( data, cols = "ID", id_per_chunk = 3) %>% length()
pmplots:::chunk_by_cols( data, cols = c("ID", "OCC"), id_per_chunk = 3) %>% length()
ans <- dv_pred_ipred( data, facets = "ID", id_per_plot = 4, ncol = 2, xlab = "Time (hr)", ylab = "Concentration (ng/ml)" ) length(ans) ans[1:2]
This has twice as many plots because every
ans <- dv_pred_ipred( data, facets = c("ID", "OCC"), id_per_plot = 4, ncol = 2 ) length(ans) ans[1:2]
OCC
and that takes values of 0
and 1
, the strip labels will show 0
and 1
glue
syntax, rather than specifying OCC
we pass OCC//Occasion: {OCC}
so that the
strip will say Occasion: 1
and Occasion: 2
ans <- dv_pred_ipred( data, facets = c("ID//ID: {ID}", "OCC//Occasion: {OCC}"), id_per_plot = 4, ncol = 2 ) ans[1]
ipred_lty
: linetype for ipred; use 0 to suppress the linepred_lty
: linetype for pred; use 0 to suppress the lineThe plot will drop lines for PRED
and IPRED
in the plot and legend
dv_pred_ipred(data1, ipred_lty = 0, pred_lty = 0)[[1]]
ipred_point
: logical indicating if points should be plotted; shape is same as dvpred_point
: logical indicating if points should be plotted; shape is same as dvThe plot will drop points for PRED
and IPRED
in the plot and legend
dv_pred_ipred(data1, ipred_point = FALSE, pred_point = FALSE)[[1]]
ipred_color
: color for ipred datapred_color
: color for pred dataThe plot will drop points for PRED
and IPRED
in the plot and legend
dv_pred_ipred(data1, ipred_color = "green4", pred_color = "orange3")[[1]]
margin
is deprecated; use plot.margin
insteaddv_pred_ipred( data1, plot.margin = margin(0, 2, 0, 0, unit = "in") )[[1]]
strip.text
dv_pred_ipred( data1, strip.text = element_text(size = 5, margin = margin(3,0,3,0)) )[[1]]
dv_pred_ipred(data1, log_y = TRUE)[[1]]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.