Re: [R] 2d plotting and colours

2005-03-29 Thread Uwe Ligges
TEMPL Matthias wrote:
Hi!
There are more than 8 colors.
Yes, e.g. for rgb space there are 16777216, see ?rgb.
Uwe Ligges

x <- rbind(matrix(rnorm(100, sd = 0.3), ncol = 2),
matrix(rnorm(100, mean = 1, sd = 0.3), ncol = 2))
 
(cl <- kmeans(x, i, 20))

s <- c("tomato4", "turquoise", "slateblue", "wheat", "snow", "skyblue",
"peru", "pink")
# see at:
colors()
 
plot(x, col = s)
 
points(cl$centers, col = s, pch = 8, cex=2)

Best,
Matthias


Hi!
I am new to R just 3 days in it and i apologize if my 
questions seem very 
trivial and consumed your valuable time.

I am coding in perl and i stumbled upon R regarding plotting good 
statistical graphs.

I tried the kmean clustering for a large matrix ,say > 150 * 
150 . I tried 
the example code given in the tutorial to perform 2d plot

# i ranges from 2 to 10
cl <- kmeans(x, i, 20)
plot(x, col = cl$cluster)
points(cl$centers, col = 1:i )
I see that there are only 8 colours defined , namely 
black,red,green,blue,cyan,magenta,yello,gray.

How should i set my colour preferences to obtain my palette 
of colours? I  
checked in the totorial which talks about R.colors and 
palatte , but i 
failed to understand how to set it.

Thank You
Asha
MSN Messenger!
__
R-help@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


__
R-help@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
__
R-help@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


Re: [R] 2d plotting and colours

2005-03-29 Thread TEMPL Matthias
Hi!

There are more than 8 colors.

x <- rbind(matrix(rnorm(100, sd = 0.3), ncol = 2),
matrix(rnorm(100, mean = 1, sd = 0.3), ncol = 2))
 
(cl <- kmeans(x, i, 20))

s <- c("tomato4", "turquoise", "slateblue", "wheat", "snow", "skyblue",
"peru", "pink")
# see at:
colors()
 
plot(x, col = s)
 
points(cl$centers, col = s, pch = 8, cex=2)


Best,
Matthias




> Hi!
> 
> I am new to R just 3 days in it and i apologize if my 
> questions seem very 
> trivial and consumed your valuable time.
> 
> I am coding in perl and i stumbled upon R regarding plotting good 
> statistical graphs.
> 
> I tried the kmean clustering for a large matrix ,say > 150 * 
> 150 . I tried 
> the example code given in the tutorial to perform 2d plot
> 
> # i ranges from 2 to 10
> cl <- kmeans(x, i, 20)
> plot(x, col = cl$cluster)
> points(cl$centers, col = 1:i )
> 
> I see that there are only 8 colours defined , namely 
> black,red,green,blue,cyan,magenta,yello,gray.
> 
> How should i set my colour preferences to obtain my palette 
> of colours? I  
> checked in the totorial which talks about R.colors and 
> palatte , but i 
> failed to understand how to set it.
> 
> Thank You
> 
> Asha
> 
> 
> MSN Messenger!
> 
> __
> R-help@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
>

__
R-help@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


Re: [R] how i can get input from "user input"

2005-03-29 Thread Uwe Ligges
Cuichang Zhao wrote:
Hello, 
Could you please tell me how i can get an input from the user in R?
Depends on the kind of input.
See, e.g., ?scan or ?menu
Uwe Ligges

C-Ming 
 
Mar 29, 2005


-
[[alternative HTML version deleted]]
__
R-help@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
__
R-help@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


Re: [R] dependency help for FC2 rpm

2005-03-29 Thread Yuandan Zhang
On 29 Mar 2005 22:04:51 +0200
Peter Dalgaard <[EMAIL PROTECTED]> wrote:

> Steve Sherman <[EMAIL PROTECTED]> writes:
> 
> > I am having difficulty with dependencies for the R rpm for Fedora Core 2.
> > 
> > In attempting to load R-2.0.0.0.fdr.1.fc2.i386.rpm it fails the
> > libtk8.4.so dependency even though I have this library loaded. The
> > library is located in:  /usr/local/lib.
> > 
> > How might I tell R where to find this library? I am new to Linux and
> > loading rpms so I am hoping there is a simple answer and that the
> > problem is related to my inexperience. Thanks in advance for any
> > assistance.

It is most likely the rpm looks for this lib at /usr/lib, you may create a 
symbolic link 
eg 

cd /usr/lib
ln -s /usr/local/libtk8.4.so .

of cource, you must have a root access to do this.

> 
> You need to install the RPM dependencies that it depends on. A
> libtk8.4.so in /usr/local/lib doesn't come from a standard RPM. You
> need to install the tk (and tcl) RPM from CD's or a Fedora repository.
> 
> -- 
>O__   Peter Dalgaard Blegdamsvej 3  
>   c/ /'_ --- Dept. of Biostatistics 2200 Cph. N   
>  (*) \(*) -- University of Copenhagen   Denmark  Ph: (+45) 35327918
> ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907
> 
> __
> R-help@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

__
R-help@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


[R] 2d plotting and colours

2005-03-29 Thread Asha Jayanthi
Hi!
I am new to R just 3 days in it and i apologize if my questions seem very 
trivial and consumed your valuable time.

I am coding in perl and i stumbled upon R regarding plotting good 
statistical graphs.

I tried the kmean clustering for a large matrix ,say > 150 * 150 . I tried 
the example code given in the tutorial to perform 2d plot

# i ranges from 2 to 10
cl <- kmeans(x, i, 20)
plot(x, col = cl$cluster)
points(cl$centers, col = 1:i )
I see that there are only 8 colours defined , namely 
black,red,green,blue,cyan,magenta,yello,gray.

How should i set my colour preferences to obtain my palette of colours? I  
checked in the totorial which talks about R.colors and palatte , but i 
failed to understand how to set it.

Thank You
Asha
MSN Messenger!
__
R-help@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


[R] how i can get input from "user input"

2005-03-29 Thread Cuichang Zhao
Hello, 
Could you please tell me how i can get an input from the user in R?
 
C-Ming 
 
Mar 29, 2005


-


[[alternative HTML version deleted]]

__
R-help@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


Re: [R] Base and lattice graphics on the same graphics page

2005-03-29 Thread Deepayan Sarkar
On Tuesday 29 March 2005 22:32, John Maindonald wrote:
> Although base graphics does not mix with lattice in the one graph,
> I've found that print.trellis(position=..., ) and the use of
> par(fig=...)
> to put regular and trellis graphics on the one graphics page works
> like a treat, at least in version 2.0.1 of R.  [Base graphics
> functions that are themselves inconsistent with par(fig=...) are
> obviously disallowed.]
>
> I am wondering whether there are caveats of which I and others
> should be aware, or whether there is a risk that the ongoing
> development of R's graphics abilities will render such a cohabitation
> unworkably fractious.

Paul would know better, but I think that's unlikely. In fact, the 
gridBase package allows you to do use grid (and hence lattice) 
functions to add to a base plot, as well as (I didn't realize this 
before) the other way round. The only caveat is that resizing the 
device may mess things up. 

You may have to be careful with new devices. Your example pasted on a 
fresh session (tested only on r-devel) starts a new page for the 
boxplot since it thinks that new=TRUE doesn't make sense (because 
there's no 'old' plot yet).

Deepayan

__
R-help@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


[R] Base and lattice graphics on the same graphics page

2005-03-29 Thread John Maindonald
Although base graphics does not mix with lattice in the one graph,
I've found that print.trellis(position=..., ) and the use of 
par(fig=...)
to put regular and trellis graphics on the one graphics page works
like a treat, at least in version 2.0.1 of R.  [Base graphics functions
that are themselves inconsistent with par(fig=...) are obviously
disallowed.]

I am wondering whether there are caveats of which I and others
should be aware, or whether there is a risk that the ongoing
development of R's graphics abilities will render such a cohabitation
unworkably fractious.
Example:
gph <- bwplot(voice.part ~ height, data=singer)
print(gph, position=c(0, 0.5, 1, 1)) # x0, y0, x1, y1
par(fig=c(0, 1, 0,0.5), new=TRUE) # x0, x1, y0, y1
boxplot(height ~ voice.part, data=singer, horiz=TRUE)
John Maindonald email: [EMAIL PROTECTED]
phone : +61 2 (6125)3473fax  : +61 2(6125)5549
Centre for Bioinformation Science, Room 1194,
John Dedman Mathematical Sciences Building (Building 27)
Australian National University, Canberra ACT 0200.
__
R-help@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


Re: [R] help with plotting a grid on levelplot

2005-03-29 Thread Deepayan Sarkar
On Tuesday 29 March 2005 19:16, Jeff D. Hamann wrote:
> I'm trying to plot a grid over a levelplot
>
> print( levelplot( var1.pred~x+y,
>  data=saw.pred,
>  aspect=mapasp(saw.pred),
>  col.regions=terrain.colors(80),
>  main=main) )
>
> using the data...
>
> > saw.pred
>
>   x   y var1.pred var1.var sort
> 1 5   5 3.3761200 256.3363  saw
> 215   5 3.3884142 499.5695  saw
> 325   5 3.5394769 362.5490  saw
> 435   5 3.6386983 439.3200  saw
> 545   5 3.1866799 458.5570  saw
> 655   5 2.8838555 331.2363  saw
> ..blah...blah...blah...
> 15  145   5 0.8705088 256.3363  saw
> 165  15 3.1183053 455.3765  saw
> 17   15  15 3.2780465 443.1954  saw
> 18   25  15 3.7146268 435.1166  saw
>
> which looks just fine. I know want to plot a grid such that the cells
> are grouped into 5x5 cells (or some other grid spacing) over the
> levelplot for a demonstration and I'm getting stuck when trying to
> modify my levelplot() call above to include the extra calls to
> panel.levelplot...
>
> I've gotten this far,
>
> ## plot the results (10mx10m plot that's 150m x 200m)
> main=expression( paste( widehat(V)[saw], ", in ", m^3, ha^{-1} ) )
> print( levelplot( var1.pred~x+y,
>  data=saw.pred,
>  aspect=mapasp(saw.pred),
>  main=main,
>  panel = function(x,y,z=var1.pred )
>  {
>panel.levelplot( x=x, y=y, z=z,
>subscripts=1:nrow(saw.pred),
>col.regions=terrain.colors(80),
>)
>panel.last=grid( 15, 20, lwd=2, lty="solid",
> col="black" )

You are not allowed to use base graphics functions (like grid) in 
lattice panel functions. You have to use grid (the package, not the 
function) functions. There are many such functions defined in lattice 
which can be useful, in this case 'panel.grid' or more likely 
'panel.abline'.

I'm not sure I understand your attempted usage though; you seem to 
assign the value of grid() (which would be NULL) to a variable called 
panel.last. This does not have any possible use that I can see.

>  }
>  ) )
>
> and the legend does match the same colors as the levelplot and the
> grid isn't centered on the levelplot either.
>
> Could someone give me some direction? I've stayed away from modifying
> the panel.XX args when I use lattice, and now I need help.

Unless you understand very well what you are doing, I would stay away 
from micro-managing calls to complicated panel functions like 
panel.levelplot. In particular, I would suggest something like

panel = function(...) {
  panel.levelplot(...)
  panel.abline(h=, v=)
}


> Thanks,
> Jeff.
>
> ---
> Jeff D. Hamann
> Forest Informatics, Inc.
> PO Box 1421
> Corvallis, Oregon USA 97339-1421
> 541-754-1428
> [EMAIL PROTECTED]
> www.forestinformatics.com
>
> __
> R-help@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

__
R-help@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


RE: [R] dependency help for FC2 rpm

2005-03-29 Thread ssherman
That worked great. Thank you.

>= Original Message From Peter Dalgaard <[EMAIL PROTECTED]> =
>Steve Sherman <[EMAIL PROTECTED]> writes:
>
>> I am having difficulty with dependencies for the R rpm for Fedora Core 2.
>>
>> In attempting to load R-2.0.0.0.fdr.1.fc2.i386.rpm it fails the
>> libtk8.4.so dependency even though I have this library loaded. The
>> library is located in:  /usr/local/lib.
>>
>> How might I tell R where to find this library? I am new to Linux and
>> loading rpms so I am hoping there is a simple answer and that the
>> problem is related to my inexperience. Thanks in advance for any
>> assistance.
>
>You need to install the RPM dependencies that it depends on. A
>libtk8.4.so in /usr/local/lib doesn't come from a standard RPM. You
>need to install the tk (and tcl) RPM from CD's or a Fedora repository.
>
>--
>   O__   Peter Dalgaard Blegdamsvej 3
>  c/ /'_ --- Dept. of Biostatistics 2200 Cph. N
> (*) \(*) -- University of Copenhagen   Denmark  Ph: (+45) 35327918
>~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907

__
R-help@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


Re: [R] slide show with R

2005-03-29 Thread max.marinucci
Why don't use R-Winedt package?
If you have Winedt installed on your machine, it does something similar to
what you want.
Just highlight the command you want to execute from a text command file and
then press the R-paste button.
Good luck!

M.


**
Massimiliano Marinucci
http://personales.ya.com/max_mar/
Ph.D Candidate in Economics
Fundamentos del Analisis Económico II
(Economía Cuantitativa)
Facultad de CC.EE.
Universidad Complutense Madrid
Campus de Somosaguas
Madrid - Spain
**



