[R] plotting matrix

stephen sefick ssefick at gmail.com
Thu Oct 23 02:56:20 CEST 2008


#this does what I want is there a better way to do this
a <- c(1:26)
b <- rnorm(26)
e <- rnorm(26)
f <- rnorm(26)
g <- data.frame(a,b,e,f)

for(i in 1:3){
plot(g[,i]~g[,"a"], ylab=colnames(g)[i])
}

On Wed, Oct 22, 2008 at 6:39 PM, stephen sefick <ssefick at gmail.com> wrote:
> #sorry lets try that agian here is data that should work
>
> a <- c(1:26)
> b <- rnorm(26)
> e <- rnorm(26)
> f <- rnorm(26)
> g <- data.frame(b,e, a,f)
>
> On Wed, Oct 22, 2008 at 6:35 PM, stephen sefick <ssefick at gmail.com> wrote:
>> a <- c(1:26)
>> b <- rnorm(25)
>> e <- rnorm(25)
>> f <- rnorm(25)
>> g <- data.frame(b,e, a,f)
>>
>> I would like to plot a agianst all possibilities and then shoot it out
>> to a pdf one graph per page.  I think it would be okay to have this as
>> a lattice plot or a ggplot with many graphs per page.  I can figure
>> all of that out I think, but I need something like
>> r <- as.matrix(g)
>> plot(.~a, data=r)
>>
>> I think I am missing something.  This is for a much larger data frame
>> with named columns and I would like the name of the column to be the
>> name on the y-axis or the main label...  On top of this I would like
>> to  add a smooth into the mix loess.
>>
>> something like this maybe
>>
>> library(ggplot2)
>> qplot(a, b, data=g)+geom_smooth()
>>
>> but with the previous stipulations
>>
>> thanks for all of your help - I looked at the mail archives and tried
>> plotmat, but this didn't seem to do whaqt I wanted.
>> thanks
>>
>> stephen
>>
>> --
>> Stephen Sefick
>> Research Scientist
>> Southeastern Natural Sciences Academy
>>
>> Let's not spend our time and resources thinking about things that are
>> so little or so large that all they really do for us is puff us up and
>> make us feel like gods.  We are mammals, and have not exhausted the
>> annoying little problems of being mammals.
>>
>>                                                                -K. Mullis
>>
>
>
>
> --
> Stephen Sefick
> Research Scientist
> Southeastern Natural Sciences Academy
>
> Let's not spend our time and resources thinking about things that are
> so little or so large that all they really do for us is puff us up and
> make us feel like gods.  We are mammals, and have not exhausted the
> annoying little problems of being mammals.
>
>                                                                -K. Mullis
>



-- 
Stephen Sefick
Research Scientist
Southeastern Natural Sciences Academy

Let's not spend our time and resources thinking about things that are
so little or so large that all they really do for us is puff us up and
make us feel like gods.  We are mammals, and have not exhausted the
annoying little problems of being mammals.

								-K. Mullis



More information about the R-help mailing list