[R] Adding a table to a plot

John Kane jrkrideau at yahoo.ca
Sat Jan 19 00:05:24 CET 2008


Here is the brute force method.  It would probably not
be very difficult to turn in into a function. In fact
I am pretty sure that someone has but I cannot find
what package it is in.

x <- "Time   SD   Mean
   1    2.5   30
   2    a.3   40"
xx <- read.table(textConnection(x), header=TRUE,
as.is=TRUE); xx

plot(1:10, type="n" )
text(c(1.2, 2, 3), 8, labels=names(xx), cex=.7)
arrows(.75,7.75, 3.5, 7.75, length=0)
text(c(1.2, 2, 3), 7.5, labels=xx[1,], cex=.7)
text(c(1.2, 2, 3), 7.0, labels=xx[2,], cex=.7)
arrows(.75, 6.75,3.5, 6.75, length=0)

--- Judith Flores <juryef at yahoo.com> wrote:

> Hi R-experts,
>    Is it possible to add a table (text and lines) to
> the plot area?
> I have a data frame that looks something like this:
> >mydata
>  Time   SD   Mean
>    1    2.5   30
>    2    a.3   40
>     I am using R 2.6.1, in Windows.
> 
> Thank you,
> 
> Judith Flores



More information about the R-help mailing list