- Original Message - 
From: "Berton Gunter" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; "'R-Help'" 
Sent: Tuesday, March 29, 2005 11:20 PM
Subject: RE: [R] slide show with R


> Oops, I should have said that you can execute the text line via the
> construction:
>
> eval(parse(text=textline))
>
>
>
> -- 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: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED] On Behalf Of
> > [EMAIL PROTECTED]
> > Sent: Tuesday, March 29, 2005 12:54 PM
> > To: R-Help
> > Subject: [R] slide show with R
> >
> >
> >
> >
> >
> > Trying to use R to build an interactive "slide show", to be
> > displayed on a
> > projector.  The purpose of the presentation is to show how one could
> > construct a simple graph using R.  It is meant as a general
> > overview rather
> > than as detailed instruction.
> >
> > For example, something like the following sequence of commands.At
> > lecture time, I want the interpreter to read these commands
> > one at a time
> > from a file, display and execute the command, (or two or
> > three commands)
> > and then wait for another prompt.
> >
> > pale.yellow="#99"
> > par(bg=pale.yellow)
> > plot(c(0,2*pi),c(-1,1),type="n",ylab="",yaxt="n")
> > mirror<-function(t) { c(t,rev(2*max(t)-t)) }
> > z<-log(1:1000)/log(1000)
> > zz<-z*pi/2
> > zzz<-mirror(mirror(zz))
> > polygon(zzz,sin(25*zzz)*sin(zzz),border="blue")
> > polygon(zzz,sin(5*zzz)*sin(zzz),border="green")
> > polygon(zzz,sin(zzz),lwd=2)
> > points(zzz,rep(0,length(zzz)),col="red",pch="|")
> >
> >
> > Wrapping the following around each command works, sort of :
> >
> > a<-expression()
> > x<-readline(a)
> > eval(a)
> >
> > However, this doesn't work properly for the function
> > definition, and it
> > gets very clumsy to display two or three lines as a block and then
> > evaluate.
> >
> > Any help would be much appreciated.
> >
> >
> > <>=<>=<>=<>=<>=<>=<>=<>=<>=<>=<>
> > George Heine, PhD
> > Mathematical Analyst
> > National IRM Center
> > U.S. Bureau of Land Management
> > voice   (303) 236-0099
> > fax   (303) 236-1974
> > cell  (303) 905-5382
> > pager   [EMAIL PROTECTED]
> > <>=<>=<>=<>=<>=<>=<>=<>=<>=<>=<>
> >
> > __
> > R-help@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
> >
>
> __
> R-help@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
>
>

__
R-help@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


RE: [R] Aggregating data (with more than one function)

