Graphing Mean PK profile [🇷 for BE/BA]
Dear roman_max,
Assuming that your data file of individual concentration
Obviously,
The main idea is the
❝ Can anyone share idea (R-code?) how to do it? How a data-set can be organized for this graph?
Assuming that your data file of individual concentration
dat_ind
contain at least the following variables: subj, treat, time, conc
, you can get mean profile data withlibrary(dplyr)
dat_mean <- dat_ind %>%
group_by(treat, time) %>%
summarise(conc = mean(conc))
Obviously,
time
here should be the planned nominal time, not the actual sampling time. With ggplot you can have more or less what you asked for:library(ggplot2)
p1 <- ggplot(data = dat_ind, aes(x = time, y = conc, color = treat)) +
geom_point(aes(group = interaction(treat, time)), alpha = 0.5, shape = 1,
position = position_jitter(width = 0.1, height = 0)) +
geom_boxplot(aes(fill = treat, group = interaction(treat, time)), alpha = 0.3) +
geom_line(data = dat_mean, size = 1.3)
The main idea is the
group = interaction(treat, time)
. Feel free to modify the rest to better suit your needs (size/shape of the points etc). position_jitter()
helps to avoid point overlapping (you have to specify height = 0
otherwise the data points will not reflect the true concentration value since some randomness will be introduced along y-axis by default) and the last line will add mean profiles with slightly bold lines.—
All the best,
Shuanghe
All the best,
Shuanghe
Complete thread:
- Graphing Mean PK profile roman_max 2019-04-23 16:01 [🇷 for BE/BA]
- Graphing Mean PK profileShuanghe 2019-04-23 18:31
- Graphing Mean PK profile roman_max 2019-04-24 12:29
- Graphing Mean PK profile Helmut 2019-04-23 22:23
- Graphing Mean PK profile nobody 2019-04-24 11:23
- Graphing Mean PK profile Helmut 2019-04-24 11:49
- Graphing Mean PK profile nobody 2019-04-24 11:53
- Graphing Mean PK profile Helmut 2019-04-24 12:32
- Graphing Mean PK profile nobody 2019-04-24 12:49
- Graphing Mean PK profile Helmut 2019-04-24 12:32
- Graphing Mean PK profile nobody 2019-04-24 11:53
- Graphing Mean PK profile Helmut 2019-04-24 11:49
- Graphing Mean PK profile roman_max 2019-04-24 12:36
- Graphing Mean PK profile Helmut 2019-04-24 13:50
- Graphing Mean PK profile nobody 2019-04-24 14:15
- Graphing Mean PK profile Helmut 2019-04-24 14:41
- Pasta Ohlbe 2019-04-25 12:47
- Pasta nobody 2019-04-25 14:36
- Spaghetti Viennese Helmut 2019-04-25 14:39
- Spaghetti Viennese nobody 2019-04-25 15:08
- OT: Blume/Mutschler Helmut 2019-04-25 15:32
- OT: Blume/Mutschler nobody 2019-04-25 15:43
- OT: Blume/Mutschler Helmut 2019-04-25 15:32
- Spaghetti Viennese nobody 2019-04-25 15:08
- Pasta Ohlbe 2019-04-25 12:47
- Graphing Mean PK profile Helmut 2019-04-24 14:41
- Graphing Mean PK profile nobody 2019-04-24 14:15
- Graphing Mean PK profile Helmut 2019-04-24 13:50
- A lie is a lie is a lie ... d_labes 2019-04-25 19:59
- Graphing Mean PK profile nobody 2019-04-24 11:23
- Graphing Mean PK profileShuanghe 2019-04-23 18:31