[R] Time vs Concentration Graphs by ID

Anh Nguyen eatabanana at gmail.com
Fri Oct 15 09:46:57 CEST 2010


Hello Dennis,

That's a very good suggestion. I've attached a template here as a .png file,
I hope you can view it. This is what I've managed to achieve in S-Plus (we
use S-Plus at work but I also use R because there's some very good R
packages for PK data that I want to take advantage of that is not available
in S-Plus). The only problem with this is, unfortunately, I cannot figure
out how make the scale non-uniform and I hope to fix that. My data looks
like this:

ID        Dose         Time         Conc          Pred ...
1         5               0              0                0
1         5               0.5           6                8
1         5               1             16               20
...
1         7               0              0                0
1         7               0.5          10               12
1         7               1             20               19
...
1        10              3             60               55
...
2        5                12           4                 2
...
ect


I don't care if it's ggplot or something else as long as it looks like how I
envisioned.




On Fri, Oct 15, 2010 at 12:22 AM, Dennis Murphy <djmuser at gmail.com> wrote:

> I don't recall that you submitted a reproducible example to use as a
> template for assistance. Ista was kind enough to offer a potential solution,
> but it was an abstraction based on the limited information provided in your
> previous mail. If you need help, please provide an example data set that
> illustrates the problems you're encountering and what you hope to achieve -
> your chances of a successful resolution will be much higher when you do.
> BTW, there's a dedicated newsgroup for ggplot2:
> look for the mailing list link at  http://had.co.nz/ggplot2/
>
> HTH,
> Dennis
>
>
> On Thu, Oct 14, 2010 at 10:02 PM, Anh Nguyen <eatabanana at gmail.com> wrote:
>
>> I found 2 problems with this method:
>>
>> - There is only one line for predicted dose at 5 mg.
>> - The different doses are 5, 7, and 10 mg but somehow there is a legend
>> for
>> 5,6,7,8,9,10.
>> - Is there a way to make the line smooth?
>> - The plots are also getting a little crowded and I was wondering if there
>> a
>> way to split it into 2 or more pages?
>>
>> Thanks for your help.
>>
>> On Thu, Oct 14, 2010 at 8:09 PM, Ista Zahn <izahn at psych.rochester.edu
>> >wrote:
>>
>> > Hi,
>> > Assuming the data is in a data.frame named "D", something like
>> >
>> > library(ggplot2) # May need install.packages("ggplot2") first
>> > ggplot(D, aes(x=Time, y=Concentration, color=Dose) +
>> > geom_point() +
>> > geom_line(aes(y = PredictedConcentration, group=1)) +
>> > facet_wrap(~ID, scales="free", ncol=3)
>> >
>> > should do it.
>> >
>> > -Ista
>> > On Thu, Oct 14, 2010 at 10:25 PM, thaliagoo <eatabanana at gmail.com>
>> wrote:
>> > >
>> > > Hello-- I have a data for small population who took 1 drug at 3
>> different
>> > > doses. I have the actual drug concentrations as well as predicted
>> > > concentrations by my model. This is what I'm looking for:
>> > >
>> > > - Time vs Concentration by ID (individual plots), with each subject
>> > > occupying 1 plot -- there is to be 9 plots per page (3x3)
>> > > - Observed drug concentration is made up of points, and predicted drug
>> > > concentration is a curve without points. Points and curve will be the
>> > same
>> > > color for each dose. Different doses will have different colors.
>> > > - A legend to specify which color correlates to which dose.
>> > > - Axes should be different for each individual (as some individual
>> will
>> > have
>> > > much higher drug concentration than others) and I want to see in
>> detail
>> > how
>> > > well predicted data fits observed data.
>> > >
>> > > Any help would be greatly appreciated.
>> > > --
>> > > View this message in context:
>> >
>> http://r.789695.n4.nabble.com/Time-vs-Concentration-Graphs-by-ID-tp2996431p2996431.html
>> > > Sent from the R help mailing list archive at Nabble.com.
>> > >
>> > > ______________________________________________
>> > > R-help at r-project.org mailing list
>> > > https://stat.ethz.ch/mailman/listinfo/r-help
>> > > PLEASE do read the posting guide
>> > http://www.R-project.org/posting-guide.html
>> > > and provide commented, minimal, self-contained, reproducible code.
>> > >
>> >
>> >
>> >
>> > --
>> > Ista Zahn
>> > Graduate student
>> > University of Rochester
>> > Department of Clinical and Social Psychology
>> > http://yourpsyche.org
>> >
>>
>>        [[alternative HTML version deleted]]
>>
>>
>> ______________________________________________
>> R-help at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ex.png
Type: image/png
Size: 28484 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20101015/2de87c5b/attachment.png>


More information about the R-help mailing list