2005-03-29 Thread Liaw, Andy
> agg.dat <- do.call("rbind", by(dat$Salary, dat$Department, 
+function(x) c(mean=mean(x), total=sum(x
> agg.dat <- data.frame(dept=rownames(agg.dat), agg.dat)
> agg.dat
   dept mean  total
Finance Finance 83925.67 251777
HR   HR 6.33 19
IT   IT 59928.67 179786
Sales Sales 62481.67 187445

Andy 

> From: Robin Schroeder 
> 
> Dear list & Andy, 
> 
> I am hopelessly stumped, how would one add the department 
> names as a variable?
> 
> Robin
> 
> > Robin Tori Schroeder
> > International Institute for Sustainability 
> > P.O. Box 873211
> > Arizona State University
> > Tempe, Arizona 85287-3211
> > Phone: (480) 727-7290
> > 
> > 
> 
> 
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] Behalf Of Liaw, Andy
> Sent: Monday, March 28, 2005 6:45 PM
> To: 'Sivakumaran Raman'; r-help@stat.math.ethz.ch
> Subject: RE: [R] Aggregating data (with more than one function)
> 
> 
> Here's one possible way, using the data you supplied:
> 
> > dat <- read.table("clipboard", header=T, row=1)
> > do.call("rbind",by(dat$Salary, dat$Department, function(x) 
> c(mean=mean(x),
> total=sum(x
> mean  total
> Finance 83925.67 251777
> HR  6.33 19
> IT  59928.67 179786
> Sales   62481.67 187445
> 
> If you need the department names as a variable, you can add 
> that easily.
> 
> HTH,
> Andy
> 
> > From: Sivakumaran Raman
> > 
> > I have the data similar to the following in a data frame:
> > LastName   Department  Salary
> > 1   JohnsonIT  56000
> > 2   James  HR  54223
> > 3   Howe   Finance 8
> > 4   Jones  Finance 82000
> > 5   NorwoodIT  67000
> > 6   Benson Sales   76000
> > 7   Smith  Sales   65778
> > 8   Baker  HR  56778
> > 9   DempseyHR  78999
> > 10  Nolan  Sales   45667
> > 11  Garth  Finance 89777
> > 12  JamesonIT  56786
> > 
> > I want to calculate both the mean salary broken down by 
> > Department and 
> > also the
> > total amount paid out per department i.e. I want both 
> sum(Salary) and
> > mean(Salary) for each Department. Right now, I am using 
> > aggregate.data.frame
> > twice, creating two data frames, and then combining them 
> > using data.frame.
> > However, this seems to be very memory and processor 
> intensive and is 
> > taking a
> > very long time on my data set. Is there a quicker way to do this?
> > 
> > Thanks in advance,
> > Siv Raman
> > 
> > __
> > R-help@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
> > 
> > 
> >
> 
> __
> R-help@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
> 
> 
>

__
R-help@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


[R] help with plotting a grid on levelplot

2005-03-29 Thread Jeff D. Hamann
I'm trying to plot a grid over a levelplot
print( levelplot( var1.pred~x+y,
data=saw.pred,
aspect=mapasp(saw.pred),
col.regions=terrain.colors(80),
main=main) )
using the data...
saw.pred
 x   y var1.pred var1.var sort
1 5   5 3.3761200 256.3363  saw
215   5 3.3884142 499.5695  saw
325   5 3.5394769 362.5490  saw
435   5 3.6386983 439.3200  saw
545   5 3.1866799 458.5570  saw
655   5 2.8838555 331.2363  saw
..blah...blah...blah...
15  145   5 0.8705088 256.3363  saw
165  15 3.1183053 455.3765  saw
17   15  15 3.2780465 443.1954  saw
18   25  15 3.7146268 435.1166  saw
which looks just fine. I know want to plot a grid such that the cells are 
grouped into 5x5 cells (or some other grid spacing) over the levelplot for a 
demonstration and I'm getting stuck when trying to modify my levelplot() 
call above to include the extra calls to panel.levelplot...

I've gotten this far,
## plot the results (10mx10m plot that's 150m x 200m)
main=expression( paste( widehat(V)[saw], ", in ", m^3, ha^{-1} ) )
print( levelplot( var1.pred~x+y,
data=saw.pred,
aspect=mapasp(saw.pred),
main=main,
panel = function(x,y,z=var1.pred )
{
  panel.levelplot( x=x, y=y, z=z,
  subscripts=1:nrow(saw.pred),
  col.regions=terrain.colors(80),
  )
  panel.last=grid( 15, 20, lwd=2, lty="solid", 
col="black" )
}
) )

and the legend does match the same colors as the levelplot and the grid 
isn't centered on the levelplot either.

Could someone give me some direction? I've stayed away from modifying the 
panel.XX args when I use lattice, and now I need help.

Thanks,
Jeff.
---
Jeff D. Hamann
Forest Informatics, Inc.
PO Box 1421
Corvallis, Oregon USA 97339-1421
541-754-1428
[EMAIL PROTECTED]
www.forestinformatics.com
__
R-help@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


Re: [R] Is there a convenient function that can check if a vector is a subset of another one?

2005-03-29 Thread Pierre Kleiber
all(x %in% y) should do what you want:
> x <- 2:5
> y <- 1:10
> all(x %in% y)
[1] TRUE
> all(y %in% x)
[1] FALSE
>
Cheers, Pierre
Terry Mu wrote:
x <- 2:5
y <- 1:10
Is there something like:
is.subset(x, y) == T
Thank you,
__
R-help@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
--
-
Pierre Kleiber, Ph.D   Email: [EMAIL PROTECTED]
Fishery BiologistTel: 808 983-5399 / (hm)808 737-7544
NOAA Fisheries Service - Honolulu LaboratoryFax: 808 983-2902
2570 Dole St., Honolulu, HI 96822-2396
-
 "God could have told Moses about galaxies and mitochondria and
  all.  But behold... It was good enough for government work."
__
R-help@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


[R] discriminant function analysis in R

2005-03-29 Thread Jason Miller
Dear R Users,
I'm very very interested in learning how to use R to carry out a 
classification of data using discriminant function analysis.  I've 
found the MASS package and the lda function, but the examples in the 
help system are a bit over my head.  I'm not exactly sure how to 
interpret the output, for example, of if the inputs I've chosen are 
best suited to my needs.

I was hoping I could converse with a lister or two to help me get 
started on the road to involving R in this project.  (I'm willing to 
carry on the conversation using the R-users list, but I am wary of 
abusing the list.)  The alternative to R is for me to use SPSS.  It's 
what we've used up until now, but nobody loves it.  The undergraduates 
that I'm working with would have a much better learning experience if 
they were able to explore our multivariate with data using R.

By students and I have data sets with sixteen continuous variables, and 
DFA has been shown to do a reasonable job of classifying the origin of 
a new datum correctly.  We want to learn how to do this ourselves so 
that we can work on improving the DFA model by adding new variables or 
modifying the nature of the data sets we work with in a "natural way."

If you are willing to answer questions and can help me get to the point 
where I can use R to do some of my analysis, I'd write up what I 
learned about using the tool and make it available on my website and on 
http://mathbio.truman.edu.

So, if you can help, please shoot me a note.  Thanks in advance.
Jason

Jason E. Miller, Ph.D.
Associate Professor of Mathematics
Truman State University
Kirksville, MO
http://pyrite.truman.edu/~millerj/
660.785.7430
__
R-help@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


[R] Is there a convenient function that can check if a vector is a subset of another one?

2005-03-29 Thread Terry Mu
x <- 2:5
y <- 1:10

Is there something like:

is.subset(x, y) == T

Thank you,

__
R-help@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


Re: [R] From FAQ 7.21 to a command like apply(sapply(list(f1, f2, f3), is.na), 2, sum)

2005-03-29 Thread Thomas Lumley
On Wed, 30 Mar 2005, Heinz Tuechler wrote:
Dear all,
Last December there was a thread regarding the famous FAQ 7.21 "How can I
turn a string into a variable?" and asking what people want to do with
these strings.
My, certainly trivial application would be as follows:
Assume I have a data.frame containing besides others also the columns f1,
f2, ..., fn and I want to create a command like:
apply(sapply(list(f1,f2,f3),is.na),2,sum)
or
summary(cbind(f1,f2,f3))
Can I start from paste('f',1:3,sep='') to arrive at the abovementioned
command?
No parse,as.name or other complications needed. It's all just indexing. 
Suppose your data frame is called dd

fs<-paste('f',1:3,sep='')
apply(sapply(dd[,fs],is.na),2,sum)
summary(dd[,fs])
-thomas
__
R-help@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


Re: [R] Lattice - parallel: xlim and adding lines

2005-03-29 Thread Deepayan Sarkar
On Tuesday 29 March 2005 17:04, Sundar Dorai-Raj wrote:
> T.A.Wassenaar wrote on 3/29/2005 4:17 PM:
> > Hi Sundar,
> >
> > Thanks for the reply. And, oops, the panel.parallel.new shouldn't
> > be in there. That is a revised panel function to color according to
> > a group. As with strange, that would generally be 'not-expected',
> > i.e., in the present case, not having an x-axis running from -1 to
> > 1 for all ranges. I would at least expect to have zero in the
> > middle, 

Why???  Why on earth would [-1,1] be something you ``expect'' and [0,1] 
be something ``strange''? As far as I can see, neither are documented 
(and hence you shouldn't expect anything).

You can of course set 'xlim=c(0,1)', but the better way of doing that 
would have been 'scales=list(x = list(axs = "i")))'. Unfortunately, 
this doesn't currently work in 'parallel', which is a bug.

It's still not very clear to me what you want to.

> > but that is not so. Excuse me for not expanding 'strange' 
> > previously. I have read the guide.., some while ago.
> >
> > Thanks again,
> >
> > Tsjerk
>
> Tsjerk,
>
>  From panel.parallel, the x values are being scaled to c(0, 1)
>
> x <- (as.numeric(z[subscripts[i], , ]) - llim)/dif
>
> This puts the "Min" at x == 0 and the "Max" at x == 1 on the x-axis.
> If you want to leave it in the raw scale of the x, 

That doesn't really make sense. The whole point of a parallel plot is to 
show several variables (with different ranges) in a single plot with a 
common axis. This is done by transforming (shifting and linearly 
scaling) each variable to have a common range. As such, there's no 
'natural choice' for this common range, [0,1] is just as good as any 
other [a,b] for -Inf < a < b < Inf.

If you want to do something else, you might as well write your own 
prepanel and panel functions.

> you will have to 
> write your own panel and prepanel function, or simply determine what
> xlim = c(-1, 1) is in the scaled coordinates.
>
> E.g.
>
> lin.scale <- function(x, a = 0, b = 1, new.x = NULL) {
>slope <- (b - a)/diff(range(x))
>inter <- a - slope * min(x)
>if(is.null(new.x)) {
>  inter + slope * x
>} else {
>  inter + slope * new.x
>}
> }
> xlim <- lin.scale(range(iris[1:4]), new.x = c(-2, 10))
> parallel(~ iris[1:4] | Species, iris, xlim = xlim)
>
> The next question would be how to set the x labels to something other
> than "Min" and "Max" because (to me) they appear to be hard-coded in
> parallel. I will leave that question to Deepayan.

My bad (relic of early days). I'll fix it so that they can be overridden 
by 'scales'.

> As for adding lines, you will also have to scale your reference line
> to the panel units. For my example, each panel has a x range of c(0,
> 1) and a y range of c(1, 4). E.g.
>
> my.panel.parallel <- function(z, subscripts, col =
> superpose.line$col, lwd = superpose.line$lwd,
>lty = superpose.line$lty, ...) {
>superpose.line <- trellis.par.get("superpose.line")
>panel.abline(v = 0.5, lwd = 3)
>panel.parallel(z, subscripts, col, lwd, lty, ...)
> }
>
> HTH,
>
> --sundar
>
> > On Tue, 29 Mar 2005 14:42:05 -0600
> >
> >  Sundar Dorai-Raj <[EMAIL PROTECTED]> wrote:
> >> T.A.Wassenaar wrote on 3/29/2005 2:17 PM:
> >>> Hi,
> >>>
> >>> I'm trying to set the minimum and maximum in a parallel plot, but
> >>> trying xlim=c(-1,1) gives strange results. Am I missing
> >>> something? The call I give is:
> >>>
> >>> parallel(~X[,c(6,9,12,15,18)]|X$ff,X,panel=panel.parallel.new,gro
> >>>ups=X$protein,layout=c(3,1),xlim=c(-1,1))
> >>>
> >>>
> >>> Besides, I would like to add a reference line to the plot, but
> >>> can't find how to do that.
> >>>
> >>> I hope someone can give me a hint or two.
> >>>
> >>> Thanks in advance,
> >>>
> >>> Tsjerk
> >>
> >> Tsjerk,
> >>
> >> I don't think you'll get much help without knowing, first, what
> >> "strange" means, and second, what "panel.parallel.new" does. And
> >> you can always add a reference line by using panel.abline in your
> >> panel function.
> >>
> >> And, from the signature:
> >>
> >> PLEASE do read the posting guide!
> >> http://www.R-project.org/posting-guide.html
> >>
> >> --sundar

__
R-help@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


Re: [R] matching vectors against vectors

2005-03-29 Thread Pierre Kleiber
merge() may be just what you want.
   Cheers, Pierre
Piet van Remortel wrote:
Hi all.
I have a re-occuring typical problem that I don't know how to solve 
efficiently.

The situation is the following:   I have a number of data-sets 
(A,B,C,...) , consisting of an identifier (e.g. 11,12,13,...,20) and a 
measurement (e.g. in the range 100-120).   I want to compile a large 
table, with all availabe identifiers in all data-sets in the rows, and a 
column for every dataset.

Now, not all datasets have a measurement for every identifier, so I want 
NA if the set does not contain the identifier.

an example for a single dataset:
#all identifiers
 > rep <- c(10:20)
#Identifiers in my dataset (a subset of rep)
 > rep1 <- c(12,13,15,16,17,18)
#measurements in this dataset
 > rep1.r <- c(112,113,115,116,117,118)
#a vector which should become a column in the final table, now 
containing all NAs
 > res <- rep(NA,10)

#the IDs and values of my dataset together
 > data <- cbind(rep1, rep1.r)
data looks like this:
 rep1 rep1.r
[1,]   12112
[2,]   13113
[3,]   15115
[4,]   16116
[5,]   17117
[6,]   18118
Now, I want to put the values 112, 113, 115,... in the correct rows of 
the final table, using the identifiers as an indicator of which row to 
put it in, so that I finally obtain:

rep res
10NA
11NA
12112
13113
14NA
15115
16116
17117
18118
19NA
20NA
I try to avoid repeating 'which' a lot and filling in every identifier's 
observation etc, since I will be doing this for thousands of rows at 
once.There must be an efficient way using factors, tapply etc, but I 
have trouble finding it.  Ideal would be if this could be done in one 
go, instead of looping.

Any suggestions ?
Thanks,
Piet
__
R-help@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

--
-
Pierre Kleiber, Ph.D   Email: [EMAIL PROTECTED]
Fishery BiologistTel: 808 983-5399 / (hm)808 737-7544
NOAA Fisheries Service - Honolulu LaboratoryFax: 808 983-2902
2570 Dole St., Honolulu, HI 96822-2396
-
 "God could have told Moses about galaxies and mitochondria and
  all.  But behold... It was good enough for government work."
__
R-help@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


[R] From FAQ 7.21 to a command like apply(sapply(list(f1,f2,f3),is.na),2,sum)

2005-03-29 Thread Heinz Tuechler
Dear all,

Last December there was a thread regarding the famous FAQ 7.21 "How can I
turn a string into a variable?" and asking what people want to do with
these strings.
My, certainly trivial application would be as follows:
Assume I have a data.frame containing besides others also the columns f1,
f2, ..., fn and I want to create a command like:
apply(sapply(list(f1,f2,f3),is.na),2,sum)
or
summary(cbind(f1,f2,f3))

Can I start from paste('f',1:3,sep='') to arrive at the abovementioned
command?
I tried get, parse, as.name, eval in diverse combinations but did not reach
a solution.
More generally my question is, how can I produce a "list" of variables like
x1 to xn in a convenient way within a command.
I am quite sure that this has been answered several times, but I did not
find one of these answers. So I welcome any hint, where to look.

Heinz Tüchler

__
R-help@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


Re: [R] Lattice - parallel: xlim and adding lines

2005-03-29 Thread Sundar Dorai-Raj

T.A.Wassenaar wrote on 3/29/2005 4:17 PM:
Hi Sundar,
Thanks for the reply. And, oops, the panel.parallel.new shouldn't be in 
there. That is a revised panel function to color according to a group. 
As with strange, that would generally be 'not-expected', i.e., in the 
present case, not having an x-axis running from -1 to 1 for all ranges. 
I would at least expect to have zero in the middle, but that is not so. 
Excuse me for not expanding 'strange' previously. I have read the 
guide.., some while ago.

Thanks again,
Tsjerk
Tsjerk,
From panel.parallel, the x values are being scaled to c(0, 1)
x <- (as.numeric(z[subscripts[i], , ]) - llim)/dif
This puts the "Min" at x == 0 and the "Max" at x == 1 on the x-axis. If 
you want to leave it in the raw scale of the x, you will have to write 
your own panel and prepanel function, or simply determine what xlim = 
c(-1, 1) is in the scaled coordinates.

E.g.
lin.scale <- function(x, a = 0, b = 1, new.x = NULL) {
  slope <- (b - a)/diff(range(x))
  inter <- a - slope * min(x)
  if(is.null(new.x)) {
inter + slope * x
  } else {
inter + slope * new.x
  }
}
xlim <- lin.scale(range(iris[1:4]), new.x = c(-2, 10))
parallel(~ iris[1:4] | Species, iris, xlim = xlim)
The next question would be how to set the x labels to something other 
than "Min" and "Max" because (to me) they appear to be hard-coded in 
parallel. I will leave that question to Deepayan.

As for adding lines, you will also have to scale your reference line to 
the panel units. For my example, each panel has a x range of c(0, 1) and 
a y range of c(1, 4). E.g.

my.panel.parallel <- function(z, subscripts, col = superpose.line$col,
  lwd = superpose.line$lwd,
  lty = superpose.line$lty, ...) {
  superpose.line <- trellis.par.get("superpose.line")
  panel.abline(v = 0.5, lwd = 3)
  panel.parallel(z, subscripts, col, lwd, lty, ...)
}
HTH,
--sundar

On Tue, 29 Mar 2005 14:42:05 -0600
 Sundar Dorai-Raj <[EMAIL PROTECTED]> wrote:

T.A.Wassenaar wrote on 3/29/2005 2:17 PM:
Hi,
I'm trying to set the minimum and maximum in a parallel plot, but 
trying xlim=c(-1,1) gives strange results. Am I missing something? 
The call I give is:

parallel(~X[,c(6,9,12,15,18)]|X$ff,X,panel=panel.parallel.new,groups=X$protein,layout=c(3,1),xlim=c(-1,1)) 

Besides, I would like to add a reference line to the plot, but can't 
find how to do that.

I hope someone can give me a hint or two.
Thanks in advance,
Tsjerk
Tsjerk,
I don't think you'll get much help without knowing, first, what 
"strange" means, and second, what "panel.parallel.new" does. And you 
can always add a reference line by using panel.abline in your panel 
function.

And, from the signature:
PLEASE do read the posting guide! 
http://www.R-project.org/posting-guide.html

--sundar
__
R-help@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

__
R-help@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
__
R-help@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


Re: [R] Multi-plot figures with different numbers of plots indifferentrows

2005-03-29 Thread Earl F. Glynn
"Paul Murrell" <[EMAIL PROTECTED]> wrote in message
news:<[EMAIL PROTECTED]>...
> Does this do what you want?
>
> layout(rbind(c(1, 2, 3),
>   c(0, 4, 0)))
> plot(1:10, main="Plot 1")
> plot(1:20, main="Plot 2")
> plot(1:30, main="Plot 3")
> plot(1:40, main="Plot 4")
> # new page!
> plot(1:40, main="Plot 5")

Yes, that works nicely.  Thank you very much.

I tried this wrapped with a pdf/dev.off and it works great:

pdf("test.pdf")
  
dev.off()

I guess I should always use layout and avoid using mfrow or mfcol, since
it's more flexible in general.

I can't decide if the existing behavio(u)r of mfrow/mfcol is a "bug" or a
"feature" when some plots are to be left blank, and one wants to advance to
the next figure.  With your solution, I won't need to care .  Thanks.

efg

__
R-help@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


Re: [R] Multi-plot figures with different numbers of plots indifferent rows

2005-03-29 Thread Paul Murrell
Hi
Earl F. Glynn wrote:
"Anne York" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]

par(mfrow=c(2,3)) #set up 2 rows x 3 colums
plot(1:10) #plot 1
plot(1:10) #plot 2
plot(1:10) #plot 3
par(mfg=c(2,2))  # start next plot at 2,2 instead of 2,1
plot(1:10)   # 4th plot

If you want to leave the last plot(s) in a such a figure blank,
and continue on with another figure, how does that work?
For example:
par(mfrow=c(2,3)) #set up 2 rows x 3 columns
plot(1:10, main="Plot 1")
plot(1:20, main="Plot 2")
plot(1:30, main="Plot 3")
par(mfg=c(2,2))  # start next plot at 2,2 instead of 2,1
plot(1:40, main="Plot 4")
# What if 5th plot is to start on next page?
# Why do plots 5 and 6 overlay plots 1 and 2 instead
# of being on a new page?
par(mfg=c(1,1))
plot(1:50, main="Plot 5")
plot(1:60, main="Plot 6")
If "par(mfg=c(1,1))" is left out, Plot 6 is on the next figure.
The "new=T" parameters seems like a possible solution, but gives this
warning and is ignored:
 Warning messages:
 1: parameter "new" couldn't be set in high-level plot() function
par(mfrow=c(2,3)) #set up 2 rows x 3 columns
plot(1:10, main="Plot 1", new=T)
plot(1:20, main="Plot 2")
plot(1:30, main="Plot 3")
par(mfg=c(2,2))  # start next plot at 2,2 instead of 2,1
plot(1:40, main="Plot 4")
# What if 5th plot is to start on next page?
# Why do plots 5 and 6 overlay plots 1 and 2 instead
# of being on a new page?
par(mfg=c(1,1))
plot(1:50, main="Plot 5", new=T)
plot(1:60, main="Plot 6")
How do I create a series of plots in one figure and control
when a new figure is created? (without using dummy blank placeholder plots)
The example above is only for discussion.  I really want to do this in a
loop
and create 5 plots per figure, and repeat this for many pages in a PDF file.

Does this do what you want?
layout(rbind(c(1, 2, 3),
 c(0, 4, 0)))
plot(1:10, main="Plot 1")
plot(1:20, main="Plot 2")
plot(1:30, main="Plot 3")
plot(1:40, main="Plot 4")
# new page!
plot(1:40, main="Plot 5")
Paul
--
Dr Paul Murrell
Department of Statistics
The University of Auckland
Private Bag 92019
Auckland
New Zealand
64 9 3737599 x85392
[EMAIL PROTECTED]
http://www.stat.auckland.ac.nz/~paul/
__
R-help@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


Re: [R] slide show with R

2005-03-29 Thread Greg Snow

Another approach is to put your commands below into a text file.

Add a line like:

tmp <- readline('Press Enter to Continue:')

everywhere you want to pause.

Then do:

source('path/to/text/file', echo=T)

it will print out the commands and execute them, but everytime it gets
to the tmp <- ... line it will pause and wait for you to press enter
before continuing on.  you can discuss the lines that have just been
executed and the current plot, then press enter for the next chunk.

hope this helps,




Greg Snow, Ph.D.
Statistical Data Center
[EMAIL PROTECTED]
(801) 408-8111

>>> <[EMAIL PROTECTED]> 03/29/05 01:54PM >>>

Trying to use R to build an interactive "slide show", to be displayed
on a
projector.  The purpose of the presentation is to show how one could
construct a simple graph using R.  It is meant as a general overview
rather
than as detailed instruction.

For example, something like the following sequence of commands.At
lecture time, I want the interpreter to read these commands one at a
time
from a file, display and execute the command, (or two or three
commands)
and then wait for another prompt.

pale.yellow="#99"
par(bg=pale.yellow)
plot(c(0,2*pi),c(-1,1),type="n",ylab="",yaxt="n")
mirror<-function(t) { c(t,rev(2*max(t)-t)) }
z<-log(1:1000)/log(1000)
zz<-z*pi/2
zzz<-mirror(mirror(zz))
polygon(zzz,sin(25*zzz)*sin(zzz),border="blue")
polygon(zzz,sin(5*zzz)*sin(zzz),border="green")
polygon(zzz,sin(zzz),lwd=2)
points(zzz,rep(0,length(zzz)),col="red",pch="|")


Wrapping the following around each command works, sort of :

a<-expression()
x<-readline(a)
eval(a)

However, this doesn't work properly for the function definition, and
it
gets very clumsy to display two or three lines as a block and then
evaluate.

Any help would be much appreciated.


<>=<>=<>=<>=<>=<>=<>=<>=<>=<>=<>
George Heine, PhD
Mathematical Analyst
National IRM Center
U.S. Bureau of Land Management
voice   (303) 236-0099
fax   (303) 236-1974
cell  (303) 905-5382
pager   [EMAIL PROTECTED] 
<>=<>=<>=<>=<>=<>=<>=<>=<>=<>=<>

__
R-help@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

__
R-help@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


Re: [R] Lattice - parallel: xlim and adding lines

2005-03-29 Thread T.A.Wassenaar
Hi Sundar,
Thanks for the reply. And, oops, the panel.parallel.new 
shouldn't be in there. That is a revised panel function to 
color according to a group. As with strange, that would 
generally be 'not-expected', i.e., in the present case, 
not having an x-axis running from -1 to 1 for all ranges. 
I would at least expect to have zero in the middle, but 
that is not so. Excuse me for not expanding 'strange' 
previously. I have read the guide.., some while ago.

Thanks again,
Tsjerk
On Tue, 29 Mar 2005 14:42:05 -0600
 Sundar Dorai-Raj <[EMAIL PROTECTED]> wrote:

T.A.Wassenaar wrote on 3/29/2005 2:17 PM:
Hi,
I'm trying to set the minimum and maximum in a parallel 
plot, but trying 
xlim=c(-1,1) gives strange results. Am I missing 
something? The call I 
give is:

parallel(~X[,c(6,9,12,15,18)]|X$ff,X,panel=panel.parallel.new,groups=X$protein,layout=c(3,1),xlim=c(-1,1)) 

Besides, I would like to add a reference line to the 
plot, but can't 
find how to do that.

I hope someone can give me a hint or two.
Thanks in advance,
Tsjerk
Tsjerk,
I don't think you'll get much help without knowing, 
first, what "strange" means, and second, what 
"panel.parallel.new" does. And you can always add a 
reference line by using panel.abline in your panel 
function.

And, from the signature:
PLEASE do read the posting guide! 
http://www.R-project.org/posting-guide.html

--sundar
__
R-help@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
__
R-help@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


Re: [R] Mosaicplot with different colors

2005-03-29 Thread Achim Zeileis
On Tue, 29 Mar 2005, Jan Sabee wrote:

> This dataset below is one sample answer the questioner from our customer.
>
> > testbank <- read.table("testbank.txt", header=T)
> > testbank
>  age married income gender ownhouse class
> 1  20-30  no   high female  yes   1st
> 2  30-40  no   high female  yes   1st
> 3  40-50  nolow female  yes   1st
> 4  50-60  no   high female  yes   1st
> 5  60-70  no   high female  yes   1st
> 6  20-30  no   high female  yes   1st
> 7  20-30  no medium female  yes   1st
> 8  20-30  nolow female  yes   1st
> 9  20-30  no   high   male  yes   1st
> 10 20-30  no   high female  yes   1st
> 11 30-40  no   high female  yes   1st
> 12 40-50  no   high female  yes   1st
> 13 50-60  no medium female  yes   1st
> 14 20-30  no medium female  yes   1st
> 15 20-30  nolow female  yes   1st
> 16 20-30  no   high   male  yes   1st
> > testbank.tab <- table(testbank)
> > library(vcd)
> > mosaicplot(testbank.tab)

You don't see very much in that plot, do you? 16 observations is not too
much for 6-way information.

> > mosaicplot(testbank.tab, shade=T)
>
> I know mosaicplot (package vcd) can handle for this dataset.
> I want to plot that dataset which different colors for age, income and gender.

Do you want to have a color code which codes all three variables at the
same time? I wouldn't have a straightforward solution for that. But if you
want to shade with respect to a single variable, that might be possible.
You can use
  mosaicplot(mytable, col = ...)
and shade with respect to the last margin added.

> How can I do that? Or are there any others package?

We have a much more flexible implementation of mosaicplots (written in
grid) which will (hopefully) soon be released that allows the
specification of arbitrary color patterns in mosaicplots. If you're
interested, contact me offlist and we'll send you a devel-snapshot.
Z

> Thanks in advance for any assistance.
>
> Jan Sabee
>
> __
> R-help@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
>

__
R-help@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


RE: [R] Aggregating data (with more than one function)

2005-03-29 Thread Robin Schroeder
Dear list & Andy, 

I am hopelessly stumped, how would one add the department names as a variable?

Robin

> Robin Tori Schroeder
> International Institute for Sustainability 
> P.O. Box 873211
> Arizona State University
> Tempe, Arizona 85287-3211
> Phone: (480) 727-7290
> 
> 


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Liaw, Andy
Sent: Monday, March 28, 2005 6:45 PM
To: 'Sivakumaran Raman'; r-help@stat.math.ethz.ch
Subject: RE: [R] Aggregating data (with more than one function)


Here's one possible way, using the data you supplied:

> dat <- read.table("clipboard", header=T, row=1)
> do.call("rbind",by(dat$Salary, dat$Department, function(x) c(mean=mean(x),
total=sum(x
mean  total
Finance 83925.67 251777
HR  6.33 19
IT  59928.67 179786
Sales   62481.67 187445

If you need the department names as a variable, you can add that easily.

HTH,
Andy

> From: Sivakumaran Raman
> 
> I have the data similar to the following in a data frame:
> LastName   Department  Salary
> 1   JohnsonIT  56000
> 2   James  HR  54223
> 3   Howe   Finance 8
> 4   Jones  Finance 82000
> 5   NorwoodIT  67000
> 6   Benson Sales   76000
> 7   Smith  Sales   65778
> 8   Baker  HR  56778
> 9   DempseyHR  78999
> 10  Nolan  Sales   45667
> 11  Garth  Finance 89777
> 12  JamesonIT  56786
> 
> I want to calculate both the mean salary broken down by 
> Department and 
> also the
> total amount paid out per department i.e. I want both sum(Salary) and
> mean(Salary) for each Department. Right now, I am using 
> aggregate.data.frame
> twice, creating two data frames, and then combining them 
> using data.frame.
> However, this seems to be very memory and processor intensive and is 
> taking a
> very long time on my data set. Is there a quicker way to do this?
> 
> Thanks in advance,
> Siv Raman
> 
> __
> R-help@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
> 
> 
>

__
R-help@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

__
R-help@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


[R] Mosaicplot with different colors

2005-03-29 Thread Jan Sabee
This dataset below is one sample answer the questioner from our customer.

> testbank <- read.table("testbank.txt", header=T)
> testbank
 age married income gender ownhouse class
1  20-30  no   high female  yes   1st
2  30-40  no   high female  yes   1st
3  40-50  nolow female  yes   1st
4  50-60  no   high female  yes   1st
5  60-70  no   high female  yes   1st
6  20-30  no   high female  yes   1st
7  20-30  no medium female  yes   1st
8  20-30  nolow female  yes   1st
9  20-30  no   high   male  yes   1st
10 20-30  no   high female  yes   1st
11 30-40  no   high female  yes   1st
12 40-50  no   high female  yes   1st
13 50-60  no medium female  yes   1st
14 20-30  no medium female  yes   1st
15 20-30  nolow female  yes   1st
16 20-30  no   high   male  yes   1st
> testbank.tab <- table(testbank)
> library(vcd)
> mosaicplot(testbank.tab)
> mosaicplot(testbank.tab, shade=T)

I know mosaicplot (package vcd) can handle for this dataset.
I want to plot that dataset which different colors for age, income and gender.
How can I do that? Or are there any others package?
Thanks in advance for any assistance.

Jan Sabee

__
R-help@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


Re: [R] slide show with R

2005-03-29 Thread Michaell Taylor
Seems like emacs-ess would do the trick.  You can read in the entire
file - formatted or spaced as appropriate - execute one line or several
at a time and see the results in real time.

Obviously less a "slide show" than an R session, but that seems to be
what you want.  

A more "canned" slide show like approach might be something like
Sweave/Prosper.  This is considerably more work, loses the ability to
interact with the interpreter -- but does achieve a very slick slideshow
sort of look.

On Tue, 2005-03-29 at 14:54, [EMAIL PROTECTED] wrote:
> 
> 
> Trying to use R to build an interactive "slide show", to be displayed on a
> projector.  The purpose of the presentation is to show how one could
> construct a simple graph using R.  It is meant as a general overview rather
> than as detailed instruction.
> 
> For example, something like the following sequence of commands.At
> lecture time, I want the interpreter to read these commands one at a time
> from a file, display and execute the command, (or two or three commands)
> and then wait for another prompt.
> 
> pale.yellow="#99"
> par(bg=pale.yellow)
> plot(c(0,2*pi),c(-1,1),type="n",ylab="",yaxt="n")
> mirror<-function(t) { c(t,rev(2*max(t)-t)) }
> z<-log(1:1000)/log(1000)
> zz<-z*pi/2
> zzz<-mirror(mirror(zz))
> polygon(zzz,sin(25*zzz)*sin(zzz),border="blue")
> polygon(zzz,sin(5*zzz)*sin(zzz),border="green")
> polygon(zzz,sin(zzz),lwd=2)
> points(zzz,rep(0,length(zzz)),col="red",pch="|")
> 
> 
> Wrapping the following around each command works, sort of :
> 
> a<-expression()
> x<-readline(a)
> eval(a)
> 
> However, this doesn't work properly for the function definition, and it
> gets very clumsy to display two or three lines as a block and then
> evaluate.
> 
> Any help would be much appreciated.
> 
> 
> <>=<>=<>=<>=<>=<>=<>=<>=<>=<>=<>
> George Heine, PhD
> Mathematical Analyst
> National IRM Center
> U.S. Bureau of Land Management
> voice   (303) 236-0099
> fax   (303) 236-1974
> cell  (303) 905-5382
> pager   [EMAIL PROTECTED]
> <>=<>=<>=<>=<>=<>=<>=<>=<>=<>=<>
> 
> __
> R-help@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
> 
>

__
R-help@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


RE: [R] slide show with R

2005-03-29 Thread Berton Gunter
Oops, I should have said that you can execute the text line via the
construction:

eval(parse(text=textline))



-- 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: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of 
> [EMAIL PROTECTED]
> Sent: Tuesday, March 29, 2005 12:54 PM
> To: R-Help
> Subject: [R] slide show with R
> 
> 
> 
> 
> 
> Trying to use R to build an interactive "slide show", to be 
> displayed on a
> projector.  The purpose of the presentation is to show how one could
> construct a simple graph using R.  It is meant as a general 
> overview rather
> than as detailed instruction.
> 
> For example, something like the following sequence of commands.At
> lecture time, I want the interpreter to read these commands 
> one at a time
> from a file, display and execute the command, (or two or 
> three commands)
> and then wait for another prompt.
> 
> pale.yellow="#99"
> par(bg=pale.yellow)
> plot(c(0,2*pi),c(-1,1),type="n",ylab="",yaxt="n")
> mirror<-function(t) { c(t,rev(2*max(t)-t)) }
> z<-log(1:1000)/log(1000)
> zz<-z*pi/2
> zzz<-mirror(mirror(zz))
> polygon(zzz,sin(25*zzz)*sin(zzz),border="blue")
> polygon(zzz,sin(5*zzz)*sin(zzz),border="green")
> polygon(zzz,sin(zzz),lwd=2)
> points(zzz,rep(0,length(zzz)),col="red",pch="|")
> 
> 
> Wrapping the following around each command works, sort of :
> 
> a<-expression()
> x<-readline(a)
> eval(a)
> 
> However, this doesn't work properly for the function 
> definition, and it
> gets very clumsy to display two or three lines as a block and then
> evaluate.
> 
> Any help would be much appreciated.
> 
> 
> <>=<>=<>=<>=<>=<>=<>=<>=<>=<>=<>
> George Heine, PhD
> Mathematical Analyst
> National IRM Center
> U.S. Bureau of Land Management
> voice   (303) 236-0099
> fax   (303) 236-1974
> cell  (303) 905-5382
> pager   [EMAIL PROTECTED]
> <>=<>=<>=<>=<>=<>=<>=<>=<>=<>=<>
> 
> __
> R-help@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
>

__
R-help@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


RE: [R] slide show with R

2005-03-29 Thread Berton Gunter
One possible strategy:

see ?readLines

Write a text file with your R commands. Then
write a little function that opens a connection to the file and runs a loop
to:

1)read a line from your file via readLines
2) cat() the line on your terminal
3) prompt via readline to execute it.

You'll have to get a little fancy to check for expressions that span several
lines and check for the end of file, but this should work, I think.

Cheers,

-- 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: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of 
> [EMAIL PROTECTED]
> Sent: Tuesday, March 29, 2005 12:54 PM
> To: R-Help
> Subject: [R] slide show with R
> 
> 
> 
> 
> 
> Trying to use R to build an interactive "slide show", to be 
> displayed on a
> projector.  The purpose of the presentation is to show how one could
> construct a simple graph using R.  It is meant as a general 
> overview rather
> than as detailed instruction.
> 
> For example, something like the following sequence of commands.At
> lecture time, I want the interpreter to read these commands 
> one at a time
> from a file, display and execute the command, (or two or 
> three commands)
> and then wait for another prompt.
> 
> pale.yellow="#99"
> par(bg=pale.yellow)
> plot(c(0,2*pi),c(-1,1),type="n",ylab="",yaxt="n")
> mirror<-function(t) { c(t,rev(2*max(t)-t)) }
> z<-log(1:1000)/log(1000)
> zz<-z*pi/2
> zzz<-mirror(mirror(zz))
> polygon(zzz,sin(25*zzz)*sin(zzz),border="blue")
> polygon(zzz,sin(5*zzz)*sin(zzz),border="green")
> polygon(zzz,sin(zzz),lwd=2)
> points(zzz,rep(0,length(zzz)),col="red",pch="|")
> 
> 
> Wrapping the following around each command works, sort of :
> 
> a<-expression()
> x<-readline(a)
> eval(a)
> 
> However, this doesn't work properly for the function 
> definition, and it
> gets very clumsy to display two or three lines as a block and then
> evaluate.
> 
> Any help would be much appreciated.
> 
> 
> <>=<>=<>=<>=<>=<>=<>=<>=<>=<>=<>
> George Heine, PhD
> Mathematical Analyst
> National IRM Center
> U.S. Bureau of Land Management
> voice   (303) 236-0099
> fax   (303) 236-1974
> cell  (303) 905-5382
> pager   [EMAIL PROTECTED]
> <>=<>=<>=<>=<>=<>=<>=<>=<>=<>=<>
> 
> __
> R-help@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
>

__
R-help@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


[R] slide show with R

2005-03-29 Thread George_Heine




Trying to use R to build an interactive "slide show", to be displayed on a
projector.  The purpose of the presentation is to show how one could
construct a simple graph using R.  It is meant as a general overview rather
than as detailed instruction.

For example, something like the following sequence of commands.At
lecture time, I want the interpreter to read these commands one at a time
from a file, display and execute the command, (or two or three commands)
and then wait for another prompt.

pale.yellow="#99"
par(bg=pale.yellow)
plot(c(0,2*pi),c(-1,1),type="n",ylab="",yaxt="n")
mirror<-function(t) { c(t,rev(2*max(t)-t)) }
z<-log(1:1000)/log(1000)
zz<-z*pi/2
zzz<-mirror(mirror(zz))
polygon(zzz,sin(25*zzz)*sin(zzz),border="blue")
polygon(zzz,sin(5*zzz)*sin(zzz),border="green")
polygon(zzz,sin(zzz),lwd=2)
points(zzz,rep(0,length(zzz)),col="red",pch="|")


Wrapping the following around each command works, sort of :

a<-expression()
x<-readline(a)
eval(a)

However, this doesn't work properly for the function definition, and it
gets very clumsy to display two or three lines as a block and then
evaluate.

Any help would be much appreciated.


<>=<>=<>=<>=<>=<>=<>=<>=<>=<>=<>
George Heine, PhD
Mathematical Analyst
National IRM Center
U.S. Bureau of Land Management
voice   (303) 236-0099
fax   (303) 236-1974
cell  (303) 905-5382
pager   [EMAIL PROTECTED]
<>=<>=<>=<>=<>=<>=<>=<>=<>=<>=<>

__
R-help@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


[R] matching vectors against vectors

2005-03-29 Thread Piet van Remortel
Hi all.
I have a re-occuring typical problem that I don't know how to solve 
efficiently.

The situation is the following:   I have a number of data-sets 
(A,B,C,...) , consisting of an identifier (e.g. 11,12,13,...,20) and a 
measurement (e.g. in the range 100-120).   I want to compile a large 
table, with all availabe identifiers in all data-sets in the rows, and 
a column for every dataset.

Now, not all datasets have a measurement for every identifier, so I 
want NA if the set does not contain the identifier.

an example for a single dataset:
#all identifiers
> rep <- c(10:20)
#Identifiers in my dataset (a subset of rep)
> rep1 <- c(12,13,15,16,17,18)
#measurements in this dataset
> rep1.r <- c(112,113,115,116,117,118)
#a vector which should become a column in the final table, now 
containing all NAs
> res <- rep(NA,10)

#the IDs and values of my dataset together
> data <- cbind(rep1, rep1.r)
data looks like this:
 rep1 rep1.r
[1,]   12112
[2,]   13113
[3,]   15115
[4,]   16116
[5,]   17117
[6,]   18118
Now, I want to put the values 112, 113, 115,... in the correct rows of 
the final table, using the identifiers as an indicator of which row to 
put it in, so that I finally obtain:

rep res
10NA
11NA
12112
13113
14NA
15115
16116
17117
18118
19NA
20NA
I try to avoid repeating 'which' a lot and filling in every 
identifier's observation etc, since I will be doing this for thousands 
of rows at once.There must be an efficient way using factors, 
tapply etc, but I have trouble finding it.  Ideal would be if this 
could be done in one go, instead of looping.

Any suggestions ?
Thanks,
Piet
__
R-help@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


Re: [R] Lattice - parallel: xlim and adding lines

2005-03-29 Thread Sundar Dorai-Raj

T.A.Wassenaar wrote on 3/29/2005 2:17 PM:
Hi,
I'm trying to set the minimum and maximum in a parallel plot, but trying 
xlim=c(-1,1) gives strange results. Am I missing something? The call I 
give is:

parallel(~X[,c(6,9,12,15,18)]|X$ff,X,panel=panel.parallel.new,groups=X$protein,layout=c(3,1),xlim=c(-1,1)) 

Besides, I would like to add a reference line to the plot, but can't 
find how to do that.

I hope someone can give me a hint or two.
Thanks in advance,
Tsjerk
Tsjerk,
I don't think you'll get much help without knowing, first, what 
"strange" means, and second, what "panel.parallel.new" does. And you can 
always add a reference line by using panel.abline in your panel function.

And, from the signature:
PLEASE do read the posting guide! 
http://www.R-project.org/posting-guide.html

--sundar
__
R-help@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


[R] Lattice - parallel: xlim and adding lines

2005-03-29 Thread T.A.Wassenaar
Hi,
I'm trying to set the minimum and maximum in a parallel 
plot, but trying xlim=c(-1,1) gives strange results. Am I 
missing something? The call I give is:

parallel(~X[,c(6,9,12,15,18)]|X$ff,X,panel=panel.parallel.new,groups=X$protein,layout=c(3,1),xlim=c(-1,1))
Besides, I would like to add a reference line to the plot, 
but can't find how to do that.

I hope someone can give me a hint or two.
Thanks in advance,
Tsjerk
__
R-help@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


Re: [R] dependency help for FC2 rpm

2005-03-29 Thread Peter Dalgaard
Steve Sherman <[EMAIL PROTECTED]> writes:

> I am having difficulty with dependencies for the R rpm for Fedora Core 2.
> 
> In attempting to load R-2.0.0.0.fdr.1.fc2.i386.rpm it fails the
> libtk8.4.so dependency even though I have this library loaded. The
> library is located in:  /usr/local/lib.
> 
> How might I tell R where to find this library? I am new to Linux and
> loading rpms so I am hoping there is a simple answer and that the
> problem is related to my inexperience. Thanks in advance for any
> assistance.

You need to install the RPM dependencies that it depends on. A
libtk8.4.so in /usr/local/lib doesn't come from a standard RPM. You
need to install the tk (and tcl) RPM from CD's or a Fedora repository.

-- 
   O__   Peter Dalgaard Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics 2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark  Ph: (+45) 35327918
~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907

__
R-help@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


Re: [R] final stages of installing R - please help?

2005-03-29 Thread Peter Dalgaard
"Jeffrey Gruen, M.D." <[EMAIL PROTECTED]> writes:

> Hello,
> 
> This morning I downloaded, unzipped, and compiled the latest version
> of R for unix, in my HOME/APPLICATIONS directory.
> My current unix machine is a sparc-sun-solaris2.9, running SunOS 5.9.
> Here are the last few lines of the output following ./configure:
> 
> R is now configured for sparc-sun-solaris2.9
> 
>Source directory:  .
>Installation directory:/usr/local
> 
>C compiler:/usr/local/bin/gcc  -g -O2
>C++ compiler:  g++
>Fortran compiler:  /usr/local/bin/g77  -g -O2
> 
>Interfaces supported:  X11
>External libraries:
>Additional capabilities:
>Options enabled:   R profiling
> 
>Recommended packages:  yes
> 
> Then I checked my HOME/APPLICATIONS directory and indeed following the
> compiling, I now had a new bin directory:
> HOME/APPLICATIONS/R-2.0.1/bin
> And within the bin, I had many new files including an executable
> (theoretically) R file:
> -rwxr-xr-x   1 root6099 Mar 29 13:18 R
> 
> I then ran 'make'.
> Here are the last few lines from the 'make' output to the screen:
> rm -f libappl.a
> false cr libappl.a approx.o bakslv.o bandwidths.o binning.o chull.o
> cpoly.o cumsum.o fft.o fmin.o integrate.o interv.o lbfgsb.o loglin.o
> lowess.o machar.o maxcol.o massdist.o pretty.o rcont.o rowsum.o
> splines.o stem.o strsignif.o tabulate.o uncmin.o zeroin.o ch2inv.o
> chol.o dchdc.o dpbfa.o dpbsl.o dpoco.o dpodi.o dpofa.o dposl.o dqrdc.o
> dqrdc2.o dqrls.o dqrsl.o dqrutl.o dsvdc.o dtrco.o dtrsl.o eigen.o
> lminfl.o blas.o  zgemm.o
> make[3]: *** [libappl.a] Error 1
> make[3]: Leaving directory `/home/gruen/Applications/R-2.0.1/src/appl'
> make[2]: *** [R] Error 2
> make[2]: Leaving directory `/home/gruen/Applications/R-2.0.1/src/appl'
> make[1]: *** [R] Error 1
> make[1]: Leaving directory `/home/gruen/Applications/R-2.0.1/src'
> make: *** [R] Error 1

Looks like it couldn't find the "ar" program and set it to "false". I
don't quite understand why configure allows itself to complete in that
case, but the basic problem could be that you don't have your PATH set
right. I believe the standard version sits in /usr/ccs/bin.
 
> I then ran 'make check'.

Won't do anything useful if you haven't built R succesfully first.


-- 
   O__   Peter Dalgaard Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics 2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark  Ph: (+45) 35327918
~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907

__
R-help@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


[R] dependency help for FC2 rpm

2005-03-29 Thread Steve Sherman
I am having difficulty with dependencies for the R rpm for Fedora Core 2.
In attempting to load R-2.0.0.0.fdr.1.fc2.i386.rpm it fails the 
libtk8.4.so dependency even though I have this library loaded. The 
library is located in:  /usr/local/lib.

How might I tell R where to find this library? I am new to Linux and 
loading rpms so I am hoping there is a simple answer and that the 
problem is related to my inexperience. Thanks in advance for any 
assistance.


Steve
__
R-help@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


[R] final stages of installing R - please help?

2005-03-29 Thread Jeffrey Gruen, M.D.
Hello,
This morning I downloaded, unzipped, and compiled the latest version of 
R for unix, in my HOME/APPLICATIONS directory.
My current unix machine is a sparc-sun-solaris2.9, running SunOS 5.9.
Here are the last few lines of the output following ./configure:

R is now configured for sparc-sun-solaris2.9
  Source directory:  .
  Installation directory:/usr/local
  C compiler:/usr/local/bin/gcc  -g -O2
  C++ compiler:  g++
  Fortran compiler:  /usr/local/bin/g77  -g -O2
  Interfaces supported:  X11
  External libraries:
  Additional capabilities:
  Options enabled:   R profiling
  Recommended packages:  yes
Then I checked my HOME/APPLICATIONS directory and indeed following the 
compiling, I now had a new bin directory:
HOME/APPLICATIONS/R-2.0.1/bin
And within the bin, I had many new files including an executable 
(theoretically) R file:
-rwxr-xr-x   1 root6099 Mar 29 13:18 R

I then ran 'make'.
Here are the last few lines from the 'make' output to the screen:
rm -f libappl.a
false cr libappl.a approx.o bakslv.o bandwidths.o binning.o chull.o 
cpoly.o cumsum.o fft.o fmin.o integrate.o interv.o lbfgsb.o loglin.o 
lowess.o machar.o maxcol.o massdist.o pretty.o rcont.o rowsum.o 
splines.o stem.o strsignif.o tabulate.o uncmin.o zeroin.o ch2inv.o 
chol.o dchdc.o dpbfa.o dpbsl.o dpoco.o dpodi.o dpofa.o dposl.o dqrdc.o 
dqrdc2.o dqrls.o dqrsl.o dqrutl.o dsvdc.o dtrco.o dtrsl.o eigen.o 
lminfl.o blas.o  zgemm.o
make[3]: *** [libappl.a] Error 1
make[3]: Leaving directory `/home/gruen/Applications/R-2.0.1/src/appl'
make[2]: *** [R] Error 2
make[2]: Leaving directory `/home/gruen/Applications/R-2.0.1/src/appl'
make[1]: *** [R] Error 1
make[1]: Leaving directory `/home/gruen/Applications/R-2.0.1/src'
make: *** [R] Error 1

I then ran 'make check'.
Here is the output:
# /usr/local/bin/make check
make[1]: Entering directory `/home/gruen/Applications/R-2.0.1/tests'
make[2]: Entering directory `/home/gruen/Applications/R-2.0.1/tests'
make[3]: Entering directory 
`/home/gruen/Applications/R-2.0.1/tests/Examples'
make[4]: Entering directory 
`/home/gruen/Applications/R-2.0.1/tests/Examples'
make[4]: Leaving directory 
`/home/gruen/Applications/R-2.0.1/tests/Examples'
make[4]: Entering directory 
`/home/gruen/Applications/R-2.0.1/tests/Examples'
make[4]: *** No rule to make target `../../bin/exec/R', needed by 
`base-Ex.Rout'.  Stop.
make[4]: Leaving directory 
`/home/gruen/Applications/R-2.0.1/tests/Examples'
make[3]: *** [test-Examples-Base] Error 2
make[3]: Leaving directory 
`/home/gruen/Applications/R-2.0.1/tests/Examples'
make[2]: *** [test-Examples] Error 2
make[2]: Leaving directory `/home/gruen/Applications/R-2.0.1/tests'
make[1]: *** [test-all-basics] Error 1
make[1]: Leaving directory `/home/gruen/Applications/R-2.0.1/tests'
make: *** [check] Error 2

I was not sure if the errors were important so I tried additional 'make 
check' operations:
# /usr/local/bin/make check FORCE=FORCE
make: Nothing to be done for `check'.
# /usr/local/bin/make check-devel
make: *** No rule to make target `check-devel'.  Stop.
# /usr/local/bin/make check-all
make: *** No rule to make target `check-all'.  Stop.

Then I relogged on and tried to execute 'R' in my bin, as either myself 
or even root, but got the same message:
gruen@/home/gruen% R
/usr/local/bin/R: /home/gruen/Applications/R-2.0.1/bin/exec/R: not found

But it does not execute.
Any thoughts?
Thank you!
Jeff Gruen
[EMAIL PROTECTED]
__
R-help@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


Re: [R] Annotation metadata "kills" help.search

2005-03-29 Thread Seth Falcon
Seth Falcon <[EMAIL PROTECTED]> writes:

> Hi Gerard,
>
> "Gerard Tromp" <[EMAIL PROTECTED]> writes:
>> OS: Windows
>> R 2.0.1
>>
>> As of about a week ago the help.search function dies when used in the simple
>> help.search("something") usage.
>> The error is
>> Error in rbind(...) : number of columns of matrices must match (see arg 203)
>>
>> After some effort I have traced it down to the annotation packages. I
>> installed
>> GO, KEGG, mgu74[abc]v2 and hgu133plus2 all version 1.7.0
>
> We (the Bioconductor team) will look into this and see if we can
> reproduce what you are reporting.  This is the first we've heard of
> difficulties with the help system caused by the annotation data
> packages.

We are not able to reproduce this issue.  If you reinstall the
annotation packages does the error reappear? 

If so, an exact transcript of the commands entered, their output, and
the output of traceback() right after the error would be helpful ---
and it would be best to move the discussion to the bioconductor list. 

+ seth

__
R-help@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


Re: [R] regression tree xerror

2005-03-29 Thread Luis Torgo
Sherri Miller wrote:
I am running some models (for the first time) using rpart and am getting
results I don't know how to interpret. I'm using cross-validation to prune
the tree and the results look like:
Root node error: 172.71/292 = 0.59148
n= 292
CP nsplit rel error  xerror xstd
1  0.124662  0   1.0 1.00731 0.093701
2  0.064634  1   0.87534 1.08076 0.092337
3  0.057300  2   0.81070 1.07684 0.095582
4  0.038462  4   0.69610 0.99104 0.091659
5  0.036200  5   0.65764 1.01596 0.094635
6  0.029228  7   0.58524 1.00058 0.095440
7  0.028779  8   0.55601 1.00704 0.093242
8  0.024192  9   0.52724 0.97844 0.088936
9  0.018038 11   0.47885 1.02749 0.092263
10 0.016867 13   0.44278 1.08704 0.092112
11 0.015465 14   0.42591 1.10805 0.097813
12 0.015000 15   0.41044 1.11130 0.097881
I do not understand why the rel error rate is going down, but the xerror
generally goes up. For some of the runs, the xerror never goes down. Is
result caused by something in my data structure? I have run some example
datasets from the various help manuals and the xerror goes down, as one
would expect. Any suggestions?
Sherri
Sherri L. Miller
Wildlife Biologist
Redwood Sciences Laboratory
707.825.2949
707.825.2901 (FAX)
__
R-help@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
 

rel error is estimated with the training data (the sample used for 
obtaining the tree) and thus it decreases as the tree increases, because 
the tree becomes more and more adjusted to the data. This apparently 
better performance should not be taken for "real" when predicting for a 
new sample of data because larger trees do tend to overfit the traning 
sample and will hardly generalise well on new fresh data samples.

That's the motivation for the xerror (and xstd) estimates. These are 
more realistic estimates of the performance of the tree on new samples 
of data. They are obtained by the rpart function by an internal cross 
validation process. The function prune() can be used to select a subtree 
of the tree obtained with rpart() if you think (by looking at the xerror 
estimates) you would be better off with this subtree.

Hope this helps.
Luis Torgo
--
Luis Torgo
   FEP/LIACC, University of Porto   Phone : (+351) 22 339 20 93
   Machine Learning Group   Fax   : (+351) 22 339 20 99
   R. de Ceuta, 118, 6o email : [EMAIL PROTECTED]
   4050-190 PORTO - PORTUGALWWW   : http://www.liacc.up.pt/~ltorgo
__
R-help@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


[R] Re: follow up on "pairewise plots"

2005-03-29 Thread Hai Lin
--- Dimitris Rizopoulos
<[EMAIL PROTECTED]> wrote:
> you could try something like this:
> 
> dat <- array(sample(24), dim=c(4,2,3))
> par(mfrow=c(3,1))
> apply(dat, 3, function(x) plot(rowSums(x),
> x[,2]-x[,1]))

##

Thank you all for the inputs. It's great of help. 

The above solution also opens my mind that I could
convert my data to an array. 

dat <- data.frame(matrix(sample(24), nrow=4))
dimnames(dat) <-list(rownames=c('g1','g2','g3','g4'),
colnames=c("A_CH1","A_CH2","B_CH1","B_CH2","C_CH1","C_CH2"))

Sorry for the typo. (C_CH1, C_CH2)

dat2 <- array(unlist(dat), dim=c(4,2,3))  
and then plot them using Dimitris' solution.

Other statements of converting form are welcomed...

Thanks again.

__
R-help@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


RE: [R] Tool for update

2005-03-29 Thread abunn
> I think what Prof. Ripley meant is: you have to run R on a
> Tuesday in order to
> update your packages. You could lift this requirement --- and
> still update on
> Tuesdays --- by using a cron job instead. (That's assuming you're using a
> Unix variant, I suppose there is some equivalent way to achieve the same
> thing on Windows.)

I'm very sorry for causing such a stir - asking "What's wrong with Tuesday?"
was a poor attempt at humor. I was subconsciously trying to make it into the
fortunes package but my wit pales in comparison to the greats.

Mea culpa,

Andy

__
R-help@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


Re: [R] Problem installing packages and weird R site behaviour

2005-03-29 Thread Peter Dalgaard
"Hanke, Alex" <[EMAIL PROTECTED]> writes:

> Hi,
> I tried to install a package using the menu option and was presented a list
> filled with NA's.
> I then tried visiting the R site and each option on the side bar (eg. CRAN,
> Search,FAQ) sends me to the address attached below (NB: I left off the h in
> http).
> The first problem seems to be related to the second.
> Is anyone else experiencing this behaviour and how do I restore normal
> behaviour?
> Regards
> Alex
> 
> Problem 1
> >local({a <- CRAN.packages()
> + install.packages(select.list(a[,1],,TRUE), .libPaths()[1], available=a,
> dependencies=TRUE)})
> trying URL `http://cran.r-project.org/bin/windows/contrib/2.0/PACKAGES'
> Content type `text/html' length unknown
> opened URL
> downloaded 953 bytes
> 
> Problem 2
> {ttp://64.235.246.142/?a_id=794&adultfilter=on&domainname=r-project.org}
> 
> Alex Hanke
> Department of Fisheries and Oceans
> St. Andrews Biological Station
> 531 Brandy Cove Road
> St. Andrews, NB
> Canada
> E5B 2L9

[EMAIL PROTECTED] ~]$ host search.domainsponsor.com
search.domainsponsor.com has address 64.235.246.141

Looks like foul play (domainname hijacking, or some sort of spyware on
your machine). Things look normal from here.

-- 
   O__   Peter Dalgaard Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics 2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark  Ph: (+45) 35327918
~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907

__
R-help@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


[R] Stratified Bootstrap question

2005-03-29 Thread qiana
Dear R users,

I have a question regarding stratified bootstrap question and how to implement
it using boot() in R's boot package.

My dataset is a longitudinal dataset (3 measurements per person at year
1, 4 and 7) composed of multiple clinic centers and multiple participants
within each clinic. It has missing values.

I want to do a bootstrap to find the standard errors and confidence
intervals for my variance components. My model is a mixed model with
random clinic and random participant within clinic.

I thought two methods to do bootstrap:
(1) bootstrap data; however, I have problem specifying the second
parameter for my statistic function, shall I use indices, weight or
frequency and how shall I relate to my dataset.
(2) bootstrap residuals; however, the dataset has multiple measurements
and missing values. I am wondering how to construct a new data frame
containing the residuals and fitted values.

Any ideas will be highly appreciated!
Sincerely yours,
Qian

__
R-help@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


Re: [R] Tool for update

2005-03-29 Thread Vincent Goulet
Le 25 Mars 2005 16:12, abunn a écrit :
> > For what I understand you run this every time you use R on a Tuesday,
> > which is not what I would want.
>
> What's wrong with Tuesday? Indeed, it's not the ideal solution but has kept
> me up-to-date. What has amazed me is that I think I've used R every Tuesday
> (and other workdays) since I did that. So, it ends up working pretty well.
> I will look forward to a cleaner implementation with 2.1

I think what Prof. Ripley meant is: you have to run R on a Tuesday in order to 
update your packages. You could lift this requirement --- and still update on 
Tuesdays --- by using a cron job instead. (That's assuming you're using a 
Unix variant, I suppose there is some equivalent way to achieve the same 
thing on Windows.)

Regards,

-- 
  Vincent Goulet, Associate Professor
  École d'actuariat
  Université Laval, Québec 
  [EMAIL PROTECTED]   http://vgoulet.act.ulaval.ca

__
R-help@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


[R] regression tree xerror

2005-03-29 Thread Sherri Miller
I am running some models (for the first time) using rpart and am getting
results I don't know how to interpret. I'm using cross-validation to prune
the tree and the results look like:
Root node error: 172.71/292 = 0.59148

n= 292

 CP nsplit rel error  xerror xstd
1  0.124662  0   1.0 1.00731 0.093701
2  0.064634  1   0.87534 1.08076 0.092337
3  0.057300  2   0.81070 1.07684 0.095582
4  0.038462  4   0.69610 0.99104 0.091659
5  0.036200  5   0.65764 1.01596 0.094635
6  0.029228  7   0.58524 1.00058 0.095440
7  0.028779  8   0.55601 1.00704 0.093242
8  0.024192  9   0.52724 0.97844 0.088936
9  0.018038 11   0.47885 1.02749 0.092263
10 0.016867 13   0.44278 1.08704 0.092112
11 0.015465 14   0.42591 1.10805 0.097813
12 0.015000 15   0.41044 1.11130 0.097881

I do not understand why the rel error rate is going down, but the xerror
generally goes up. For some of the runs, the xerror never goes down. Is
result caused by something in my data structure? I have run some example
datasets from the various help manuals and the xerror goes down, as one
would expect. Any suggestions?

Sherri

Sherri L. Miller
Wildlife Biologist
Redwood Sciences Laboratory
707.825.2949
707.825.2901 (FAX)

__
R-help@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


[R] Problem installing packages and weird R site behaviour

2005-03-29 Thread Hanke, Alex
Hi,
I tried to install a package using the menu option and was presented a list
filled with NA's.
I then tried visiting the R site and each option on the side bar (eg. CRAN,
Search,FAQ) sends me to the address attached below (NB: I left off the h in
http).
The first problem seems to be related to the second.
Is anyone else experiencing this behaviour and how do I restore normal
behaviour?
Regards
Alex

Problem 1
>local({a <- CRAN.packages()
+ install.packages(select.list(a[,1],,TRUE), .libPaths()[1], available=a,
dependencies=TRUE)})
trying URL `http://cran.r-project.org/bin/windows/contrib/2.0/PACKAGES'
Content type `text/html' length unknown
opened URL
downloaded 953 bytes

Problem 2
{ttp://64.235.246.142/?a_id=794&adultfilter=on&domainname=r-project.org}

Alex Hanke
Department of Fisheries and Oceans
St. Andrews Biological Station
531 Brandy Cove Road
St. Andrews, NB
Canada
E5B 2L9



[[alternative HTML version deleted]]

__
R-help@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


Re: [R] Multi-plot figures with different numbers of plots indifferent rows

2005-03-29 Thread Earl F. Glynn
"Anne York" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]

> par(mfrow=c(2,3)) #set up 2 rows x 3 colums
> plot(1:10) #plot 1
> plot(1:10) #plot 2
> plot(1:10) #plot 3
> par(mfg=c(2,2))  # start next plot at 2,2 instead of 2,1
>  plot(1:10)   # 4th plot

If you want to leave the last plot(s) in a such a figure blank,
and continue on with another figure, how does that work?

For example:

par(mfrow=c(2,3)) #set up 2 rows x 3 columns
plot(1:10, main="Plot 1")
plot(1:20, main="Plot 2")
plot(1:30, main="Plot 3")
par(mfg=c(2,2))  # start next plot at 2,2 instead of 2,1
plot(1:40, main="Plot 4")

# What if 5th plot is to start on next page?
# Why do plots 5 and 6 overlay plots 1 and 2 instead
# of being on a new page?
par(mfg=c(1,1))
plot(1:50, main="Plot 5")
plot(1:60, main="Plot 6")

If "par(mfg=c(1,1))" is left out, Plot 6 is on the next figure.

The "new=T" parameters seems like a possible solution, but gives this
warning and is ignored:
 Warning messages:
 1: parameter "new" couldn't be set in high-level plot() function

par(mfrow=c(2,3)) #set up 2 rows x 3 columns
plot(1:10, main="Plot 1", new=T)
plot(1:20, main="Plot 2")
plot(1:30, main="Plot 3")
par(mfg=c(2,2))  # start next plot at 2,2 instead of 2,1
plot(1:40, main="Plot 4")

# What if 5th plot is to start on next page?
# Why do plots 5 and 6 overlay plots 1 and 2 instead
# of being on a new page?
par(mfg=c(1,1))
plot(1:50, main="Plot 5", new=T)
plot(1:60, main="Plot 6")

How do I create a series of plots in one figure and control
when a new figure is created? (without using dummy blank placeholder plots)

The example above is only for discussion.  I really want to do this in a
loop
and create 5 plots per figure, and repeat this for many pages in a PDF file.

Thanks for any insight on this.

efg
--
Earl F. Glynn
Scientific Programmer
Stowers Institute for Medical Research

__
R-help@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


Re: [R] pairewise plots

2005-03-29 Thread Deepayan Sarkar
On Tuesday 29 March 2005 08:58, Hai Lin wrote:
> Dear R users,
>
> I have a data generated as the following,
>
> dat <- data.frame(matrix(sample(24), nrow=4))
> dimnames(dat) <-list(rownames=c('g1','g2','g3','g4'),
> colnames=c("A_CH1","A_CH2","B_CH1","B_CH2","C_CH3","C_CH3"))
>
> » dat
>A_CH1 A_CH2 B_CH1 B_CH2 C_CH3 C_CH3
> g11624 7 91420
> g2 4101922 517
> g31118211213 1
> g4 2 315 623 8

Why would you want two columns with the same name?

> I am trying to plot them pairwise by column(might extend to more than
> 3 pairs) Instead manually plotting as below, could you please point
> me out with easier ways?

If your data frame can be easily restructured (using reshape perhaps), 
one possible solution would be to use the lattice package:

require(lattice)
tmd(xyplot(c(A_CH1, B_CH1, C_CH1) ~ c(A_CH2, B_CH2, C_CH2) | gl(3, 4),
   dat, layout = c(3, 1)))

Note that 
1. This is with the data frame as it is, except that I assume the 
   last 2 columns are named C_CH1 and C_CH2
2. This plots the mean instead of the sum (but on the other hand, 
   it's a standard plot that way)

Deepayan

> par(mfrow=c(3,1))
> plot(dat$A_CH1+dat$A_CH2, dat$A_CH1-dat$A_CH2)
> plot(dat$B_CH1+dat$B_CH2, dat$B_CH1-dat$B_CH2)
> plot(dat[,5]+dat[,6], dat[,5]-dat[,6])
>
> Thanks a lot for your help

__
R-help@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


Re: [R] a cox model question

2005-03-29 Thread Thomas Lumley
On Mon, 28 Mar 2005, Chao Zhu wrote:
Hi,
Is there anyone can tell me how to estimate baseline cumulative hazard function 
and baseline survival function
by using Breslow's method in R?
survfit() does this.
-thomas
__
R-help@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


Re: [R] pairewise plots

2005-03-29 Thread Dimitris Rizopoulos
you could try something like this:
dat <- array(sample(24), dim=c(4,2,3))
par(mfrow=c(3,1))
apply(dat, 3, function(x) plot(rowSums(x), x[,2]-x[,1]))
I hope it helps.
Best,
Dimitris

Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/16/336899
Fax: +32/16/337015
Web: http://www.med.kuleuven.ac.be/biostat/
http://www.student.kuleuven.ac.be/~m0390867/dimitris.htm
- Original Message - 
From: "Hai Lin" <[EMAIL PROTECTED]>
To: 
Sent: Tuesday, March 29, 2005 4:58 PM
Subject: [R] pairewise plots

Dear R users,
I have a data generated as the following,
dat <- data.frame(matrix(sample(24), nrow=4))
dimnames(dat) <-list(rownames=c('g1','g2','g3','g4'), 
colnames=c("A_CH1","A_CH2","B_CH1","B_CH2","C_CH3","C_CH3"))

» dat
  A_CH1 A_CH2 B_CH1 B_CH2 C_CH3 C_CH3
g11624 7 91420
g2 4101922 517
g31118211213 1
g4 2 315 623 8
I am trying to plot them pairwise by column(might extend to more than 
3 pairs)
Instead manually plotting as below, could you please point me out with 
easier ways?

par(mfrow=c(3,1))
plot(dat$A_CH1+dat$A_CH2, dat$A_CH1-dat$A_CH2)
plot(dat$B_CH1+dat$B_CH2, dat$B_CH1-dat$B_CH2)
plot(dat[,5]+dat[,6], dat[,5]-dat[,6])
Thanks a lot for your help
__

[[alternative HTML version deleted]]
__
R-help@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

__
R-help@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


Re: [R] pairewise plots

2005-03-29 Thread Petr Pikal
Hallo

On 29 Mar 2005 at 6:58, Hai Lin wrote:

> Dear R users,
> 
> I have a data generated as the following,
> 
> dat <- data.frame(matrix(sample(24), nrow=4))
> dimnames(dat) <-list(rownames=c('g1','g2','g3','g4'),
> colnames=c("A_CH1","A_CH2","B_CH1","B_CH2","C_CH3","C_CH3"))
> 
> ť dat
>A_CH1 A_CH2 B_CH1 B_CH2 C_CH3 C_CH3
> g11624 7 91420
> g2 4101922 517
> g31118211213 1
> g4 2 315 623 8
> 
> I am trying to plot them pairwise by column(might extend to more than
> 3 pairs) Instead manually plotting as below, could you please point me
> out with easier ways? 
> 
> par(mfrow=c(3,1))

You can use for construction

for(i in c(1,3,5)) plot(dat[,i]+dat[,i+1], dat[,i]-dat[,i+1])

but if you want x or y labels formated differently, you probably 
need to ad some kind of expression in xlab (ylab) parameters.

Cheers
Petr



> plot(dat$A_CH1+dat$A_CH2, dat$A_CH1-dat$A_CH2)
> plot(dat$B_CH1+dat$B_CH2, dat$B_CH1-dat$B_CH2)
> plot(dat[,5]+dat[,6], dat[,5]-dat[,6])
> 
> Thanks a lot for your help
> 
> __
> 
> 
> 
>  [[alternative HTML version deleted]]
> 
> __
> R-help@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

Petr Pikal
[EMAIL PROTECTED]

__
R-help@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


Re: [R] Annotation metadata "kills" help.search

2005-03-29 Thread Seth Falcon
Hi Gerard,

"Gerard Tromp" <[EMAIL PROTECTED]> writes:
> OS: Windows
> R 2.0.1
>
> As of about a week ago the help.search function dies when used in the simple
> help.search("something") usage.
> The error is
> Error in rbind(...) : number of columns of matrices must match (see arg 203)
>
> After some effort I have traced it down to the annotation packages. I
> installed
> GO, KEGG, mgu74[abc]v2 and hgu133plus2 all version 1.7.0

We (the Bioconductor team) will look into this and see if we can
reproduce what you are reporting.  This is the first we've heard of
difficulties with the help system caused by the annotation data
packages.

+ seth

__
R-help@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


RE: [R] pairewise plots

2005-03-29 Thread Liaw, Andy
Something like this should do it:

invisible(lapply(seq(1, length(dat), by=2), 
 function(i) plot(dat[[i]]+dat[[i+1]], dat[[i]] -
dat[[i+1]])))

Andy

> From: Hai Lin
> 
> Dear R users,
>  
> I have a data generated as the following,
>  
> dat <- data.frame(matrix(sample(24), nrow=4))
> dimnames(dat) <-list(rownames=c('g1','g2','g3','g4'), 
> colnames=c("A_CH1","A_CH2","B_CH1","B_CH2","C_CH3","C_CH3"))
>  
> > dat
>A_CH1 A_CH2 B_CH1 B_CH2 C_CH3 C_CH3
> g11624 7 91420
> g2 4101922 517
> g31118211213 1
> g4 2 315 623 8
>  
> I am trying to plot them pairwise by column(might extend to 
> more than 3 pairs) 
> Instead manually plotting as below, could you please point me 
> out with easier ways? 
>  
> par(mfrow=c(3,1))
> plot(dat$A_CH1+dat$A_CH2, dat$A_CH1-dat$A_CH2)
> plot(dat$B_CH1+dat$B_CH2, dat$B_CH1-dat$B_CH2)
> plot(dat[,5]+dat[,6], dat[,5]-dat[,6])
> 
> Thanks a lot for your help
> 
> __
> 
> 
> 
>   [[alternative HTML version deleted]]
> 
> __
> R-help@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
> 
> 
>

__
R-help@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


Re: [R] pairewise plots

2005-03-29 Thread Duncan Murdoch
On Tue, 29 Mar 2005 06:58:51 -0800 (PST), Hai Lin
<[EMAIL PROTECTED]> wrote :

>Dear R users,
> 
>I have a data generated as the following,
> 
>dat <- data.frame(matrix(sample(24), nrow=4))
>dimnames(dat) <-list(rownames=c('g1','g2','g3','g4'), 
>colnames=c("A_CH1","A_CH2","B_CH1","B_CH2","C_CH3","C_CH3"))
> 
>» dat
>   A_CH1 A_CH2 B_CH1 B_CH2 C_CH3 C_CH3
>g11624 7 91420
>g2 4101922 517
>g31118211213 1
>g4 2 315 623 8
> 
>I am trying to plot them pairwise by column(might extend to more than 3 pairs) 
>Instead manually plotting as below, could you please point me out with easier 
>ways? 
> 
>par(mfrow=c(3,1))
>plot(dat$A_CH1+dat$A_CH2, dat$A_CH1-dat$A_CH2)
>plot(dat$B_CH1+dat$B_CH2, dat$B_CH1-dat$B_CH2)
>plot(dat[,5]+dat[,6], dat[,5]-dat[,6])

Your last line gives the hint:

for (i in 1:3) {
  c1 <- dat[,2*i - 1]
  c2 <- dat[,2*i]
  n1 <- colnames(dat)[2*i - 1]
  n2 <- colnames(dat)[2*i]
  plot(c1+c2, c1-c2, main=paste("Pair", i,":",n1, n2))
}

Duncan Murdoch

__
R-help@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


[R] pairewise plots

2005-03-29 Thread Hai Lin
Dear R users,
 
I have a data generated as the following,
 
dat <- data.frame(matrix(sample(24), nrow=4))
dimnames(dat) <-list(rownames=c('g1','g2','g3','g4'), 
colnames=c("A_CH1","A_CH2","B_CH1","B_CH2","C_CH3","C_CH3"))
 
» dat
   A_CH1 A_CH2 B_CH1 B_CH2 C_CH3 C_CH3
g11624 7 91420
g2 4101922 517
g31118211213 1
g4 2 315 623 8
 
I am trying to plot them pairwise by column(might extend to more than 3 pairs) 
Instead manually plotting as below, could you please point me out with easier 
ways? 
 
par(mfrow=c(3,1))
plot(dat$A_CH1+dat$A_CH2, dat$A_CH1-dat$A_CH2)
plot(dat$B_CH1+dat$B_CH2, dat$B_CH1-dat$B_CH2)
plot(dat[,5]+dat[,6], dat[,5]-dat[,6])

Thanks a lot for your help

__



[[alternative HTML version deleted]]

__
R-help@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


[R] Help about PLS

2005-03-29 Thread Caroline TRUNTZER
Dear all,
I would like to use the PLS method to reduce the dimension of my data
because there are much more variables that individuals. I looked at the
pcr.pls package. Do someone know if there is a mean to project a new
individual in  the latent variables space (as supplementary point)?
Thank you for your help
Caroline

__
R-help@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


Re: [R] R-squared in Logistic Regression

2005-03-29 Thread Frank E Harrell Jr
Johan Stenberg wrote:
Dear all,
How do I make R show the R-squared (deviance explained by the model) in
a logistic regression?
Below is how I write my syntax. Basically I want to investigate
density-dependence in parasitism of larvae. Note that in the end I
perform a F-test because the dispersion factor (residual deviance /
residual df) is significantly higher than 1. But how do I make R show
the "R-squared"?
Best wishes
Johan
The proportion of deviance explained has been shown to not be such a 
good measure.  You can use the lrm function in the Design package to get 
various measures including ROC area (C index), Somers' Dxy and Kendall 
tau rank correlation, Nagelkerke generalization of R-squared for maximum 
likelihood-based models (related to Maddala and others).

Frank Harrell

y<-cbind(para,unpara)
model<-glm(y~log(larvae),binomial)
summary(model)

Call:
glm(formula = y ~ log(larvae), family = binomial)
Deviance Residuals:
Min   1Q   Median   3Q  Max
-2.0633  -1.6218  -0.1871   0.7907   2.7670
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept)   1.0025 0.7049   1.422  0.15499
log(larvae)  -1.0640 0.3870  -2.749  0.00597 **
(Dispersion parameter for binomial family taken to be 1)
Null deviance: 35.981  on 12  degrees of freedom
Residual deviance: 27.298  on 11  degrees of freedom
AIC: 40.949
Number of Fisher Scoring iterations: 4

anova(model,test="F")
Analysis of Deviance Table
Model: binomial, link: logit
Response: y
Terms added sequentially (first to last)
Df Deviance Resid. Df Resid. Dev  F   Pr(>F)
NULL   12 35.981
log(larvae)  18.68311 27.298 8.6828 0.003212 **
__
R-help@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

--
Frank E Harrell Jr   Professor and Chair   School of Medicine
 Department of Biostatistics   Vanderbilt University
__
R-help@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


Re: [R] R-squared in Logistic Regression

2005-03-29 Thread Henric Nilsson

On Ti, 2005-03-29, 10:56, Johan Stenberg skrev:

> How do I make R show the R-squared (deviance explained by the model) in
> a logistic regression?

Several definitions of R^2 exists in the GLM case. See e.g.

Menard, S. (2000) Coefficients of determination for multiple logistic
regression analysis. American Statistician, 54, 17-24.

Mittlbock, M. and Schemper, M. (2002) Explained variation for logistic
regression - small sample adjustments, confidence intervals and predictive
precision. Biometrical Journal, 44, 263-272.

Liao, J.G. and McGee, D. (2003) Adjusted coefficients of determination for
logistic regression. American Statistician, 57, 161-165.

IIRC, the last paper contains R code.

HTH,
Henric

__
R-help@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


[R] RE: glmmPQL questions

2005-03-29 Thread Dan Bebber
Jo,

It looks like farm is your level of replication, so you don't need to
specify farm as a random factor. A linear model 'lm' with binomial errors
(a.k.a. logistic regression) is enough. You only need to specify different
error strata if, say, you had sampled each farm several times. Is that what
you mean by 'sampling cluster'?
BUT, there is very likely some spatial dependence among farms, so you will
also need to model this.
If you want to constrain the analysis, check out 'subset'.
Missing values: you have to remove farms with missing values from the
analysis. Look up 'na.omit'.
I think perhaps you need to consult a statistician at the Edinburgh stats
department to get info on the appropriate analyses, as the R-help list is
usually restricted to R-specific questions.
There is a massive amount of literature on agricultural epidemiology (esp.
following foot & mouth), so read up to see what has been done before.

Cheers,
Dan Bebber

Department of Plant Sciences
University of Oxford
South Parks Road
Oxford OX1 3RB



>
> Message: 4
> Date: Mon, 28 Mar 2005 12:06:25 +0100
> From: JEB Halliday <[EMAIL PROTECTED]>
> Subject: [R] glmmPQL questions
> To: r-help@stat.math.ethz.ch
> Message-ID: <[EMAIL PROTECTED]>
> Content-Type: text/plain; charset=ISO-8859-15
>
>
> I am looking a risk factors for disease in cattle and am
> interested in modelling
> farm and sampling cluster as random effects (My outcome is
> positive or negative
> at the level of the farm).  I am using R version 2.0.1 on a Mac and have
> identified glmmPQL as hopefully the correct function to use. I have run a
> couple of models using this but was hoping that you might be able
> to answer a
> few questions.
>
> e.g. model<-glmmPQL(farmstatus~cattlenumber,random~1|farm,binomial)
>
> I am pretty new to both R and stats so if these questions are
> very simple and I
> am just missing something, suggestions about good texts on GLMM
> in R would be
> great.
>
> First up, what is the best way to constrain the model to only
> look at certain
> levels of a multi-level factor e.g. a categorisation of cattle
> number where all
> points of high influence
>
> (as determined using: summary(influence.measures(model)) )
>
> are confined to the largest class (D) and I want to run the model
> which just
> looks at levels A,B and C? (or only months May-September..)
>
> I was also wondering about the best way to force specified
> variables to remain
> in the model when running e.g. stepwise selection of interaction terms?
>
> Finally, is there is a recognised method for dealing with missing
> values in
> these models?
> and as a minor point the models do not run unless i specify the
> data= part of
> the syntax and as this is apparently an optional piece of
> information I was
> wondering why this is required when all of my variables are in
> the same data
> frame (and even when this data frame is attached?)
>
> Any help would be greatly appreciated
>
> Jo Halliday
> MSc student
> University of Edinburgh
> [EMAIL PROTECTED]
>

__
R-help@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


RE: [R] strange result of acos

2005-03-29 Thread Ted Harding
On 29-Mar-05 Ted Harding wrote:
> The explanation is:
> 
> sin(10.74*pi/180)**2
> +(cos(10.74*pi/180)*cos(10.74*pi/180)
> *cos(0*pi/180))
> -1
> 
> [1] 2.220446e-16
> 
> I.e. the expression, as internally evaluated, is very
> slightly greater than 1. When you multiply ss by
> 0.9, you bring it back down a bit.
> 
> Theoretically, of course, it is sin(t)^2 + cos(t)^2,
> which should be exactly 1, but you can't count on it
> in digital computation. As you suspected, it is indeed
> a question of precision.

Just to make more explicit what's happening here:

t<-0.01*(0:200)*pi

sin(t)^2 + cos(t)^2 -1
##[output omitted]

unique(sin(t)^2 + cos(t)^2 -1)
##[1]  0.00e+00 -1.110223e-16  2.220446e-16

2^(-53)
##[1] 1.110223e-16

so the error is either +2^(-52) or -2^(-53)

Best wishes,
Ted.



E-Mail: (Ted Harding) <[EMAIL PROTECTED]>
Fax-to-email: +44 (0)870 094 0861
Date: 29-Mar-05   Time: 12:27:11
-- XFMail --

__
R-help@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


RE: [R] strange result of acos

2005-03-29 Thread Ted Harding
On 29-Mar-05 Klaus-Peter Pleissner wrote:
> Hi all,
> I have to calculate an expression using acos -function.
> A strange result of acos appears
> 
> *1. case with error*
> 
> ss <- sin(10.74*pi/180)**2 
> +(cos(10.74*pi/180)*cos(10.74*pi/180)*cos(0*pi/180))
>  ss
>  acos(ss)
> 
> [1] NaN
> Warning message:
> NaNs produced in: acos(ss)
> 
> *2. case without  error*
> 
>  ss <- sin(10.7*pi/180)**2 
> +(cos(10.7*pi/180)*cos(10.7*pi/180)*cos(0*pi/180))
>  ss
>  acos(ss)
> 
> In both cases the variable ss equals 1. I  think there
> is a problem with precision. If I multiply ss  by
> 0.9 (ss*0.) no error occurs. How the
> results can be explained ?

The explanation is:

sin(10.74*pi/180)**2
+(cos(10.74*pi/180)*cos(10.74*pi/180)
*cos(0*pi/180))
-1

[1] 2.220446e-16

I.e. the expression, as internally evaluated, is very
slightly greater than 1. When you multiply ss by
0.9, you bring it back down a bit.

Theoretically, of course, it is sin(t)^2 + cos(t)^2,
which should be exactly 1, but you can't count on it
in digital computation. As you suspected, it is indeed
a question of precision.

Best wishes,
Ted.



E-Mail: (Ted Harding) <[EMAIL PROTECTED]>
Fax-to-email: +44 (0)870 094 0861
Date: 29-Mar-05   Time: 11:59:28
-- XFMail --

__
R-help@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


[R] strange result of acos

2005-03-29 Thread Klaus-Peter Pleissner
Hi all,
I have to calculate an expression using acos -function.  A strange 
result of acos appears

*1. case with error*
ss <- sin(10.74*pi/180)**2 
+(cos(10.74*pi/180)*cos(10.74*pi/180)*cos(0*pi/180))
ss
acos(ss)

[1] NaN
Warning message:
NaNs produced in: acos(ss)
*2. case without  error*
ss <- sin(10.7*pi/180)**2 
+(cos(10.7*pi/180)*cos(10.7*pi/180)*cos(0*pi/180))
ss
acos(ss)


In both cases the variable ss equals 1.   I  think there is a problem 
with precision. If I multiply ss  by 0.9  (ss*0.) no 
error occurs.  How  the results can be explained ?

Regards
Klaus-P.

--
Dr. Klaus-Peter Pleissner
Max Planck Institute for Infection Biology
Core Facility Bioinformatics
Campus Charité Mitte
Schumannstr. 21/22
D-10117 Berlin
Germany
*Phone:* +49-30-28460-119
*Fax:*   +49-30-28460-507
*URL:*   http://web.mpiib-berlin.mpg.de/bioinformatik 

*Email:* [EMAIL PROTECTED]  
__
R-help@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


[R] Plot Moran's I

2005-03-29 Thread Chloe ARCHINARD
Hello all,
I'm a new user of R and I have used the spdep package to calculate Moran's I 
estimates. I used the dnearneigh() function and moran.test() function and 
obtained what I wanted, but now I want to plot my results with the p-values. I 
regrouped my results for the Moran's I like 
>m=c(m1$e,m2$e...)#m1 contain the results of the moran.test for lag1
>p=c(m1$p.v,m2$p.v...)
The problem is that in mx$e there are three values (moran'I statistic, 
expectation and variance) and when I plot my results I plot all the three 
values for each lag. What should I do to choose only the statistic for plotting 
and maybe the variance for each I statistic?
(For the p-value it's ok I have found how to differentiate the significant and 
non significant values.)
I hope someone understand my question and could help me!
Thanks a lot.

Chloé ARCHINARD
Centre d'Ecologie Fonctionnelle et Evolutive
(C.N.R.S.-U.M.R. 5175)
1919, Route de Mende
34293 Montpellier Cedex 5 France
[EMAIL PROTECTED]

-- 
passerelle antivirus du campus CNRS de Montpellier
--



[[alternative HTML version deleted]]

__
R-help@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


Re: [R] mixed model question

2005-03-29 Thread Dimitris Rizopoulos
probably you could fit this model using the 'varIdent()' function for 
the 'weights' argument of the 'lme()' function in package "nlme".

I hope it helps.
Best,
Dimitris

Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/16/336899
Fax: +32/16/337015
Web: http://www.med.kuleuven.ac.be/biostat/
http://www.student.kuleuven.ac.be/~m0390867/dimitris.htm
- Original Message - 
From: "Benn Fine" <[EMAIL PROTECTED]>
To: 
Sent: Monday, March 28, 2005 10:06 PM
Subject: [R] mixed model question


I am trying to fit a linear mixed model of the form
y_ij = X_ij \beta + delta_i + e_ij
where e_ij ~N(0,s^2_ij) with s_ij known
and delta_i~N(0,tau^2)
I looked at the ecme routine in package:pan, but this routine
does not allow for different Vi (variance covariance matrix of
the e_i vector) matrices for each cluster.
Is there an easy way to fit this model in R or should I bite the
bullet and code the likelihood functions ?
Also, is there an easy way to fit a Bayesian version of this ? Again
there is mgibbs.lmm but it also does not allow easily for a 
different
Vi matrix for each cluster/.

Thanks,
Benn

-
[[alternative HTML version deleted]]
__
R-help@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

__
R-help@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


[R] R-squared in Logistic Regression

2005-03-29 Thread Johan Stenberg
Dear all,

How do I make R show the R-squared (deviance explained by the model) in
a logistic regression?

Below is how I write my syntax. Basically I want to investigate
density-dependence in parasitism of larvae. Note that in the end I
perform a F-test because the dispersion factor (residual deviance /
residual df) is significantly higher than 1. But how do I make R show
the "R-squared"?

Best wishes
Johan

> y<-cbind(para,unpara)
> model<-glm(y~log(larvae),binomial)
> summary(model)

Call:
glm(formula = y ~ log(larvae), family = binomial)

Deviance Residuals:
Min   1Q   Median   3Q  Max
-2.0633  -1.6218  -0.1871   0.7907   2.7670

Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept)   1.0025 0.7049   1.422  0.15499
log(larvae)  -1.0640 0.3870  -2.749  0.00597 **

(Dispersion parameter for binomial family taken to be 1)

Null deviance: 35.981  on 12  degrees of freedom
Residual deviance: 27.298  on 11  degrees of freedom
AIC: 40.949

Number of Fisher Scoring iterations: 4

> anova(model,test="F")
Analysis of Deviance Table

Model: binomial, link: logit

Response: y

Terms added sequentially (first to last)


Df Deviance Resid. Df Resid. Dev  F   Pr(>F)
NULL   12 35.981
log(larvae)  18.68311 27.298 8.6828 0.003212 **

__
R-help@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