[R] how to plot a list in graphs

Deepayan Sarkar deepayan.sarkar at gmail.com
Tue Nov 22 01:05:57 CET 2005


On 11/21/05, peter eric <eric_wzl at yahoo.com> wrote:
>
> Really your (Mr.deepayan´s)answer is what I expected..thanks a lot...and I
> like to ask you one more thing..
>   Is it possible to do boolean operations in this matrix and plot that also
> in graphs?
>
>   for example
>   1.  a[anja,maya]   Vs   a[vincent,selva]
>   means things common between the rows anja&maya  and columns vincent &
> selva

You mean

levelplot(a[c("anja", "maya"), c("vincent", "selva")])

? This is standard matrix indexing in R.

>   2.a[anja,maya]   Vs   a[peter,david]
>   and so on...
>
>   So in that case whether it is possible to plot in the same graph(since I´m
> doing different...more than one.. comparisions) or I´ve to plot in a
> multiple graph..

It depends on what you want to do. If the different comparisons are
based on some systematic rule then levelplot may take you further.

[Note that for this you may need to work with a data.frame instead of
a matrix. E.g.,

mat2df <- function(x) {
    rx <- row(x)
    cx <- col(x)
    data.frame(row = rownames(x)[rx],
               column = colnames(x)[cx],
               z = as.vector(x))
}

b <- mat2df(a)

b is now a data frame:

> b
      row  column  z
1  julius   peter  3
2  caeser   peter  6
3    anja   peter  9
...

]




More information about the R-help mailing list