[R] some pairs() questions

Pieter Provoost pieterprovoost at gmail.com
Thu May 5 23:00:29 CEST 2005


I'm really sorry, I didn't notice the existing labels argument in the
script. I will have another try with the highlighting. This is the complete
code:

setwd("c:/data/marelac/thesis/r/")
read.table("bay1.bay",header=T)->Rdata
names(Rdata)
Rdata[-1] -> Rdata
Rdata[1:7] -> Rdata
panel.hist <- function(x, ...)
      {
          usr <- par("usr"); on.exit(par(usr))
          par(usr = c(usr[1:2], 0, 1.5) )
          h <- hist(x, plot = FALSE)
          breaks <- h$breaks; nB <- length(breaks)
          y <- h$counts; y <- y/max(y)
          rect(breaks[-nB], 0, breaks[-1], y, col="cyan", ...)
      }
pairs(Rdata,pch='.',diag.panel=panel.hist,labels=names(Rdata),gap=0,xaxt="n"
,yaxt="n",upper.panel=NULL)

The datafile looks like this:

Run    PAR_DECAYRATECHLPHY    PAR_DECAYRATECHLCLD ...
1    0.200000E-002    0.500000E-001 ...
2    0.222888E-002    0.477971E-001 ...
...

In total there are 14 columns and 4000 records. These are all model runs. I
now want to to highlight the run with the lowest model cost in all the plots
(modelcost is the last column of the datafile). I'm absolutely new to R, but
it looks like I'll need to have a look at panels (whatever they may be).

Thanks again for your assistance,
Pieter

----- Original Message -----
From: "Berton Gunter" <gunter.berton at gene.com>
To: "'Pieter Provoost'" <pieterprovoost at gmail.com>;
<r-help at stat.math.ethz.ch>
Sent: Thursday, May 05, 2005 8:34 PM
Subject: RE: [R] some pairs() questions


>
> If you want variable names, why do you have labels = NULL in your call??
>
> Your highlighting criterion is not clear. If you want to choose one
variable
> and highlight points in all plots for which the value of that variable
meets
> your criterion, then determine the indices (outside of pairs) for which
this
> is true and write a panel function via points() to highlight. If you want
to
> highlight points in individual plots according to the variables in the
> panel, then write a panel function via points()to do this. e.g.
> points(x,y,..., col=ifelse(x<2,'red','blue'))
>
> -- Bert Gunter
> Genentech Non-Clinical Statistics
> South San Francisco, CA
>
> "The business of the statistician is to catalyze the scientific learning
> process."  - George E. P. Box
>
>
>
> > -----Original Message-----
> > From: r-help-bounces at stat.math.ethz.ch
> > [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Pieter Provoost
> > Sent: Thursday, May 05, 2005 11:07 AM
> > To: r-help at stat.math.ethz.ch
> > Subject: Re: [R] some pairs() questions
> >
> > I'm sure it's possible to display the variable names by making a small
> > change to the code. Someone did this last week but I can't
> > contact this
> > person now to ask how. I tried this
> >
> > vars <- names(Rdata)
> > pairs(Rdata, labels=vars,...)
> >
> > but that doesn't work (formal argument "labels" matched by
> > multiple actual
> > arguments). Unfortunately I don't have the time right now to
> > get to know new
> > packages and write new scripts...
> >
> > Thanks
> > Pieter
> >
> > ----- Original Message -----
> > From: "Berton Gunter" <gunter.berton at gene.com>
> > To: "'Pieter Provoost'" <pieterprovoost at gmail.com>;
> > <r-help at stat.math.ethz.ch>
> > Sent: Thursday, May 05, 2005 6:40 PM
> > Subject: RE: [R] some pairs() questions
> >
> >
> > > (Lazy answer, not checking your code in detail)
> > >
> > > Try using splom() in the lattice package, as it gives more extensive
> > control
> > > to do the sorts of things you seem to want.
> > >
> > > -- Bert Gunter
> > > Genentech Non-Clinical Statistics
> > > South San Francisco, CA
> > >
> > > "The business of the statistician is to catalyze the
> > scientific learning
> > > process."  - George E. P. Box
> > >
> > >
> > >
> > > > -----Original Message-----
> > > > From: r-help-bounces at stat.math.ethz.ch
> > > > [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of
> > Pieter Provoost
> > > > Sent: Thursday, May 05, 2005 8:43 AM
> > > > To: r-help at stat.math.ethz.ch
> > > > Subject: [R] some pairs() questions
> > > >
> > > > I have a few problems with pairs(). I want to add the
> > > > variables names to the
> > > > plot, but I don't know how. I tried different things with
> > the labels
> > > > argument but nothing worked out. This is the code:
> > > >
> > > > read.table("bay1.bay",header=T)->Rdata
> > > > (histogram part skipped)
> > > > pairs(Rdata,
> > > > pch='.',diag.panel=panel.hist,labels=NULL,gap=0,xaxt="n",yaxt=
> > > "n",upper.pane
> > > > l=NULL)
> > > >
> > > > The other problem is that I want to "highlight" one or more
> > > > of the records
> > > > of Rdata (give it another symbol and another color). What's
> > > > the easiest way
> > > > to do this? The record to be highlighted should be selected
> > > > based on the
> > > > value of one of the variables (smaller than 2.8 is this case).
> > > >
> > > > Many thanks in advance,
> > > > Pieter Provoost
> > > >
> >
> > ______________________________________________
> > R-help at stat.math.ethz.ch mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide!
> > http://www.R-project.org/posting-guide.html
> >
>
>




More information about the R-help mailing list