Jose Narillos de Santos
2009-Jul-29 11:10 UTC
[R] Add a line in a Pairs2 and mark the axis length
Hi,
I have finally installed TeachingDemos trough zip file and installed on
lbrary.
One new question:
I want to draw a line (like abline) on diagonal or the result of running a
ols.
How can I do it.
On the other hand, I want to mark the length on each sub plot y axis.
It is possible?
My function is
sca<-function(){
z2<-read.table("Ase.txt",header=T)
z3<-read.table("Ase2.txt",header=T)
pairs2(z2,z3)
}
Ase.txt cointains
3653 4617 4177 3907 3975 3651 3031 2912 3018
Ase2.txt contains
ant g t
219390 8740 17220
301510 8530 17550
316970 8640 17650
364220 9360 21420
387390 9960 23410
430180 11040 25820
499930 12240 27620
595010 13800 31670
661870 14760 37170
2009/7/28, Petr PIKAL <petr.pikal@precheza.cz>:>
> r-help-bounces@r-project.org napsal dne 28.07.2009 15:39:03:
>
> >
> > Have you installed it first?
> > First:
> > install.packages("TeachingDemos")
>
> Or if you have problems with correct setting through corporate network
> rules (like myself) you can download a zip (for Windows) version and unzip
> it to library subdirectory.
>
> > Then:
> > library(TeachingDemos)
>
> shall be executed without problem
>
> Regards
> Petr
>
>
> >
> >
> > --- On Tue, 7/28/09, Jose Narillos de Santos
> <narillosdesantos@gmail.com> wrote:
> >
> > > From: Jose Narillos de Santos <narillosdesantos@gmail.com>
> > > Subject: Re: [R] pairs plot
> > > To: "Petr PIKAL" <petr.pikal@precheza.cz>,
r-help@r-project.org,
> Greg.Snow@imail.org
> > > Received: Tuesday, July 28, 2009, 8:24 AM
> > > Hi,
> > >
> > > I tried to load typing library(TeachingDemos)
> > >
> > > But the message "can´t find package TeachingDemos) occurs.
> > > I use versión
> > > R 2.9 on windows.
> > >
> > > Can you please guide me?
> > >
> > > Sorry¡¡¡
> > >
> > >
> > >
> > >
> > >
> > > 2009/7/28, Petr PIKAL <petr.pikal@precheza.cz>:
> > > >
> > > > Hi
> > > >
> > > > r-help-bounces@r-project.org
> > > napsal dne 28.07.2009 09:55:11:
> > > >
> > > > > Hi Greg I saw, read, the TeachingDemos you
> > > suggesttef but when run
> > > > pairs2
> > > > > function on my R module says "Can´t find
> > > function pairs2"
> > > > >
> > > > > How can I load the module or function pairs2?
> > > >
> > > > Did you do
> > > >
> > > > library(TeachingDemos)?
> > > >
> > > > Regards
> > > > Petr
> > > >
> > > >
> > > > >
> > > > > Thanks in advance for your help.
> > > > >
> > > > > You are the best.
> > > > >
> > > > > 2009/7/27, Greg Snow <Greg.Snow@imail.org>:
> > > > > >
> > > > > > Look at the pairs2 function in the
> > > TeachingDemos package.
> > > > > >
> > > > > > --
> > > > > > Gregory (Greg) L. Snow Ph.D.
> > > > > > Statistical Data Center
> > > > > > Intermountain Healthcare
> > > > > > greg.snow@imail.org
> > > > > > 801.408.8111
> > > > > >
> > > > > >
> > > > > > > -----Original Message-----
> > > > > > > From: r-help-bounces@r-project.org
> > > [mailto:r-help-bounces@r-
> > > > > > > project.org] On Behalf Of Jose Narillos
> > > de Santos
> > > > > > > Sent: Monday, July 27, 2009 9:02 AM
> > > > > > > To: r-help@r-project.org
> > > > > > > Subject: [R] pairs plot
> > > > > > >
> > > > > > > Hi all,
> > > > > > >
> > > > > > > I want to plot trough pairs() plot a
> > > matrix with 4 columns. I want
> > > > to
> > > > > > > make a
> > > > > > > trhee plot in a graph. Plotting pairs
> > > colum 2,3,4 on y axis and 1 on
> > > > X
> > > > > > > axis.
> > > > > > >
> > > > > > > You mean (a plot with three graphs)
> > > ommitting the first pair with
> > > > > > > itself.
> > > > > > > And only the pairs with colum 1 with
> > > the other not all pairs.
> > > > > > >
> > > > > > > I. e. this matrix
> > > > > > >
> > > > > > > 4177 289390 8740 17220
> > > > > > > 3907 301510 8530 17550
> > > > > > > 3975 316970 8640 17650
> > > > > > > 3651 364220 9360 21420
> > > > > > > 3031 387390 9960 23410
> > > > > > > 2912 430180 11040 25820
> > > > > > > 3018 499930 12240 27620
> > > > > > > 2685 595010 13800 31670
> > > > > > > 2884 661870 14760 37170
> > > > > > >
> > > > > > > Thanks in advance.
> > > > > > >
> > > > > > >
> > > [[alternative HTML version deleted]]
> > > > > > >
> > > > > > >
> > > ______________________________________________
> > > > > > > R-help@r-project.org
> > > mailing list
> > > > > > > https://stat.ethz.ch/mailman/listinfo/r-help
> > > > > > > PLEASE do read the posting guide
> http://www.R-project.org/posting- <http://www.r-project.org/posting->
> > > > > > > guide.html
> > > > > > > and provide commented, minimal,
> > > self-contained, reproducible code.
> > > > > >
> > > > >
> > > > > [[alternative HTML version
> > > deleted]]
> > > > >
> > > > > ______________________________________________
> > > > > R-help@r-project.org
> > > mailing list
> > > > > https://stat.ethz.ch/mailman/listinfo/r-help
> > > > > PLEASE do read the posting guide
> > > >
http://www.R-project.org/posting-guide.html<http://www.r-project.org/posting-guide.html>
> > > > > and provide commented, minimal, self-contained,
> > > reproducible code.
> > > >
> > > >
> > >
> > > [[alternative HTML version deleted]]
> > >
> > >
> > > -----Inline Attachment Follows-----
> > >
> > > ______________________________________________
> > > R-help@r-project.org
> > > mailing list
> > > https://stat.ethz.ch/mailman/listinfo/r-help
> > > PLEASE do read the posting guide
>
http://www.R-project.org/posting-guide.html<http://www.r-project.org/posting-guide.html>
> > > and provide commented, minimal, self-contained,
> > > reproducible code.
> > >
> >
> >
> >
__________________________________________________________________
> > Yahoo! Canada Toolbar: Search from anywhere on the web, and bookmark
> your
> > favourite sites. Download it now
> > http://ca.toolbar.yahoo.com.
> >
> > ______________________________________________
> > R-help@r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide
>
http://www.R-project.org/posting-guide.html<http://www.r-project.org/posting-guide.html>
> > and provide commented, minimal, self-contained, reproducible code.
>
>
[[alternative HTML version deleted]]
I am not sure what you mean by "mark the length on each sub plot y
axis", but here is an example of the other parts (and if you know how to
mark the length on a single regular plot, then just add that code to the panel
function):
pairs2( iris[,1], iris[,2:4], panel=function(x,y,...) {
points(x,y,...)
abline(0,1, col='blue')
abline(lm(y~x), col='green')
} )
Hope this helps,
--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow@imail.org
801.408.8111
From: Jose Narillos de Santos [mailto:narillosdesantos@gmail.com]
Sent: Wednesday, July 29, 2009 5:10 AM
To: petr.pikal@precheza.cz; Greg Snow; r-help@r-project.org
Subject: Add a line in a Pairs2 and mark the axis length
Hi,
I have finally installed TeachingDemos trough zip file and installed on lbrary.
One new question:
I want to draw a line (like abline) on diagonal or the result of running a ols.
How can I do it.
On the other hand, I want to mark the length on each sub plot y axis.
It is possible?
My function is
sca<-function(){
z2<-read.table("Ase.txt",header=T)
z3<-read.table("Ase2.txt",header=T)
pairs2(z2,z3)
}
Ase.txt cointains
3653
4617
4177
3907
3975
3651
3031
2912
3018
Ase2.txt contains
ant g t
219390 8740 17220
301510 8530 17550
316970 8640 17650
364220 9360 21420
387390 9960 23410
430180 11040 25820
499930 12240 27620
595010 13800 31670
661870 14760 37170
2009/7/28, Petr PIKAL
<petr.pikal@precheza.cz<mailto:petr.pikal@precheza.cz>>:
r-help-bounces@r-project.org<mailto:r-help-bounces@r-project.org> napsal
dne 28.07.2009 15:39:03:
>
> Have you installed it first?
> First:
> install.packages("TeachingDemos")
Or if you have problems with correct setting through corporate network
rules (like myself) you can download a zip (for Windows) version and unzip
it to library subdirectory.
> Then:
> library(TeachingDemos)
shall be executed without problem
Regards
Petr
>
>
> --- On Tue, 7/28/09, Jose Narillos de Santos
<narillosdesantos@gmail.com<mailto:narillosdesantos@gmail.com>>
wrote:>
> > From: Jose Narillos de Santos
<narillosdesantos@gmail.com<mailto:narillosdesantos@gmail.com>>
> > Subject: Re: [R] pairs plot
> > To: "Petr PIKAL"
<petr.pikal@precheza.cz<mailto:petr.pikal@precheza.cz>>,
r-help@r-project.org<mailto:r-help@r-project.org>,
Greg.Snow@imail.org<mailto:Greg.Snow@imail.org>> > Received: Tuesday, July 28, 2009, 8:24 AM
> > Hi,
> >
> > I tried to load typing library(TeachingDemos)
> >
> > But the message "can´t find package TeachingDemos) occurs.
> > I use versión
> > R 2.9 on windows.
> >
> > Can you please guide me?
> >
> > Sorry¡¡¡
> >
> >
> >
> >
> >
> > 2009/7/28, Petr PIKAL
<petr.pikal@precheza.cz<mailto:petr.pikal@precheza.cz>>:
> > >
> > > Hi
> > >
> > >
r-help-bounces@r-project.org<mailto:r-help-bounces@r-project.org>
> > napsal dne 28.07.2009 09:55:11:
> > >
> > > > Hi Greg I saw, read, the TeachingDemos you
> > suggesttef but when run
> > > pairs2
> > > > function on my R module says "Can´t find
> > function pairs2"
> > > >
> > > > How can I load the module or function pairs2?
> > >
> > > Did you do
> > >
> > > library(TeachingDemos)?
> > >
> > > Regards
> > > Petr
> > >
> > >
> > > >
> > > > Thanks in advance for your help.
> > > >
> > > > You are the best.
> > > >
> > > > 2009/7/27, Greg Snow
<Greg.Snow@imail.org<mailto:Greg.Snow@imail.org>>:
> > > > >
> > > > > Look at the pairs2 function in the
> > TeachingDemos package.
> > > > >
> > > > > --
> > > > > Gregory (Greg) L. Snow Ph.D.
> > > > > Statistical Data Center
> > > > > Intermountain Healthcare
> > > > > greg.snow@imail.org<mailto:greg.snow@imail.org>
> > > > > 801.408.8111
> > > > >
> > > > >
> > > > > > -----Original Message-----
> > > > > > From:
r-help-bounces@r-project.org<mailto:r-help-bounces@r-project.org>
> > [mailto:r-help-bounces@r-<mailto:r-help-bounces@r->
> > > > > > project.org<http://project.org/>] On Behalf
Of Jose Narillos
> > de Santos
> > > > > > Sent: Monday, July 27, 2009 9:02 AM
> > > > > > To:
r-help@r-project.org<mailto:r-help@r-project.org>
> > > > > > Subject: [R] pairs plot
> > > > > >
> > > > > > Hi all,
> > > > > >
> > > > > > I want to plot trough pairs() plot a
> > matrix with 4 columns. I want
> > > to
> > > > > > make a
> > > > > > trhee plot in a graph. Plotting pairs
> > colum 2,3,4 on y axis and 1 on
> > > X
> > > > > > axis.
> > > > > >
> > > > > > You mean (a plot with three graphs)
> > ommitting the first pair with
> > > > > > itself.
> > > > > > And only the pairs with colum 1 with
> > the other not all pairs.
> > > > > >
> > > > > > I. e. this matrix
> > > > > >
> > > > > > 4177 289390 8740 17220
> > > > > > 3907 301510 8530 17550
> > > > > > 3975 316970 8640 17650
> > > > > > 3651 364220 9360 21420
> > > > > > 3031 387390 9960 23410
> > > > > > 2912 430180 11040 25820
> > > > > > 3018 499930 12240 27620
> > > > > > 2685 595010 13800 31670
> > > > > > 2884 661870 14760 37170
> > > > > >
> > > > > > Thanks in advance.
> > > > > >
> > > > > >
> > [[alternative HTML version deleted]]
> > > > > >
> > > > > >
> > ______________________________________________
> > > > > >
R-help@r-project.org<mailto:R-help@r-project.org>
> > mailing list
> > > > > > https://stat.ethz.ch/mailman/listinfo/r-help
> > > > > > PLEASE do read the posting guide
http://www.R-project.org/posting-<http://www.r-project.org/posting->> > > > > > guide.html
> > > > > > and provide commented, minimal,
> > self-contained, reproducible code.
> > > > >
> > > >
> > > > [[alternative HTML version
> > deleted]]
> > > >
> > > > ______________________________________________
> > > > R-help@r-project.org<mailto:R-help@r-project.org>
> > mailing list
> > > > https://stat.ethz.ch/mailman/listinfo/r-help
> > > > PLEASE do read the posting guide
> > >
http://www.R-project.org/posting-guide.html<http://www.r-project.org/posting-guide.html>
> > > > and provide commented, minimal, self-contained,
> > reproducible code.
> > >
> > >
> >
> > [[alternative HTML version deleted]]
> >
> >
> > -----Inline Attachment Follows-----
> >
> > ______________________________________________
> > R-help@r-project.org<mailto:R-help@r-project.org>
> > mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html<http://www.r-project.org/posting-guide.html>> > and provide commented, minimal, self-contained,
> > reproducible code.
> >
>
>
> __________________________________________________________________
> Yahoo! Canada Toolbar: Search from anywhere on the web, and bookmark
your> favourite sites. Download it now
> http://ca.toolbar.yahoo.com<http://ca.toolbar.yahoo.com/>.
>
> ______________________________________________
> R-help@r-project.org<mailto:R-help@r-project.org> mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html<http://www.r-project.org/posting-guide.html>> and provide commented, minimal, self-contained, reproducible code.
[[alternative HTML version deleted]]