# NOT RUN {
library(dplyr)
library(PKPDmisc)
# given we may only plot a subset of individuals per plot
# and generate multiple plots, lets split the dataframe
list_of_ids <- sd_oral_richpk %>% capitalize_names() %>%
mutate(plotnum = ids_per_plot(ID)) %>% # default 9 per plot
split(.$plotnum)
# now we want to plot each subplot
plot_list <- list_of_ids %>%
lapply(function(df) {
df %>%
ggplot(aes(x = TIME, y = CONC, group = ID)) +
geom_line() + facet_wrap(~ID)
})
# to print these out (with one plot per page on pdf)
print_plots(plot_list)
# }
Run the code above in your browser using DataLab