[R] Plotting Data Frame

Petr Pikal petr.pikal at precheza.cz
Thu Apr 27 12:34:19 CEST 2006


Hi


On 27 Apr 2006 at 12:19, Ana Florencia Silbering wrote:

From:           	"Ana Florencia Silbering" <anafs at zedat.fu-berlin.de>
To:             	<r-help at stat.math.ethz.ch>
Date sent:      	Thu, 27 Apr 2006 12:19:51 +0200
Subject:        	[R] Plotting Data Frame

> Dear R community members,
> I think I am asking a very simple question, but I really looked up in
> the faqs and manuals and found nothing helpful. I am trying to plot a
> data frame with the following structure (this is just a small
> extract):
> 
>  glo conc odor line series     X1     X2     X3       X4        X5 X6 
>     X7      X8      X9       X10     X11    X12    X13
>    1    0  AIR  LN1     UP -0.488 -0.242 -0.143  0.008  0.142  0.075
> -0.031 -0.077  0.095 -0.345 -0.187  0.201  0.524
>     2    0  AIR  LN1     UP  0.482  0.209  0.448  0.338  0.295  0.140
> 0.157 -0.043 -0.341 -0.601 -0.517 -0.335  0.070
>     5    0  AIR  LN1     UP -0.294  0.214  0.409  0.048  0.198 -0.081
> 0.001 -0.005 -0.136 -0.572 -0.286  0.021 -0.042
>     7    0  AIR  LN1     UP -0.488 -0.203  0.104 -0.123  0.112 -0.140
> 0.049 -0.016 -0.080 -0.130  0.105  0.272  0.882
>     1    0  AIR  LN2     UP -0.643 -0.038 -0.201 -0.089  0.113 -0.055
> 0.013  0.012 -0.064 -0.063  0.123  0.002 -0.099
>     2    0  AIR  LN2     UP -0.510  0.364  0.619  0.565  0.634  0.167
> 0.209 -0.300 -0.615 -0.528 -0.400 -0.623 -0.312
>     5    0  AIR  LN2     UP  0.350  0.737  0.183  0.563  0.406  0.169
> -0.155 -0.189  0.036  0.051  0.297  0.014 -0.380
>     7    0  AIR  LN2     UP -0.450 -0.234 -0.526 -0.587 -0.068 -0.187
> 0.124  0.070  0.141  0.159  0.356  0.505  0.648
> 
> Where the first 5 columns (glo, conc, odor, line, series) are
> different categorizing factors and the rest are values of a variable
> over time. I would like to plot the values of the independent variable
> over time with one line for each of the groups defined by the
> categorical factors. I have tried something like extracting the time
> series for a particular group with, for example data[1,6:18] and
> plotting  that against a vector time=c(1:13), but that does not work.

Did you want

matplot(time,data[,6:18])

or maybe combination plot and lines
or maybe xyplot from lattice package.

HTH
Petr



> Is there any way of making such a plot or should I rearrange the data
> so that time is also a factor specified by a column?
> 
> Thank you very much in advance.
> Ana
> ---------------------------------------------------
> Ana Florencia Silbering
> Departament of Biology - Universität Konstanz
> Universitätsstraße 10 - M11
> D-78457 Konstanz
> Germany
> 
> Tel.: (+49 7531) 88 - 4642
> Fax: (+49 7531) 88 - 3894
> email: anafs at zedat.fu-berlin.de
> ---------------------------------------------------
> 
> 
>  [[alternative HTML version deleted]]
> 
> 

Petr Pikal
petr.pikal at precheza.cz




More information about the R-help mailing list