Re: [R] ERROR: installing package indices failed

2004-11-19 Thread Prof Brian Ripley
On Fri, 19 Nov 2004, Sigal Blay wrote:
Dear R-helpers,
I am developing a package named LDehatmap.
It depends on the "genetics" package
and includes two data files and a demo file.
When I'm trying to install it, I get the following messages:
* Installing *source* package 'LDheatmap' ...
** R
** data
** demo
** help
>>> Building/Updating help pages for package 'LDheatmap'
Formats: text html latex example
 LDheatmaptexthtmllatex   example
 ldheatmaptexthtmllatex   example
Error: object 'reorder' not found whilst loading namespace 'gdata'
Error: package 'gdata' could not be loaded
Execution halted
ERROR: installing package indices failed
Any ideas?
Yes.  You do not have gdata (part of gregmisc) installed, and genetics 
depends on it.  How did you get genetics installed? A binary install?

Install gregmisc 
--
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595
__
[EMAIL PROTECTED] 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] subset on data frame

2004-11-19 Thread Thomas Lumley
On Fri, 19 Nov 2004, Lei Jiang wrote:
I have a data frame. And I'd like to subset according to rownames.
subset(mydataframe, rownames(mydataframe) == myrow, select = mycols)
it turned out that "myrow" cannot be a vector. But I have multiple rows to 
pick. Is there a way to get around this problem??

?"%in%"
-thomas
__
[EMAIL PROTECTED] 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] subset on data frame

2004-11-19 Thread Lei Jiang
I have a data frame. And I'd like to subset according to rownames.
subset(mydataframe, rownames(mydataframe) == myrow, select = mycols)
it turned out that "myrow" cannot be a vector. But I have multiple rows to 
pick. Is there a way to get around this problem??

Thank you for your help!!
Lei Jiang
Department of Chemsitry
University of Washington
Box 351700
Seattle, WA 98195
Phone: 206-616-6882
Fax: 206-685-8665
__
[EMAIL PROTECTED] 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] annotation problems (conditional text())

2004-11-19 Thread Johannes Graumann
Hello,

I'm trying to annotate my plots nicely and am running into trouble.
This example contains two problems:
a) the 'text()' arguments do not show the conditional behavior I'm
trying to give them. I try to test for the intercept of my regression
and reformat the output accordingly ('+ intercept' in the >= 0 case and
'- sqrt(intercept^2)' in the other case), which doesn't work this way.
b) my pasted substitute commands yield jolted output, which overwrites
itself ...

Can anyone give this newbie a nudge into the right direction?

Thanks, Joh

if(m >= 0){
  text(
4,0.19,
cex=0.75,
adj=0,
paste(
  substitute(
y == m*x+b,
list(
  m=round(m,digits=5),
  b=round(b,digits=5)
)
  ),
  "\n",
  substitute(
R^2==rsquared,
list(
  rsquared=round(summary(fit)$r.squared,digits=3)
)
  )
)
  );
  text(
4,0.19,
cex=0.75,
adj=0,
paste(
  substitute(
y == m*x-b,
list(
  m=round(m,digits=5),
  b=round(sqrt(b^2),digits=5)
)
  ),
  "\n",
  substitute(
R^2==rsquared,
list(
  rsquared=round(summary(fit)$r.squared,digits=3)
)
  )
)
  )
}

__
[EMAIL PROTECTED] 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] Running sum

2004-11-19 Thread Marc Schwartz
On Fri, 2004-11-19 at 18:00 -0600, Douglas Bates wrote:

> I have forgotten the details of the original question but it seems to me 
> that if the elements of x could be both positive and negative then the 
> maximum of the cumulative sum doesn't have to be the last sum.

On Fri, 2004-11-19 at 20:00 -0400, Kjetil Brinchmann Halvorsen wrote:

> Please, Please, please, ... was it ever said that the numbers was only 
> positive?


Thanks to both Doug and Kjetil.

I stand corrected.

Marc

__
[EMAIL PROTECTED] 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] Rd and document formatting

2004-11-19 Thread Duncan Murdoch
On Fri, 19 Nov 2004 15:48:11 -0600, Mark Strivens
<[EMAIL PROTECTED]> wrote:

>Thanks Duncan,
>
>I really know nothing about Latex - however the macro you detailed
>below does not exist in the file: /usr/lib/R/share/texmf/Rd.sty
>
>The header of that file reads:
>
>%%% Rd.sty ... Style for printing the R manual
>%%%
>%%% Modified 1998/01/05 by [EMAIL PROTECTED]
>%%% Modified 1998/07/07 by Martin Maechler
>%%% Modified 1999/11/20 by Brian Ripley
>%%% Modified 1999/12/26 by Kurt Hornik
>
>My R version is 1.8.0 - can update the support files (like Rd.sty) 
>without doing
>a total R upgrade?

I don't know, but my instinct would be to avoid mixing files from
different versions.  What you have is a pretty old version, which had
a pretty long list of bugs that were fixed in 1.8.1.  I'd really
strongly recommend upgrading at least to there, and preferably to
2.0.1.  

Duncan Murdoch

__
[EMAIL PROTECTED] 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] Running sum

2004-11-19 Thread Douglas Bates
Marc Schwartz wrote:
On Fri, 2004-11-19 at 16:44 -0600, hadley wickham wrote:
Perhaps I'm missing something, but isn't the maximum of the cumulative
sum simply the last value, ie. sum(x)?
Hadley

Indeed!
And...going back to Sean's original post he did write:
"I just need max(Y)."
Thus, a whole group of us (independently) managed to over-engineer the
solution. 

Presuming of course, that Sean does not require the entire cumulative
sum vector for other purposes.
I wonder what that says about human cognition
Thanks,
Marc

I have forgotten the details of the original question but it seems to me 
that if the elements of x could be both positive and negative then the 
maximum of the cumulative sum doesn't have to be the last sum.

__
[EMAIL PROTECTED] 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] Running sum

2004-11-19 Thread Kjetil Brinchmann Halvorsen
Marc Schwartz wrote:
On Fri, 2004-11-19 at 16:44 -0600, hadley wickham wrote:
 

Perhaps I'm missing something, but isn't the maximum of the cumulative
sum simply the last value, ie. sum(x)?
Hadley
   


Indeed!
And...going back to Sean's original post he did write:
"I just need max(Y)."
Thus, a whole group of us (independently) managed to over-engineer the
 

Please, Please, please, ... was it ever said that the numbers was only 
positive?

Kjetil
solution. 

Presuming of course, that Sean does not require the entire cumulative
sum vector for other purposes.
I wonder what that says about human cognition
Thanks,
Marc

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
 


--
Kjetil Halvorsen.
Peace is the most effective weapon of mass construction.
  --  Mahdi Elmandjra
__
[EMAIL PROTECTED] 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] Running sum

2004-11-19 Thread Marc Schwartz
On Fri, 2004-11-19 at 16:44 -0600, hadley wickham wrote:
> Perhaps I'm missing something, but isn't the maximum of the cumulative
> sum simply the last value, ie. sum(x)?
> 
> Hadley


Indeed!

And...going back to Sean's original post he did write:

"I just need max(Y)."

Thus, a whole group of us (independently) managed to over-engineer the
solution. 

Presuming of course, that Sean does not require the entire cumulative
sum vector for other purposes.

I wonder what that says about human cognition

Thanks,

Marc


__
[EMAIL PROTECTED] 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] Running sum

2004-11-19 Thread hadley wickham
Perhaps I'm missing something, but isn't the maximum of the cumulative
sum simply the last value, ie. sum(x)?

Hadley

__
[EMAIL PROTECTED] 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] Rd and document formatting

2004-11-19 Thread Uwe Ligges
Mark Strivens wrote:
Thanks Duncan,
I really know nothing about Latex - however the macro you detailed
below does not exist in the file: /usr/lib/R/share/texmf/Rd.sty
The header of that file reads:
%%% Rd.sty ... Style for printing the R manual
%%%
%%% Modified 1998/01/05 by [EMAIL PROTECTED]
%%% Modified 1998/07/07 by Martin Maechler
%%% Modified 1999/11/20 by Brian Ripley
%%% Modified 1999/12/26 by Kurt Hornik
My R version is 1.8.0 - can update the support files (like Rd.sty) 
without doing
a total R upgrade?
Please, do upgrade! You will also get problems when updating packages.
BTW: You should have told about your completely outdated R version in 
your first question!

Uwe Ligges

Thanks for your help
Mark
I am trying to compose some documentation for a package I hope to 
release soon.

However when I do the following:
R CMD Rd2dvi --pdf mypackage.Rd
I get two mainly blank pages prepended to the top of the document - 
the only text on either (at the top of the first page) is as follows:
hyperindex,colorlinks,pagebackref,linktocpage,plainpages=false,linkcolor=Blue 

,citecolor=Blue,urlcolor=Red,pdnull null null
Curiously if you generate the dvi it is fine and if you generate the 
pdf from the dvi using dvipdf it is also fine...

Anyone got any ideas?
System: Linux 2.4.24 SMP i686 GNU/Linux, latex 3.14159-2.1 pdfTex 3.4.5
  

Looks like some LaTeX package is out of date, and doesn't understand
some of the tex that got generated.  Rd.sty has this:
 \hypersetup{%
   hyperindex,%
   colorlinks,%
   pagebackref,%
   linktocpage,%
   plainpages=false,%
   linkcolor=Blue,%
   citecolor=Blue,%
   urlcolor=Red,%
   pdfstartview=Fit,%
   pdfview={XYZ null null null}%
 }
so I think your system doesn't have the \hypersetup macro defined (or
maybe you're using an out of date Rd.sty or hyperref.sty?)
Duncan Murdoch
 

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! 
http://www.R-project.org/posting-guide.html
__
[EMAIL PROTECTED] 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] ERROR: installing package indices failed

2004-11-19 Thread Sigal Blay
Dear R-helpers,

I am developing a package named LDehatmap.
It depends on the "genetics" package
and includes two data files and a demo file.
When I'm trying to install it, I get the following messages:

* Installing *source* package 'LDheatmap' ...
** R
** data
** demo
** help
 >>> Building/Updating help pages for package 'LDheatmap'
 Formats: text html latex example
  LDheatmaptexthtmllatex   example
  ldheatmaptexthtmllatex   example
Error: object 'reorder' not found whilst loading namespace 'gdata'
Error: package 'gdata' could not be loaded
Execution halted
ERROR: installing package indices failed

Any ideas?
 
Thanks,
  
Sigal

__
[EMAIL PROTECTED] 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] Difference between two correlation matrices

2004-11-19 Thread Fernando Henrique Ferraz P. da Rosa
  er.. forgot to attach the file. there it goes. (sorry)

michael watson (IAH-C) writes:
> Hi 
> 
> Now a more theoretical question.  I have two correlation matrices - one
> of a set of variables under a particular condition, the other of the
> same set of variables under a different condition.  Is there a
> statistical test I can use to see if these correlation matrices are
> "different"?
> 
> Thanks
> Mick
> 
> __
> [EMAIL PROTECTED] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
> 
> 
--
Fernando Henrique Ferraz P. da Rosa
http://www.ime.usp.br/~feferraz
varcomp <- function(covmat,n) {
   if (is.list(covmat)) {
if (length(covmat) < 2) 
stop("covmat must be a list with at least 2 elements")
ps <- as.vector(sapply(covmat,dim))
if (sum(ps[1] == ps) != length(ps))
stop("all covariance matrices must have the same dimension")
p <- ps[1]  
q <- length(covmat)
if (length(n) == 1)
Ng <- rep(n,q)
else if (length(n) == q) 
Ng <- n
else 
stop("n must be equal length(covmat) or 1")

DNAME <- deparse(substitute(covmat))
   }

   else
stop("covmat must be a list")

   ng <- Ng - 1
   Ag <- lapply(1:length(covmat),function(i,mat,n) { n[i] * mat[[i]] 
},mat=covmat,n=ng)
   A <- matrix(colSums(matrix(unlist(Ag),ncol=p^2,byrow=T)),ncol=p)
   detAg <- sapply(Ag,det)
   detA <- det(A)
   V1 <- prod(detAg^(ng/2))/(detA^(sum(ng)/2))
   kg <- ng/sum(ng)
   l1 <- prod((1/kg)^kg)^(p*sum(ng)/2) * V1
   rho <- 1 - (sum(1/ng) - 1/sum(ng))*(2*p^2+3*p-1)/(6*(p+1)*(q-1))
   w2 <- p*(p+1) * ((p-1)*(p+2) * (sum(1/ng^2) - 1/(sum(ng)^2)) - 
6*(q-1)*(1-rho)^2) / (48*rho^2)
   f <- 0.5 * (q-1)*p*(p+1)
   STATISTIC <- -2*rho*log(l1)
   PVAL <- 1 - (pchisq(STATISTIC,f) + w2*(pchisq(STATISTIC,f+4) - 
pchisq(STATISTIC,f)))
   names(STATISTIC) <- "corrected lambda*"
   names(f) <- "df"
   RVAL <- structure(list(statistic = STATISTIC, parameter = f,p.value = PVAL, 
data.name = DNAME, method = "Equality of Covariances Matrices 
Test"),class="htest")
   return(RVAL)
}
__
[EMAIL PROTECTED] 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] Difference between two correlation matrices

2004-11-19 Thread Fernando Henrique Ferraz P. da Rosa
michael watson (IAH-C) writes:
> Hi 
> 
> Now a more theoretical question.  I have two correlation matrices - one
> of a set of variables under a particular condition, the other of the
> same set of variables under a different condition.  Is there a
> statistical test I can use to see if these correlation matrices are
> "different"?
> 
> Thanks
> Mick
> 


If you can assume multivariate normality, you can use a test of
hypothesis to test if the covariance+ matrices are equal. Such a test is
described for example in Anderson (1958)*.

I am currently working on implementing some multivariate tests
on R (sphericity test, equality of covariance matrices, etc). Attached
follows a preliminary version of varcomp(): this function implements the
test for equality of covariance matrices under multivare normality
aforementioned. It takes as first argument a list with the covariance
matrices and a vector n indicating the sample size used to calculate
each of them.

Example of use: Suppose you have 3 estimated covariance matrices
S1, S2, S3, from a sample of 3 bivariate normal populations with unkown
covariance matrices. The sample size for each Si, was 11,12,11.

S1 <- matrix(c(7.17,19.47,19.47,113.38),byrow=T,ncol=2)
S2 <- matrix(c(20.33,59.78,59.78,229.02),byrow=T,ncol=2)
S3 <- matrix(c(5.22,17.33,17.33,112.88),byrow=T,ncol=2)
varcomp(list(S1,S2,S3),n=c(11,12,11))


  Will test H0: Sigma1 = Sigma2 = Sigma3, vs. H1: at least two of
them are different from each other. 

Beware though that it's still work in progress, I've tested it
for a few examples and it gave sensible results, but it still needs some
polishing.

* An Introduction to Multivariate Analysis, Wiley.
+ note that a correlation matrix is a special type of a covariance
matrix, so you can use a test of hypothesis designed for covariance
matrices. 


--
Fernando Henrique Ferraz P. da Rosa
http://www.ime.usp.br/~feferraz

__
[EMAIL PROTECTED] 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] The hidden costs of GPL software?

2004-11-19 Thread Cliff Lunneborg
Could I voice my support for the sixth point raised by John Fox? Many
users would find such a development to be enormously useful.


"  (6) As has been pointed out, e.g., by Duncan Murdoch, solving the
function-locating problem is best done by a method or methods that
automatically accommodate the growing and changing set of contributed
packages on CRAN.  Why not, as previously has been proposed, replace the
current static (and, in my view, not very useful) set of keywords in R
documentation with the requirement that package authors supply their own
keywords for each documented object? I believe that this is the intent
of
the concept entries in Rd files, but their use certainly is not required
or
even actively encouraged. (They're just mentioned in passing in the
Writing
R Extensions manual.)"


**
Cliff Lunneborg, Professor Emeritus, Statistics &
Psychology, University of Washington, Seattle
[EMAIL PROTECTED]

__
[EMAIL PROTECTED] 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: 3d Map with bars

2004-11-19 Thread partha_bagchi
Thanks for reply. I need to first draw the map of USA a perspective plot. 
I guess thats where my problem was.

Partha





Uwe Ligges <[EMAIL PROTECTED]>
11/19/2004 04:33 PM

 
To: [EMAIL PROTECTED]
cc: [EMAIL PROTECTED]
Subject:Re: 3d Map with bars


[EMAIL PROTECTED] wrote:

> Apologies in advance for the question. I am trying to draw a map of the 
US
> as a surface plot so that I would be able to drop bars on the different
> states (something like Uwe Ligges' scatterplot3d example 4). I am not 
sure
> where to start looking for such a beast. If anyone has any pointers,
> ideas, I will be grateful.
>
> TIA,
> Partha

How to "drop bars" with persp() has been described on R-help yesterday
or today, please check the mailing list's archives.

Uwe Ligges

__
[EMAIL PROTECTED] 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] Rd and document formatting

2004-11-19 Thread Mark Strivens
Thanks Duncan,
I really know nothing about Latex - however the macro you detailed
below does not exist in the file: /usr/lib/R/share/texmf/Rd.sty
The header of that file reads:
%%% Rd.sty ... Style for printing the R manual
%%%
%%% Modified 1998/01/05 by [EMAIL PROTECTED]
%%% Modified 1998/07/07 by Martin Maechler
%%% Modified 1999/11/20 by Brian Ripley
%%% Modified 1999/12/26 by Kurt Hornik
My R version is 1.8.0 - can update the support files (like Rd.sty) 
without doing
a total R upgrade?

Thanks for your help
Mark
I am trying to compose some documentation for a package I hope to release 
soon.

However when I do the following:
R CMD Rd2dvi --pdf mypackage.Rd
I get two mainly blank pages prepended to the top of the document - the only 
text on either (at the top of the first page) is as follows:
hyperindex,colorlinks,pagebackref,linktocpage,plainpages=false,linkcolor=Blue
,citecolor=Blue,urlcolor=Red,pdnull null null

Curiously if you generate the dvi it is fine and if you generate the pdf from 
the dvi using dvipdf it is also fine...

Anyone got any ideas?
System: Linux 2.4.24 SMP i686 GNU/Linux, latex 3.14159-2.1 pdfTex 3.4.5
   

Looks like some LaTeX package is out of date, and doesn't understand
some of the tex that got generated.  Rd.sty has this:
 \hypersetup{%
   hyperindex,%
   colorlinks,%
   pagebackref,%
   linktocpage,%
   plainpages=false,%
   linkcolor=Blue,%
   citecolor=Blue,%
   urlcolor=Red,%
   pdfstartview=Fit,%
   pdfview={XYZ null null null}%
 }
so I think your system doesn't have the \hypersetup macro defined (or
maybe you're using an out of date Rd.sty or hyperref.sty?)
Duncan Murdoch
 

__
[EMAIL PROTECTED] 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] function 'vcov' for coxph in R 2.0.0

2004-11-19 Thread Uwe Ligges
Lei Liu wrote:
Hi there,
After I fitted a cox model, I used vcov to obtain the variance of the 
parameter estimate. It worked correctly in R 1.9.1. But it failed in R 
2.0.0 and the error message is
Error in vcov(cox.1) : no applicable method for "vcov"
Please give us details and read the posting guide.
The first thing we can guess is that you are using function coxph() from 
package "survival". Is this correct?

If yes, the following extended exmaple from ?coxph works perfectly for 
me in R-2.0.1:

test1 <- list(time=  c(4, 3,1,1,2,2,3),
status=c(1,NA,1,0,1,1,0),
x= c(0, 2,1,1,1,0,0),
sex=   c(0, 0,0,0,1,1,1))
vcov(coxph( Surv(time, status) ~ x + strata(sex), test1))
Uwe Ligges

I don't know if it is a bug or there is some update on this function. 
Thanks!

Lei Liu
Assistant Professor
Division of Biostatistics and Epidemiology
Dept. of Health Evaluation Sciences
School of Medicine
University of Virginia
3181 Hospital West Complex
Charlottesville, VA 22908-0717
1-434-982-3364 (o)
1-734-730-1395 (c)
[EMAIL PROTECTED]
[EMAIL PROTECTED]
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! 
http://www.R-project.org/posting-guide.html
__
[EMAIL PROTECTED] 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] Running sum

2004-11-19 Thread Marc Schwartz
On Fri, 2004-11-19 at 21:10 +0100, Philippe Grosjean wrote:
> ?cumsum is not exactly the answer (as I understand it), but a part of it.
> I propose:
> 
> runSum2 <- function(x)
>   cumsum(x)[-1] - c(0, cumsum(x[1:(length(x) - 2)]))
> 
> # Example
> a <- round(runif(10, 0, 10))
> a
> runSum2(a)
> max(runSum2(a)) # To get only the max


Phillipe, 

If you run Sean's original function for 1:10, you get:

X <- 1:10
Y <- vector(length = 10)
Y[1] <- X[1]

for (i in 2:10)
{
   Y[i] <- Y[i-1] + X[i]
}

> Y
 [1]  1  3  6 10 15 21 28 36 45 55

which is equivalent to cumsum(1:10)


Your function yields:

> runSum2(1:10)
[1]  3  5  7  9 11 13 15 17 19

Which is the sum of successive individual pairs of vector elements.

For future reference, the running() function in the gregmisc bundle's
gtools package offers a more general approach to 'moving window'
functions:

> running(1:10, width = 2, fun = sum)
 1:2  2:3  3:4  4:5  5:6  6:7  7:8  8:9 9:10 
   3579   11   13   15   17   19 


Best regards,

Marc Schwartz

__
[EMAIL PROTECTED] 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] adjusting the map of France to 1830

2004-11-19 Thread Stephane DRAY
Hello Michael,
you have made a small mystake in your code:
use
gfrance <-map.text('france', regions=depts, add=FALSE)
But I think that, it would be quite difficult to do what you need in R.
It is more a GIS problem.
I think that your problem can be better treated if you can create your map 
outside R and import it.
The map is freely available at:
http://www.ign.fr/affiche_rubrique.asp?rbr_id=1761&lng_id=FR#71023
it contains administrative numbers... You can modify the map in a GIS, 
(e.g. ArcView) and import it with maptools package.

Tell me if you can do the GIS part, otherwise I can do the job (it is is 
not too long ;-) ) and send you the "old france" data !

Sincerely,

At 15:59 19/11/2004, you wrote:
Here's what I tried.   I can plot a selection of regions, but I
can't seem to remove an arbitrary list of region numbers, unless I've done 
something wrong
by selecting the regions I want to plot with departements[-exclude].
I also get an error
when I try to use map.text to label a map with only the regions I'm
selecting.

> departements <- map('france',namesonly=T, plot=FALSE)
> # returns a vector of names of regions
>
> exclude <- c(47,  #Alpes-Maritimes
+ 66,  # Haute-Savoie
+ 76,  # Savoie
+ 95,  # Territore-de-Belfort
+ 109, 110, 111, # Var: Iles d'Hyeres
+ 49, 53, 54, 55, # Moribhan: Isles
+ 62, 64,# Vendee: Isles
+ 72, 75 # Charente-Maritime: Isles
+ )
>
> depts <- departements[-exclude]
> gfrance <-map('france', regions=depts)
> labels <- (as.character(1:length(departements)))[-exclude]
> gfrance <-map.text('france', regions=depts, add=FALSE, labels=labels)
Error in map.text("france", regions = depts, add = FALSE, labels = labels) :
   map object must have polygons (fill=TRUE)
Another problem, potentially more difficult for mapping data on the map of 
France is that
the "departements" are actually just the polygons in the map, arbitrarily 
numbered from
east to west, and from north to south --- they don't correspond to the 
'official' administrative
region numbers.  As well, the departement names don't always match exactly 
(ignoring
accents, e.g., Val-d'Oise vs. Val-Doise) so it would be another challenge 
to plot my
historical data on the map of France.

-Michael
Stephane DRAY wrote:
Hello. I do not know if you can merge polygons, but you can select easily:
> departements=map('france',namesonly=T) # returns a vector of names of 
regions
> map('france',regions=departements[1:20],namesonly=T) # use what you 
need with regions argument

Hope this helps,
At 16:29 18/11/2004, Michael Friendly wrote:
I'm doing some analyses of historical data from France in 1830 on 'moral 
statistics' that I'd like to
show on a map.  I've done most of my analyses in SAS, but a few things 
would work better in R.
To do this, I have to adjust the modern map,

library(maps)
map('france')
to adjust for changes in departments (86 in 1830, to 97 now).  I've read 
the documentation
for the maps and maptools package, but there seems to be no functions to 
allow this, and
I can't find information on the exact structure of map datasets, but I 
understand them to
be delimited lists of polygon coordinates.

In SAS, all maps have (one or more) ID variables representing the 
geographical region,
and there is also a proc gremove that can remove internal boundaries 
inside the polygons
for regions with the same ID.  Is there some way I can do this in R?

Here's what I did in SAS:
*-- Fix the map of France to conform to Guerry:
   - adjust the 97 current departments to correspond to the 86 in 1830
   - delete those not part of France then
;
data gfrtemp;
   set maps.france;
   /* Corse was one dept - merge these to one area, new ID */
   if id in (201, 202)then dept=200;
   /* Seine et Oise (78) was cut into
   Essonne (91), Val d'Oise (95) and Yvelines (78) */
   else if id in (91, 95)then dept=78;
   /* Seine (75) now split into
   Hauts-de-Seine (92), Seine-Saint-Denis (93) et Val-de-Marne (94)*/
   else if id in (92, 93, 94)then dept=75;
/* departments not part of France in 1830 */
   else if id in (
   6, /* Alpes-Maritimes */
   73,74, /* Savoie, Haute-Savoie */
   90)/* Territore-de-Belfort */
   then delete;
   else   dept=id;
   run;
*-- remove internal boundaries based on merged DEPT;
proc sort data=gfrtemp;
   by dept;
proc gremove data=gfrtemp out=gfrance;
  by dept;
  id id;
  run;

--
Michael Friendly Email: [EMAIL PROTECTED] Professor, Psychology Dept.
York University  Voice: 416 736-5115 x66249 Fax: 416 736-5814
4700 Keele Streethttp://www.math.yorku.ca/SCS/friendly.html
Toronto, ONT  M3J 1P3 CANADA
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! 
http://www.R-project.org/posting-guide.html

Stéphane DRAY
-- 

Département des Sciences

[R] Re: 3d Map with bars

2004-11-19 Thread Uwe Ligges
[EMAIL PROTECTED] wrote:
Apologies in advance for the question. I am trying to draw a map of the US 
as a surface plot so that I would be able to drop bars on the different 
states (something like Uwe Ligges' scatterplot3d example 4). I am not sure 
where to start looking for such a beast. If anyone has any pointers, 
ideas, I will be grateful.

TIA,
Partha
How to "drop bars" with persp() has been described on R-help yesterday 
or today, please check the mailing list's archives.

Uwe Ligges
__
[EMAIL PROTECTED] 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] Rd and document formatting

2004-11-19 Thread Duncan Murdoch
On Fri, 19 Nov 2004 14:46:14 -0600, strivens <[EMAIL PROTECTED]>
wrote :

>I am trying to compose some documentation for a package I hope to release 
>soon.
>
>However when I do the following:
>
>R CMD Rd2dvi --pdf mypackage.Rd
>
>I get two mainly blank pages prepended to the top of the document - the only 
>text on either (at the top of the first page) is as follows:
> hyperindex,colorlinks,pagebackref,linktocpage,plainpages=false,linkcolor=Blue
>,citecolor=Blue,urlcolor=Red,pdnull null null
>
>Curiously if you generate the dvi it is fine and if you generate the pdf from 
>the dvi using dvipdf it is also fine...
>
>Anyone got any ideas?
>
>System: Linux 2.4.24 SMP i686 GNU/Linux, latex 3.14159-2.1 pdfTex 3.4.5

Looks like some LaTeX package is out of date, and doesn't understand
some of the tex that got generated.  Rd.sty has this:

  \hypersetup{%
hyperindex,%
colorlinks,%
pagebackref,%
linktocpage,%
plainpages=false,%
linkcolor=Blue,%
citecolor=Blue,%
urlcolor=Red,%
pdfstartview=Fit,%
pdfview={XYZ null null null}%
  }

so I think your system doesn't have the \hypersetup macro defined (or
maybe you're using an out of date Rd.sty or hyperref.sty?)

Duncan Murdoch

__
[EMAIL PROTECTED] 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] Time series plot orientation

2004-11-19 Thread Uwe Ligges
Costas Vorlow wrote:
Hello,
I am trying to rotate by 90 degrees a time series plot. So I need the 
time axis to be the vertical one. Is there an easy way?

No, you have to do it manually, AFAIK.
Uwe Ligges

I couldn't guess anything from the help pages.
Apologies for a silly question.
Regards,
Costas
__
[EMAIL PROTECTED] 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] Plotting averages of y per x

2004-11-19 Thread Uwe Ligges
Gregor GORJANC wrote:
Hello!
I often plot average of y instead of all y values, since one can easily 
see the trend if there is to many points and/or x might be like 1, 2, 3, 
4, 5, ... and you might get a cloud (which can also be informative) 
and/or columns of points.

Anyway, learning with R i get stucked. I have the data in table 
burnins1, with the following names:

names(burnins1)
[1] "Model"   "Replication" "h2"  "burnin"
and some data
...
...
380New  80  2 23
381New  81  5 38
382New  82 10 31
383New  83 15 98
384New  84 20 32
385New  85 40 30
386New  86  1 43
387New  87  2 53
388New  88  5 36
389New  89 10 51
390New  90 15 19
...
...
So I want to plot mean of variable burnin by variables model and h2. I 
compute means with

tmp <- as.data.frame(t(tapply(burnin, list(Model, h2), mean)))
and table tmp looks like this
 Old   New
1  31.00 29.36
2  30.30 28.34
5  32.92 30.66
10 39.00 37.54
15 40.66 34.07
20 39.29 35.94
40 28.63 28.51
Now I want to launch something like
plot(tmp[, 0], Old)
points(tmp[, 0], New, pch = 20)
and it gives me the error
Error in pairs.default(x, ...) : non-numeric argument to pairs
I guess that I am having problem with tmp[, 0]. If I use

Yes, R starts indexing with 1, but not with 0.

plot(Old)
points(New, pch = 20)
I get the plot, but abscisa is numbered from 1 to 7 not 1, 2, 5, 10, 15, 
20 and 40. Does anyone have any sugestions?
Omit the x axis at first (e.g. using argument xaxt="n") and add it with 
axis(2, ...) and correct labels afterwards.

Uwe Ligges

I would also like to produce table like this, so plotting would be 
easier, since there would be no need to use points() and/or lines() 
commands to add another group.

  Model h2 mean
1  Old  1  31.00
2  Old  2  30.30
3  Old  5  32.92
4  Old  10 39.00
5  Old  15 40.66
6  Old  20 39.29
7  Old  40 28.63
8  Old  1  29.36
9  Old  2  28.34
10 Old  5  30.66
11 Old  10 37.54
12 Old  15 34.07
13 Old  20 35.94
14 Old  40 28.51

__
[EMAIL PROTECTED] 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] adjusting the map of France to 1830

2004-11-19 Thread Michael Friendly
Here's what I tried.   I can plot a selection of regions, but I
can't seem to remove an arbitrary list of region numbers, unless I've 
done something wrong
by selecting the regions I want to plot with departements[-exclude].
I also get an error
when I try to use map.text to label a map with only the regions I'm  
selecting.

> departements <- map('france',namesonly=T, plot=FALSE)
> # returns a vector of names of regions
>
> exclude <- c(47,  #Alpes-Maritimes
+ 66,  # Haute-Savoie
+ 76,  # Savoie
+ 95,  # Territore-de-Belfort
+ 109, 110, 111, # Var: Iles d'Hyeres
+ 49, 53, 54, 55, # Moribhan: Isles
+ 62, 64,# Vendee: Isles
+ 72, 75 # Charente-Maritime: Isles
+ )
>
> depts <- departements[-exclude]
> gfrance <-map('france', regions=depts)
> labels <- (as.character(1:length(departements)))[-exclude]
> gfrance <-map.text('france', regions=depts, add=FALSE, labels=labels)
Error in map.text("france", regions = depts, add = FALSE, labels = labels) :
   map object must have polygons (fill=TRUE)
Another problem, potentially more difficult for mapping data on the map 
of France is that
the "departements" are actually just the polygons in the map, 
arbitrarily numbered from
east to west, and from north to south --- they don't correspond to the 
'official' administrative
region numbers.  As well, the departement names don't always match 
exactly (ignoring
accents, e.g., Val-d'Oise vs. Val-Doise) so it would be another 
challenge to plot my
historical data on the map of France.

-Michael
Stephane DRAY wrote:
Hello. I do not know if you can merge polygons, but you can select 
easily:

> departements=map('france',namesonly=T) # returns a vector of names 
of regions
> map('france',regions=departements[1:20],namesonly=T) # use what you 
need with regions argument

Hope this helps,
At 16:29 18/11/2004, Michael Friendly wrote:
I'm doing some analyses of historical data from France in 1830 on 
'moral statistics' that I'd like to
show on a map.  I've done most of my analyses in SAS, but a few 
things would work better in R.
To do this, I have to adjust the modern map,

library(maps)
map('france')
to adjust for changes in departments (86 in 1830, to 97 now).  I've 
read the documentation
for the maps and maptools package, but there seems to be no functions 
to allow this, and
I can't find information on the exact structure of map datasets, but 
I understand them to
be delimited lists of polygon coordinates.

In SAS, all maps have (one or more) ID variables representing the 
geographical region,
and there is also a proc gremove that can remove internal boundaries 
inside the polygons
for regions with the same ID.  Is there some way I can do this in R?

Here's what I did in SAS:
*-- Fix the map of France to conform to Guerry:
   - adjust the 97 current departments to correspond to the 86 in 1830
   - delete those not part of France then
;
data gfrtemp;
   set maps.france;
   /* Corse was one dept - merge these to one area, new ID */
   if id in (201, 202)then dept=200;
   /* Seine et Oise (78) was cut into
   Essonne (91), Val d'Oise (95) and Yvelines (78) */
   else if id in (91, 95)then dept=78;
   /* Seine (75) now split into
   Hauts-de-Seine (92), Seine-Saint-Denis (93) et Val-de-Marne (94)*/
   else if id in (92, 93, 94)then dept=75;
/* departments not part of France in 1830 */
   else if id in (
   6, /* Alpes-Maritimes */
   73,74, /* Savoie, Haute-Savoie */
   90)/* Territore-de-Belfort */
   then delete;
   else   dept=id;
   run;
*-- remove internal boundaries based on merged DEPT;
proc sort data=gfrtemp;
   by dept;
proc gremove data=gfrtemp out=gfrance;
  by dept;
  id id;
  run;

--
Michael Friendly Email: [EMAIL PROTECTED] Professor, Psychology 
Dept.
York University  Voice: 416 736-5115 x66249 Fax: 416 736-5814
4700 Keele Streethttp://www.math.yorku.ca/SCS/friendly.html
Toronto, ONT  M3J 1P3 CANADA

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! 
http://www.R-project.org/posting-guide.html

Stéphane DRAY
-- 

Département des Sciences Biologiques
Université de Montréal, C.P. 6128, succursale centre-ville
Montréal, Québec H3C 3J7, Canada
Tel : (514) 343-6111 poste 1233 Fax : (514) 343-2293
E-mail : [EMAIL PROTECTED]
-- 

Web  
http://www.steph280.freesurf.fr/
-- 



--
Michael Friendly Email: [EMAIL PROTECTED] 
Professor, Psychology Dept.
York University  Voice: 416 736-5115 x66249 Fax: 416 736-5814
4700 Keele Streethttp://www.math.yorku.ca/SCS/friendly.html
Toronto, ONT  M3J 1P3 CANA

RE: [R] R (unix) command line editing for native speakers of vi

2004-11-19 Thread Liaw, Andy
If you have the following in your ~/.inputrc, you won't need to set it
manually every time (at least according to the readline manual):

set editing-mode vi

HTH,
Andy

> From: Steve Dutky
> 
> As an inveterate user of vi, I was pleased to stumble on how 
> to use it for editing R commands.  
> 
> When an interactive R session is launched under unix, the 
> command line editor most likely defaults to emacs. Typing 
> ,+j will switch this to vi editing mode (see below 
> for possible exceptions).
> 
> excerpted from readline(3) manpage:
> vi-editing-mode (M-C-j)
>   When in emacs editing mode, this causes a switch to
> vi editing mode.
> 
> emacs-editing-mode (C-e)
>   When in vi editing mode, this causes  a  switch  to emacs 
> editing mode.
> 
> 
> An  emacs-style  notation  is  used  to denote keystrokes. 
> Control keys are denoted by C-key, e.g.,C-n  means  Control-
> N.  Similarly, meta keys are denoted by M-key, so M-x means 
> Meta-X.  (On keyboards without a meta key, M-x means ESC  x,  
> i.e.,  press the Escape key then the x key.  This makes ESC 
> the meta prefix.  The combination M-C-x means ESC-Control-x,  
> or press the Escape key then hold the Control key while 
> pressing the x key.)
> 
> see also:
> An Introduction to R Appendix C: The command-line editor.
> http://cran.r-project.org/doc/manuals/R-intro.html#The%
> 20command-line%20editor
> 
> Steve Dutky ([EMAIL PROTECTED])
> 
> __
> [EMAIL PROTECTED] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! 
> http://www.R-project.org/posting-guide.html
> 
>

__
[EMAIL PROTECTED] 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] Selecting distinct values from a column

2004-11-19 Thread Marc Schwartz
On Fri, 2004-11-19 at 19:01 +, Ann Huxtable wrote:
> Hello,
> 
> Is there an easy way (other than the obvious for loop?) to select distinct 
> values from a column vector?
> 
> Many thanks
> 
> Ann


Presuming that by 'distinct' you mean 'unique', see ?unique

> MyVec <- rep(1:5, times = c(1:5))

> MyVec
 [1] 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5

> unique(MyVec)
[1] 1 2 3 4 5


HTH,

Marc Schwartz

__
[EMAIL PROTECTED] 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] Rd and document formatting

2004-11-19 Thread strivens
I am trying to compose some documentation for a package I hope to release 
soon.

However when I do the following:

R CMD Rd2dvi --pdf mypackage.Rd

I get two mainly blank pages prepended to the top of the document - the only 
text on either (at the top of the first page) is as follows:
 hyperindex,colorlinks,pagebackref,linktocpage,plainpages=false,linkcolor=Blue
,citecolor=Blue,urlcolor=Red,pdnull null null

Curiously if you generate the dvi it is fine and if you generate the pdf from 
the dvi using dvipdf it is also fine...

Anyone got any ideas?

System: Linux 2.4.24 SMP i686 GNU/Linux, latex 3.14159-2.1 pdfTex 3.4.5

Thanks  Mark

__
[EMAIL PROTECTED] 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] Running sum

2004-11-19 Thread Anon.
Prof Brian Ripley wrote:
?cumsum
On Fri, 19 Nov 2004, Sean Davis wrote:
I have vector X of length N that I want to have a running sum for 
(called Y). I just need max(Y).  I do this with a "for" loop like so:

   Y <- vector(length=N)
   Y[1] <- X[1]
   for (i in 2:N) {
 Y[i] <- Y[i-1]+X[i]
   }
   return(max(Y))
Is there a faster way to do this?

My apologies, I am not being entirely serious, but...
Please do read the posting guide! 
(particularly the third point in the "Responding to other posts" section).

Bob
--
Bob O'Hara
Department of Mathematics and Statistics
P.O. Box 68 (Gustaf Hällströmin katu 2b)
FIN-00014 University of Helsinki
Finland
Telephone: +358-9-191 51479
Mobile: +358 50 599 0540
Fax:  +358-9-191 51400
WWW:  http://www.RNI.Helsinki.FI/~boh/
Journal of Negative Results - EEB: www.jnr-eeb.org
__
[EMAIL PROTECTED] 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] Running sum

2004-11-19 Thread Philippe Grosjean
?cumsum is not exactly the answer (as I understand it), but a part of it.
I propose:

runSum2 <- function(x)
cumsum(x)[-1] - c(0, cumsum(x[1:(length(x) - 2)]))

# Example
a <- round(runif(10, 0, 10))
a
runSum2(a)
max(runSum2(a)) # To get only the max

Best,

Philippe

..<°}))><
 ) ) ) ) )
( ( ( ( (Prof. Philippe Grosjean
 ) ) ) ) )
( ( ( ( (Numerical Ecology of Aquatic Systems
 ) ) ) ) )   Mons-Hainaut University, Pentagone
( ( ( ( (Academie Universitaire Wallonie-Bruxelles
 ) ) ) ) )   6, av du Champ de Mars, 7000 Mons, Belgium  
( ( ( ( (   
 ) ) ) ) )   phone: + 32.65.37.34.97, fax: + 32.65.37.33.12
( ( ( ( (email: [EMAIL PROTECTED]
 ) ) ) ) )  
( ( ( ( (web:   http://www.umh.ac.be/~econum
 ) ) ) ) )
..

 

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of Marc Schwartz
> Sent: Friday, November 19, 2004 7:57 PM
> To: Sean Davis
> Cc: R-Help
> Subject: Re: [R] Running sum
> 
> On Fri, 2004-11-19 at 13:08 -0500, Sean Davis wrote:
> > I have vector X of length N that I want to have a running sum for 
> > (called Y).  I just need max(Y).  I do this with a "for" 
> loop like so:
> > 
> >  Y <- vector(length=N)
> >  Y[1] <- X[1]
> >  for (i in 2:N) {
> >Y[i] <- Y[i-1]+X[i]
> >  }
> >  return(max(Y))
> > 
> > Is there a faster way to do this?
> > 
> > Thanks,
> > Sean
> 
> 
> Something like:
> 
> > cumsum(1:10)
>  [1]  1  3  6 10 15 21 28 36 45 55
> 
> > max(cumsum(1:10))
> [1] 55
> 
> Does that help?
> 
> Marc Schwartz
> 
> __
> [EMAIL PROTECTED] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! 
> http://www.R-project.org/posting-guide.html
> 
>

__
[EMAIL PROTECTED] 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 (unix) command line editing for native speakers of vi

2004-11-19 Thread Steve Dutky
As an inveterate user of vi, I was pleased to stumble on how 
to use it for editing R commands.  

When an interactive R session is launched under unix, the 
command line editor most likely defaults to emacs. Typing 
,+j will switch this to vi editing mode (see below 
for possible exceptions).

excerpted from readline(3) manpage:
vi-editing-mode (M-C-j)
  When in emacs editing mode, this causes a switch to
vi editing mode.

emacs-editing-mode (C-e)
  When in vi editing mode, this causes  a  switch  to emacs 
editing mode.


An  emacs-style  notation  is  used  to denote keystrokes. 
Control keys are denoted by C-key, e.g.,C-n  means  Control-
N.  Similarly, meta keys are denoted by M-key, so M-x means 
Meta-X.  (On keyboards without a meta key, M-x means ESC  x,  
i.e.,  press the Escape key then the x key.  This makes ESC 
the meta prefix.  The combination M-C-x means ESC-Control-x,  
or press the Escape key then hold the Control key while 
pressing the x key.)

see also:
An Introduction to R Appendix C: The command-line editor.
http://cran.r-project.org/doc/manuals/R-intro.html#The%
20command-line%20editor

Steve Dutky ([EMAIL PROTECTED])

__
[EMAIL PROTECTED] 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] Running sum

2004-11-19 Thread Roger D. Peng
You could try using embed(), but I doubt it's faster.
-roger
Sean Davis wrote:
I have vector X of length N that I want to have a running sum for 
(called Y).  I just need max(Y).  I do this with a "for" loop like so:

Y <- vector(length=N)
Y[1] <- X[1]
for (i in 2:N) {
  Y[i] <- Y[i-1]+X[i]
}
return(max(Y))
Is there a faster way to do this?
Thanks,
Sean
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! 
http://www.R-project.org/posting-guide.html

--
Roger D. Peng
http://www.biostat.jhsph.edu/~rpeng/
__
[EMAIL PROTECTED] 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] Selecting distinct values from a column

2004-11-19 Thread Ann Huxtable
Hello,
Is there an easy way (other than the obvious for loop?) to select distinct 
values from a column vector?

Many thanks
Ann
__
[EMAIL PROTECTED] 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] Running sum

2004-11-19 Thread Spencer Graves
 Have you considered "cumsum"? 

 > cumsum(c(1, 2, 3, -9, 2))
 [1]  1  3  6 -3 -1
 hope this helps.  spencer graves
Sean Davis wrote:
I have vector X of length N that I want to have a running sum for 
(called Y).  I just need max(Y).  I do this with a "for" loop like so:

Y <- vector(length=N)
Y[1] <- X[1]
for (i in 2:N) {
  Y[i] <- Y[i-1]+X[i]
}
return(max(Y))
Is there a faster way to do this?
Thanks,
Sean
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! 
http://www.R-project.org/posting-guide.html

--
Spencer Graves, PhD, Senior Development Engineer
O:  (408)938-4420;  mobile:  (408)655-4567
__
[EMAIL PROTECTED] 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] Running sum

2004-11-19 Thread Prof Brian Ripley
?cumsum
On Fri, 19 Nov 2004, Sean Davis wrote:
I have vector X of length N that I want to have a running sum for (called Y). 
I just need max(Y).  I do this with a "for" loop like so:

   Y <- vector(length=N)
   Y[1] <- X[1]
   for (i in 2:N) {
 Y[i] <- Y[i-1]+X[i]
   }
   return(max(Y))
Is there a faster way to do this?
--
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595
__
[EMAIL PROTECTED] 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] Running sum

2004-11-19 Thread Marc Schwartz
On Fri, 2004-11-19 at 13:08 -0500, Sean Davis wrote:
> I have vector X of length N that I want to have a running sum for 
> (called Y).  I just need max(Y).  I do this with a "for" loop like so:
> 
>  Y <- vector(length=N)
>  Y[1] <- X[1]
>  for (i in 2:N) {
>Y[i] <- Y[i-1]+X[i]
>  }
>  return(max(Y))
> 
> Is there a faster way to do this?
> 
> Thanks,
> Sean


Something like:

> cumsum(1:10)
 [1]  1  3  6 10 15 21 28 36 45 55

> max(cumsum(1:10))
[1] 55

Does that help?

Marc Schwartz

__
[EMAIL PROTECTED] 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] Running sum

2004-11-19 Thread Sean Davis
Thanks all.
cumsum does the job
Sean
__
[EMAIL PROTECTED] 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] Running sum

2004-11-19 Thread Andy Bunn
see ?cumsum
x <- 1:10
cumsum(x)
max(cumsum(x))

HTH, Andy


> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] Behalf Of Sean Davis
> Sent: Friday, November 19, 2004 1:09 PM
> To: r-help
> Subject: [R] Running sum
> 
> 
> I have vector X of length N that I want to have a running sum for 
> (called Y).  I just need max(Y).  I do this with a "for" loop like so:
> 
>  Y <- vector(length=N)
>  Y[1] <- X[1]
>  for (i in 2:N) {
>Y[i] <- Y[i-1]+X[i]
>  }
>  return(max(Y))
> 
> Is there a faster way to do this?
> 
> Thanks,
> Sean
> 
> __
> [EMAIL PROTECTED] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! 
> http://www.R-project.org/posting-guide.html
>

__
[EMAIL PROTECTED] 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] Running sum

2004-11-19 Thread Liaw, Andy
See cumsum:

> x <- rnorm(10)
> cs <- function(X) { 
+  N <- length(X)
+  Y <- vector(length=N)
+  Y[1] <- X[1]
+  for (i in 2:N) {
+Y[i] <- Y[i-1]+X[i]
+  }
+  return(max(Y))
+ }
> cs(x)
[1] 3.228554
> max(cumsum(x))
[1] 3.228554

Andy

> From: Sean Davis
> 
> I have vector X of length N that I want to have a running sum for 
> (called Y).  I just need max(Y).  I do this with a "for" loop like so:
> 
>  Y <- vector(length=N)
>  Y[1] <- X[1]
>  for (i in 2:N) {
>Y[i] <- Y[i-1]+X[i]
>  }
>  return(max(Y))
> 
> Is there a faster way to do this?
> 
> Thanks,
> Sean
> 
> __
> [EMAIL PROTECTED] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! 
> http://www.R-project.org/posting-guide.html
> 
>

__
[EMAIL PROTECTED] 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] Running sum

2004-11-19 Thread Kjetil Brinchmann Halvorsen
Sean Davis wrote:
I have vector X of length N that I want to have a running sum for 
(called Y).  I just need max(Y).  I do this with a "for" loop like so:

Y <- vector(length=N)
Y[1] <- X[1]
for (i in 2:N) {
  Y[i] <- Y[i-1]+X[i]
}
return(max(Y))
Is there a faster way to do this?

max(cumsum(Y))
Kjetil
Thanks,
Sean
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! 
http://www.R-project.org/posting-guide.html



--
Kjetil Halvorsen.
Peace is the most effective weapon of mass construction.
  --  Mahdi Elmandjra
__
[EMAIL PROTECTED] 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] Plotting averages of y per x

2004-11-19 Thread Kjetil Brinchmann Halvorsen
Gregor GORJANC wrote:
Hello!
I often plot average of y instead of all y values, since one can 
easily see the trend if there is to many points and/or x might be like 
1, 2, 3, 4, 5, ... and you might get a cloud (which can also be 
informative) and/or columns of points.

Anyway, learning with R i get stucked. I have the data in table 
burnins1, with the following names:

names(burnins1)
[1] "Model"   "Replication" "h2"  "burnin"
and some data
...
...
380New  80  2 23
381New  81  5 38
382New  82 10 31
383New  83 15 98
384New  84 20 32
385New  85 40 30
386New  86  1 43
387New  87  2 53
388New  88  5 36
389New  89 10 51
390New  90 15 19
...
...
So I want to plot mean of variable burnin by variables model and h2. I 
compute means with

tmp <- as.data.frame(t(tapply(burnin, list(Model, h2), mean)))
and table tmp looks like this
 Old   New
1  31.00 29.36
2  30.30 28.34
5  32.92 30.66
10 39.00 37.54
15 40.66 34.07
20 39.29 35.94
40 28.63 28.51
Now I want to launch something like
plot(tmp[, 0], Old)
points(tmp[, 0], New, pch = 20)
There is no column 0. R starts counting at 1. Try something like
plot(as.numeric(rownames(tmp)), tmp[,"Old"])
(not tested)
Kjetil
and it gives me the error
Error in pairs.default(x, ...) : non-numeric argument to pairs
I guess that I am having problem with tmp[, 0]. If I use
plot(Old)
points(New, pch = 20)
I get the plot, but abscisa is numbered from 1 to 7 not 1, 2, 5, 10, 
15, 20 and 40. Does anyone have any sugestions?

I would also like to produce table like this, so plotting would be 
easier, since there would be no need to use points() and/or lines() 
commands to add another group.

  Model h2 mean
1  Old  1  31.00
2  Old  2  30.30
3  Old  5  32.92
4  Old  10 39.00
5  Old  15 40.66
6  Old  20 39.29
7  Old  40 28.63
8  Old  1  29.36
9  Old  2  28.34
10 Old  5  30.66
11 Old  10 37.54
12 Old  15 34.07
13 Old  20 35.94
14 Old  40 28.51


--
Kjetil Halvorsen.
Peace is the most effective weapon of mass construction.
  --  Mahdi Elmandjra
__
[EMAIL PROTECTED] 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! a urgent question

2004-11-19 Thread Kjetil Brinchmann Halvorsen
Go to
http://cran.r-project.org/
and find the contributed documentation section.
Kjetil
an ying wrote:
Dear Sir/Madam,
I am doing a project related to R. 
However, it is always difficult find some R functions.
The R user guide seems not complete. 
Is there any free document about all R functions ?
Who knows ? please help me.
My email is [EMAIL PROTECTED] 

Thank you very much

-
Meet the all-new My Yahoo! – Try it today! 
	[[alternative HTML version deleted]]

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
 


--
Kjetil Halvorsen.
Peace is the most effective weapon of mass construction.
  --  Mahdi Elmandjra
__
[EMAIL PROTECTED] 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] Performing regression using R & C

2004-11-19 Thread Jim McLoughlin
Is it possible to perform OLS using C code? I am trying to
optimize a n-period "moving window" OLS on a huge dataset hence was
wondering if such a thing is possible.
	Ideally the solution that I am looking for would involve a
C-code accepting two float arrays and returning back computed 
parameters
such as t-stat, coefficient etc.
It is probably not worth trying to call R to do OLS from C.  I would 
look at GSL:

http://www.gnu.org/software/gsl/manual/gsl-ref_toc.html
GSL has a simple but elegant C interface for doing OLS and weighted 
least squares.  It will give you the covariance matrix of the model 
parameters, from which you can derive t-stats.

Jim M
__
[EMAIL PROTECTED] 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] Running sum

2004-11-19 Thread Sean Davis
I have vector X of length N that I want to have a running sum for 
(called Y).  I just need max(Y).  I do this with a "for" loop like so:

Y <- vector(length=N)
Y[1] <- X[1]
for (i in 2:N) {
  Y[i] <- Y[i-1]+X[i]
}
return(max(Y))
Is there a faster way to do this?
Thanks,
Sean
__
[EMAIL PROTECTED] 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! a urgent question

2004-11-19 Thread David Forrest
On Fri, 19 Nov 2004, an ying wrote:

> Dear Sir/Madam,
>
> I am doing a project related to R.
> However, it is always difficult find some R functions.
> The R user guide seems not complete.
> Is there any free document about all R functions ?
> Who knows ? please help me.
> My email is [EMAIL PROTECTED]

There has been much discussion on this topic on this mailing list
recently, and an important result is that there is no complete user guide.
Like any computer language, R is extensible, and there is no complete
listing.  If you know what you are looking for, for example 'urgent
question', try this in R:

 help.search.archive<-function(string){
   RURL="http://www.google.com/u/newcastlemaths";
   RSearchURL=paste(RURL,"?q=",string,sep='')
   browseURL(RSearchURL)
   return(invisible(0))
 }
 # and

help.search.archive("urgent question") # to find urgent questions

Dave
-- 
 Dave Forrest
 [EMAIL PROTECTED](804)684-7900w
 [EMAIL PROTECTED] (804)642-0662h
   http://maplepark.com/~drf5n/

__
[EMAIL PROTECTED] 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] CRAN problems

2004-11-19 Thread Kjetil Brinchmann Halvorsen
The area
*Index of /bin/windows/contrib/2.1
(and also 2.0)
**at the main CRAN site is at the moment empty'
*
--
Kjetil Halvorsen.
Peace is the most effective weapon of mass construction.
  --  Mahdi Elmandjra
__
[EMAIL PROTECTED] 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] function 'vcov' for coxph in R 2.0.0

2004-11-19 Thread Prof Brian Ripley
Your version of survival is out of date: please use update.packages().
On Fri, 19 Nov 2004, Lei  Liu wrote:
Hi there,
After I fitted a cox model, I used vcov to obtain the variance of the 
parameter estimate. It worked correctly in R 1.9.1. But it failed in R 2.0.0 
and the error message is 
Error in vcov(cox.1) : no applicable method for "vcov"

I don't know if it is a bug or there is some update on this function. Thanks!
WHY don't you know if there is an update?
--
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595
__
[EMAIL PROTECTED] 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! a urgent question

2004-11-19 Thread Yves Magliulo
hi,

you can download The R Reference Index contains all help files of the R
standard and recommended packages in printable form at 
http://cran.r-project.org/doc/manuals/fullrefman.pdf

you will find other Manuals at 
http://www.r-project.org/


have a nice week-end all.
--
Yves Magliulo <[EMAIL PROTECTED]>
R&D Engineer, CLIMPACT

Tel.   : +33 (0) 1 44 27 34 31
Fax.   : +33 (0) 1 44 27 49 96 
Universite Pierre et Marie Curie
Boite 101 - Tour 45 - 5eme etage - Couloir 45/46
4 place Jussieu, 75252 Paris CEDEX 05, France


Le ven 19/11/2004 à 16:55, an ying a écrit :

> Dear Sir/Madam,
>  
> I am doing a project related to R. 
> However, it is always difficult find some R functions.
> The R user guide seems not complete. 
> Is there any free document about all R functions ?
> Who knows ? please help me.
> My email is [EMAIL PROTECTED] 
>  
> 
> Thank you very much
> 
>   
> -
> 
>  Meet the all-new My Yahoo!  Try it today! 
>   [[alternative HTML version deleted]]
> 
> __
> [EMAIL PROTECTED] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

-- 


[[alternative HTML version deleted]]

__
[EMAIL PROTECTED] 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! a urgent question

2004-11-19 Thread Marc Schwartz
On Fri, 2004-11-19 at 07:55 -0800, an ying wrote:
> Dear Sir/Madam,
>  
> I am doing a project related to R. 
> However, it is always difficult find some R functions.
> The R user guide seems not complete. 
> Is there any free document about all R functions ?
> Who knows ? please help me.
> My email is [EMAIL PROTECTED] 
> 
> 
> Thank you very much


Perhaps if you provided some insight into what exactly it is you are
looking to do, we can provide some specific guidance.

The R Manuals are typically available in your installation, accessible
via help.start().

However they are also online at the main R site:

http://www.r-project.org/

Along the left hand side of the page under "Documentation", there are
several links to available manuals, user contributed docs, FAQ's, etc.

HTH,

Marc Schwartz

__
[EMAIL PROTECTED] 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-gui] RE: [R] The hidden costs of GPL software?

2004-11-19 Thread David Lennartsson
Philippe Grosjean wrote:
John W. Eaton wrote:
 

On 17-Nov-2004, Philippe Grosjean <[EMAIL PROTECTED]> wrote:
| - There is no possibility to make a commercial GUI for R (thanks to 
| the GPL),

This is false.  Please don't confuse "commercial" (Red Hat 
and SuSE GNU/Linux distributions are commercial software) 
with "proprietary".

jwe
   

Ooops! Sorry, and thank you for correcting me. I mean "proprietary", of
course.
Best,
Philippe Grosjean
 

This thread has gone to be centered around the GUI of R and what it is 
good and bad.

However, is the above statement correct? To me it seems like there is a 
fully working R-proxy dll for windows and other ways to interface 
against R that only binds to LGPL components. You can build completely 
proprietary packages and front-ends to R without having to make sources 
available, as long as you distribute changes to R itself as source.

In my opinion anyone can be to R what S+ is to S. Can any developer 
comment on this?

   Best regards,
   David
__
[EMAIL PROTECTED] 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! a urgent question

2004-11-19 Thread Spencer Graves
 Have you tried "?help.search" in R?
Also, have you tried www.r-project.org -> search -> "R site search"?
Finally, have you tried "the posting guide! 
http://www.R-project.org/posting-guide.html";?

hope this helps. spencer graves
an ying wrote:
Dear Sir/Madam,
I am doing a project related to R. 
However, it is always difficult find some R functions.
The R user guide seems not complete. 
Is there any free document about all R functions ?
Who knows ? please help me.
My email is [EMAIL PROTECTED] 

Thank you very much

-
Meet the all-new My Yahoo! – Try it today! 
	[[alternative HTML version deleted]]

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
 

--
Spencer Graves, PhD, Senior Development Engineer
O:  (408)938-4420;  mobile:  (408)655-4567
__
[EMAIL PROTECTED] 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] Plotting averages of y per x

2004-11-19 Thread Gregor GORJANC
Hello!
I often plot average of y instead of all y values, since one can easily 
see the trend if there is to many points and/or x might be like 1, 2, 3, 
4, 5, ... and you might get a cloud (which can also be informative) 
and/or columns of points.

Anyway, learning with R i get stucked. I have the data in table 
burnins1, with the following names:

names(burnins1)
[1] "Model"   "Replication" "h2"  "burnin"
and some data
...
...
380New  80  2 23
381New  81  5 38
382New  82 10 31
383New  83 15 98
384New  84 20 32
385New  85 40 30
386New  86  1 43
387New  87  2 53
388New  88  5 36
389New  89 10 51
390New  90 15 19
...
...
So I want to plot mean of variable burnin by variables model and h2. I 
compute means with

tmp <- as.data.frame(t(tapply(burnin, list(Model, h2), mean)))
and table tmp looks like this
 Old   New
1  31.00 29.36
2  30.30 28.34
5  32.92 30.66
10 39.00 37.54
15 40.66 34.07
20 39.29 35.94
40 28.63 28.51
Now I want to launch something like
plot(tmp[, 0], Old)
points(tmp[, 0], New, pch = 20)
and it gives me the error
Error in pairs.default(x, ...) : non-numeric argument to pairs
I guess that I am having problem with tmp[, 0]. If I use
plot(Old)
points(New, pch = 20)
I get the plot, but abscisa is numbered from 1 to 7 not 1, 2, 5, 10, 15, 
20 and 40. Does anyone have any sugestions?

I would also like to produce table like this, so plotting would be 
easier, since there would be no need to use points() and/or lines() 
commands to add another group.

  Model h2 mean
1  Old  1  31.00
2  Old  2  30.30
3  Old  5  32.92
4  Old  10 39.00
5  Old  15 40.66
6  Old  20 39.29
7  Old  40 28.63
8  Old  1  29.36
9  Old  2  28.34
10 Old  5  30.66
11 Old  10 37.54
12 Old  15 34.07
13 Old  20 35.94
14 Old  40 28.51
--
Lep pozdrav / With regards / Con respeto,
Gregor GORJANC
---
University of Ljubljana
Biotechnical Faculty   URI: http://www.bfro.uni-lj.si
Zootechnical Departmentmail: gregor.gorjanc  bfro.uni-lj.si
Groblje 3  tel: +386 (0)1 72 17 861
SI-1230 Domzalefax: +386 (0)1 72 41 005
Slovenia
__
[EMAIL PROTECTED] 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] The hidden costs of GPL software?

2004-11-19 Thread Michael Grant
I inadvertently directed this response to the R-Gui
list this morning. To those receiving a double
receipt, I give my apologies. My intended list was the
R list. 

--- Duncan Murdoch <[EMAIL PROTECTED]> wrote:

> On Thu, 18 Nov 2004 03:24:01 -0800 (PST), Michael
> Grant
> <[EMAIL PROTECTED]> wrote:
> 
> >H, interesting thread and minds will not be
> >changed but regarding GUIs...I thought S (aka R)

...

> 
> I have to disagree with you.  What you say might be
> true about *bad*
> GUIs, but I find nothing more frustrating than the
> lack of programming
> support in R.
>
> What's a nice GUI for programming?
> 
> You should be able to edit code, and have R parse
> the code that you
> are editing
...
[snip] [snip] [snip]
... 
> All of these things have existed for years in IDEs
> (i.e. programming
> GUIs), but most are not in R's GUIs.  

I guess we'll just agree to disagree. :O)
1.)The LACK of programming support? Isn't that a bit
of an overstatement? There are materials available, as
of ciurse you are aware. At one time or another many
of us may find it difficult to determine some 'key'
programming information at the moment. But you know
something, I've  had that happen using the packages
like you describe--this includes wired IDE help,
original documentation, and 3rd party books. I accept
that as a condition for using both free and commercial
software. And if the particular burden is too great,
then I don't use the product. Such is life :O)

2.)As you indicate below, R doesn't not have a VB or
VC++ style IDE. R doesn't have the development
environment of Smalltalk or the commercial LISPs
(sigh...) But, really, an IDE is a bit more than a
GUI, wouldn't you agree? A GUI is just one component
of an IDE.

Perhaps part of our difference is how we view
programming. I view it more as a form of expression
using a LANGUAGE. Like any language, e.g., English,
French, Chinese, you have to develop a degree of
fluency to express yourself. Some people are
comfortable working with a phrase book and others put
more effort in to learn to converse sans book. Both
approaches are quite legitimate in that either can get
the job done. (And both can fail miserably!) 

>From another perspective, I can not deny that having a
real GUI would be nice at times even for a grump like
myself. And not having such is a cost. But in my case
that cost is not the deciding factor. The fact is, I
by preference do a lot of coding--both at the
quick/dirty scale and the project scale--in R that I
could do in C/C++, FORTRAN, BASIC. I have those tools
in commerical form with IDEs

Why R? The turn around is so fast by comparison. R/S
is language in which I can much more easily and
quickly express myself.  The development team has done
a lot of work developing my high-level language for me
:O). (Note--my second hacking language is  lisp-stat,
also an interpreted, higher functionality language.) I
don't use most of R's capabilities, and 'not knowing
that which I do not know' is not an issue. When I need
something new I am able to learn it incrementally on
top of what I already know.
...
> 
> That's one sort of GUI that R could have, but it's
> not the only one,
> and it's not the one that I'd use.  However, I might
> start out
> students on it.  There's a big benefit to a list of
> suggestions as
> opposed to a big blank space.
Did I suggest banning GUIs? I don't think so. Your
world is one where there are benefit for your
clients--the students. My world is turn around and
documentation. Coding is easier to document than a
complex sequence of menu actions. Indeed I would get
laughed out of Dodge City if I documented a set of
calculations: " next I clicked ...". It's that just
different requirements lead to different needs.

> 
> >GUIs encourage a passive approach to using
> computers
> >when solving problems. In addition, it is
> regretable
...
[snip]
...
> >gather 'electronic dust'.
> 
> A lot of people do incomplete or incorrect work
> because they don't
> know any better.  It doesn't matter if they're using
> a GUI or not,
> they'll do what they think they know, and get it
> wrong.

Of course that is the case, but the limitations in a
given GUI is one more thing that puts such people in
rationalized comfort-zone with their actions.
(Typically I see this with EXCEL apps--99.9% of the
people in my trade run away from statistical
software.)
More than once I have seen this occur in a senior
scientist review capacity after management has seen
the product and 'accepted' its results. Doom, doom,
doom...shoot the messenger! Oh woe, oh woe!:O(.

Best regards, Duncan
Michael

__
[EMAIL PROTECTED] 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] COURSE: Statistical Modelling - By Dr Bill Venables

2004-11-19 Thread Karen Richardson
 
Insightful are pleased to announce the following Course: 
 
Statistical Modelling - By Dr Bill Venables
 
Dates:   9 - 11 February 2005
 
Place:   Basingstoke, UK
 
Hours:   09:00 - 17:00
 
Course Fees:   Commercial - £1,400  + VAT,  Academic - £800 + VAT
 
Course Description:
 
The course will cover both classical and modern modelling, with special
attention on the classical side to linear models, generalized linear models,
linear mixed effects, generalized linear mixed effects, nonlinear.  The
second half of the course will cover more modern material: robust estimation,
model selection, regression diagnostics, use and abuse of the bootstrap and
modern alternatives, notably tree-based models (with bagging) and neural
networks.   Examples are combined with programming and graphics in S-PLUS
wherever the opportunity arises.
 
http://www.insightful.com/services/training/venables_2004.asp
 
Presenter Information: 
Dr Bill Venables - Senior Statistician, CSIRO.
 
Bill Venables is a well-known figure in the S-PLUS community, particularly
for his contributions to S-news and books on S-PLUS. Since 1990 he has
presented S-PLUS courses at several levels.  His freely distributed and very
popular Notes on S were in the early 90s often the first introduction many
students had to the system. These subsequently led to a book, Modern Applied
Statistics with S-PLUS with Brian Ripley, first released in 1994 is now in
its fourth edition (July, 2002). A second book by the same authors, S
Programming, deals more specifically with advanced programming issues. It was
released in 2000 and is now in its third printing. 
 
REGISTRATION: 
If you would like to register for this course please visit: 
http://www.insightful.com/services/register_european.asp
 
Karen Richardson
Sales and Marketing Administrator
[EMAIL PROTECTED]
Direct Line: +44 (0) 1256 339 822
Fax Number:  +44 (0) 1256 339 839

 

[[alternative HTML version deleted]]

__
[EMAIL PROTECTED] 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] glm with Newton Raphson

2004-11-19 Thread John Fox
Dear Roger and Valeska,

I have example that uses Newton-Raphson for logistic regression in my R and
S-PLUS Companion that might be of help. It's in the chapter script at
 (the
function lreg). See also the notes at
.

I hope this helps,
 John


John Fox
Department of Sociology
McMaster University
Hamilton, Ontario
Canada L8S 4M4
905-525-9140x23604
http://socserv.mcmaster.ca/jfox 
 

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of Roger D. Peng
> Sent: Friday, November 19, 2004 10:22 AM
> To: Valeska Andreozzi
> Cc: [EMAIL PROTECTED]
> Subject: Re: [R] glm with Newton Raphson
> 
> There are some examples of how to approach this in Modern 
> Applied Statistics with S, 4th ed. (chap. 16) by Venebles & 
> Ripley.  It's not Newton-Raphson but I think the code can be adapted.
> 
> -roger
> 
> Valeska Andreozzi wrote:
> > Hi,
> > 
> > Does anyone know if there is a function to find the maximum 
> likelihood 
> > estimates of glm using Newton Raphson metodology instead of 
> using IWLS.
> > 
> > Thanks
> > Valeska Andreozzi
> > 
> > 
> > Department of Epidemiology and Quantitative Methods FIOCRUZ 
> - National 
> > School of Public Health
> > Tel: (55) 21 2598 2872
> > Rio de Janeiro - Brazil
> > 
> > __
> > [EMAIL PROTECTED] mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide! 
> > http://www.R-project.org/posting-guide.html
> > 
> 
> --
> Roger D. Peng
> http://www.biostat.jhsph.edu/~rpeng/
> 
> __
> [EMAIL PROTECTED] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! 
> http://www.R-project.org/posting-guide.html

__
[EMAIL PROTECTED] 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] 3d Map with bars

2004-11-19 Thread partha_bagchi
Apologies in advance for the question. I am trying to draw a map of the US 
as a surface plot so that I would be able to drop bars on the different 
states (something like Uwe Ligges' scatterplot3d example 4). I am not sure 
where to start looking for such a beast. If anyone has any pointers, 
ideas, I will be grateful.

TIA,
Partha

__
[EMAIL PROTECTED] 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] accessing the attributes of a list inside lapply()

2004-11-19 Thread Spencer Graves
 Maybe I misunderstand your problem, but I wonder if you've 
considered "names": 

> l <- list(a = 1, b = 3, c = 'asd')
> names(l)
[1] "a" "b" "c"

 hope this helps.  spencer graves
p.s.  I can't parse your "lapply(l, get_attr)".  In R 1.9.1 and R 2.0.0 
Patched, I get the following: 

> lapply(l, get_attr)
Error in match.fun(FUN) : Object "get_attr" not found
Adrian Alexa wrote:
Hello R-users, 

I have the following problem, that I want to solve efficiently:
I have a named list, for example:
 

l <- list(a = 1, b = 3, c = 'asd')
l
   

$a
[1] 1
$b
[1] 3
$c
[1] "asd"
I know that I can iterate through it using lapply() function, but I
would also like to able to get the list names or some attributes of l
in the lapply(). For example if I use names() function in the call of
lapply() I get:
 

lapply(l, names)
   

$a
NULL
$b
NULL
$c
NULL
My question is if I can get something like:
 

lapply(l, get_attr)
   

$a
[1] a
$b
[1] b
$c
[1] c
I can do this very easy with a for() loop but my list is quite big and
I would like to get a decent running time. I don't need only the
attributes of the list(I can obtain them by using attributes() or
attr() function), but for my list the names of the elements are given
me information that I need. Also I must mention that the elements of
the list can by of any type.
Any solution is welcome.

Many thanks, 

Adrian 


 

--
Spencer Graves, PhD, Senior Development Engineer
O:  (408)938-4420;  mobile:  (408)655-4567
__
[EMAIL PROTECTED] 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] accessing the attributes of a list inside lapply()

2004-11-19 Thread Eric Lecoutre
Hi,
What about:
>  as.list(names(l))
[[1]]
[1] "a"
[[2]]
[1] "b"
[[3]]
[1] "c"
HTH,
Eric
At 15:59 19/11/2004, Adrian Alexa wrote:
Hello R-users,
I have the following problem, that I want to solve efficiently:
I have a named list, for example:
> l <- list(a = 1, b = 3, c = 'asd')
> l
$a
[1] 1
$b
[1] 3
$c
[1] "asd"
I know that I can iterate through it using lapply() function, but I
would also like to able to get the list names or some attributes of l
in the lapply(). For example if I use names() function in the call of
lapply() I get:
> lapply(l, names)
$a
NULL
$b
NULL
$c
NULL
My question is if I can get something like:
> lapply(l, get_attr)
$a
[1] a
$b
[1] b
$c
[1] c
I can do this very easy with a for() loop but my list is quite big and
I would like to get a decent running time. I don't need only the
attributes of the list(I can obtain them by using attributes() or
attr() function), but for my list the names of the elements are given
me information that I need. Also I must mention that the elements of
the list can by of any type.
Any solution is welcome.

Many thanks,
Adrian

--
Adrian Alexa
Max-Planck-Institut fuer Informatik
Stuhlsatzenhausweg 85 Room 514
66123 Saarbruecken, Germany
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
__
[EMAIL PROTECTED] 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] The hidden costs of GPL software?

2004-11-19 Thread Spencer Graves
My very dear Prof. Dalgaard:   

Peter Dalgaard wrote:
Argh. Please stop poking at my guilty conscience Wrapping Tcl/Tk
extensions as R packages has been on my wish list too for some time,
...
 You, of all people, should hardly have a guilty conscience about 
not doing enough on R!  I, and many others, are continually awed by the 
accomplishments of you and the rest of the R Core Team. 

 spencer graves
--
Spencer Graves, PhD, Senior Development Engineer
O:  (408)938-4420;  mobile:  (408)655-4567
__
[EMAIL PROTECTED] 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] function 'vcov' for coxph in R 2.0.0

2004-11-19 Thread Lei Liu
Hi there,
After I fitted a cox model, I used vcov to obtain the 
variance of the parameter estimate. It worked correctly in 
R 1.9.1. But it failed in R 2.0.0 and the error message is 

Error in vcov(cox.1) : no applicable method for "vcov"
I don't know if it is a bug or there is some update on 
this function. Thanks!

Lei Liu
Assistant Professor
Division of Biostatistics and Epidemiology
Dept. of Health Evaluation Sciences
School of Medicine
University of Virginia
3181 Hospital West Complex
Charlottesville, VA 22908-0717
1-434-982-3364 (o)
1-734-730-1395 (c)
[EMAIL PROTECTED]
[EMAIL PROTECTED]
__
[EMAIL PROTECTED] 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! a urgent question

2004-11-19 Thread an ying
Dear Sir/Madam,
 
I am doing a project related to R. 
However, it is always difficult find some R functions.
The R user guide seems not complete. 
Is there any free document about all R functions ?
Who knows ? please help me.
My email is [EMAIL PROTECTED] 
 
 
Thank you very much


-

 Meet the all-new My Yahoo! – Try it today! 
[[alternative HTML version deleted]]

__
[EMAIL PROTECTED] 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 with usepackage{} in Sweave under Quantian

2004-11-19 Thread Andreas Quandt
dear expeRts,
if i try to create a .tex file under Quantian 6.9.1 with sweave the 
command \usepackage{.../texmf/Sweave} will not added and the following 
compilation to a .pdf file failed. if i add the \usepackage line by 
myself all is going right. so what i am doing wrong because under mac os 
x 10.3 the \usepackage{} line is added automatically by sweave? In both 
cases i used xemacs/ess and R (all in the newest versions) to create the 
files.
thanks in advance for helping.

best wishes
andreas
__
[EMAIL PROTECTED] 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] The hidden costs of GPL software?

2004-11-19 Thread John Fox
Dear Peter,

> -Original Message-
> From: Peter Dalgaard [mailto:[EMAIL PROTECTED] 
> Sent: Friday, November 19, 2004 5:46 AM
> To: John Fox
> Cc: [EMAIL PROTECTED]
> Subject: Re: [R] The hidden costs of GPL software?
> 
> "John Fox" <[EMAIL PROTECTED]> writes:
> 
> > I don't think that
> > it would be hard (although it would be time-consuming) to produce a 
> > much broader extension, but the result (in my opinion) would be as 
> > dubiously useful as the GUIs for SAS or S-PLUS.
> 
> Strategically, that might actually be a valid (and valiant) 
> design goal! From my limited experience with Rcmdr and SAS 
> Analyst, I'd say that Rcmdr is almost there, just a few 
> little niggles like not remembering values from the last time 
> a form was filled in.
> 

I've thought about remembering dialog values, but I guess so far I've been
too lazy to do it or, to put a better construction on it, too distracted by
other things. It shouldn't be hard to do -- just a matter of maintaining a
data base of previous entries that are flushed when the active data set
changes. Actually, the linear-model and generalized-linear-model dialogs
already do this.

I'd be interested in the other little niggles as well.

> > By the way, if there were something I
> > could wish for here it would be a slightly broader set of 
> Tk widgets 
> > to be included with the Tcl/Tk that installs with R for 
> Windows, since 
> > using widgets outside of this set creates installation 
> obstacles for 
> > lower-level users.
> 
> Argh. Please stop poking at my guilty conscience Wrapping 
> Tcl/Tk extensions as R packages has been on my wish list too 
> for some time, with tktable as the obvious first candidate. 
> (It's not just on Windows; the default Unix/Linux installs of 
> Tcl/Tk tend to be pretty minimal too. On Windows we have this 
> instructive twist on the BSD/GPL debacle, that ActiveState 
> made a very nice Tcl/Tk distribution with all sorts of 
> "batteries included", but we cannot bundle it with R as they 
> are restricting redistribution.)
> 

I certainly don't want to press this issue, since I'm grateful for what
you've already done (and it's surprising how much mileage one can get from
the basic widget set). I see this as primarily a Windows problem because
users of other computing platforms (possibly with the exception of some Mac
users) tend to be more sophisticated about installing software.

Regards,
 John

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

__
[EMAIL PROTECTED] 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] The hidden costs of GPL software?

2004-11-19 Thread John Fox
Dear Philippe,

I was aware of your tcltk2 package and will likely use it (if the standard
widget set distributed with R for Windows is not expanded) when it becomes
cross-platform.

Thanks for this.
 John


John Fox
Department of Sociology
McMaster University
Hamilton, Ontario
Canada L8S 4M4
905-525-9140x23604
http://socserv.mcmaster.ca/jfox 
 

> -Original Message-
> From: Philippe Grosjean [mailto:[EMAIL PROTECTED] 
> Sent: Friday, November 19, 2004 3:29 AM
> To: 'John Fox'; [EMAIL PROTECTED]
> Subject: RE: [R] The hidden costs of GPL software?
> 
> John Fox wrote:
> > [...] (sorry, this is long mail, and I want to comment only 
> details) 
> > By the way, if there were something I could wish for here 
> it would be 
> > a slightly broader set of Tk widgets to be included with the Tcl/Tk 
> > that installs with R for Windows, since using widgets 
> outside of this 
> > set creates installation obstacles for lower-level users.
> 
> Then, take a look at the tcltk2 package in the SciViews 
> bundle (probably, in the next version, I will take it out of 
> the bundle). You have there tile (themable widgets with 
> notebook tabs, progress bar, and many more... and very soon 
> combo boxes and lists/trees). You have also the famous 
> tkTable, and a separate combobox and a tree, and a support 
> for tooltips everywhere...
> Just propose if you need more! All this runs under Windows, 
> but I still got problems to compile it under other platforms.
> 
> > I doubt that many list
> > members would look favourably on the statistical-methods "decision 
> > tree" in MicrOsiris, for example. One solution is to include PDF 
> > "manuals" with packages. I've done this, for example, with 
> my effects 
> > and Rcmdr packages.
> > The introductory manual supplied with Thomas Lumley's 
> survey package 
> > is another, similar example. Maybe there's a better way of 
> integrating 
> > such non-vignette manuals with the help system -- something like 
> > help(manual=package).
> 
> I tend to have the same opinion than John (although I thing 
> that both a good manual, and a better online help could be 
> beneficial): a PDF manual is much more readable than a wiki! 
> Why not to propose PDF manuals in the \doc section of CRAN 
> which have a GNU Free Documentation License 
> (http://www.gnu.org/copyleft/fdl.html), so that the manual 
> could be progressively enhanced by many authors?
> 
> Best,
> 
> Philippe Grosjean
> 
>

__
[EMAIL PROTECTED] 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] glm with Newton Raphson

2004-11-19 Thread Prof Brian Ripley
For canonical links they are the same thing (and the likelihood is 
log-concave), but in general NR is a poor optimizer without at least 
step-length adjustment.

MASS4 p.445 has an example of using a general optimizer for logistic 
regression.

On Fri, 19 Nov 2004, Valeska Andreozzi wrote:
Does anyone know if there is a function to find the maximum likelihood 
estimates of glm using Newton Raphson metodology instead of using IWLS.
--
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595
__
[EMAIL PROTECTED] 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] gibbs sampling for mixture of normals

2004-11-19 Thread Kahra Hannu
Matteo,

have a look at http://www.mrc-bsu.cam.ac.uk/bugs/faqs/contents.shtml and
BUGS http://www.mrc-bsu.cam.ac.uk/bugs/welcome.shtml.

Hannu Kahra 
Progetti Speciali 
Monte Paschi Asset Management SGR S.p.A. 
Via San Vittore, 37
IT-20123 Milano, Italia 

Tel.: +39 02 43828 754 
Mobile: +39 333 876 1558 
Fax: +39 02 43828 247 
E-mail: [EMAIL PROTECTED] 
Web: www.mpsam.it 



-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of matteo ruggiero
Sent: Thursday, November 18, 2004 7:42 PM
To: [EMAIL PROTECTED]
Subject: [R] gibbs sampling for mixture of normals


hi

i'm looking for a gibbs sampling algorithm for R for the case of mixture of K
normals, and in particular for the case of bivariate normals.
i'd be grateful if anyone could send its own R-routine, at least for the
univariate case.

thank you in advance
matteo

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

__
[EMAIL PROTECTED] 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] glm with Newton Raphson

2004-11-19 Thread Roger D. Peng
There are some examples of how to approach this in Modern Applied 
Statistics with S, 4th ed. (chap. 16) by Venebles & Ripley.  It's not 
Newton-Raphson but I think the code can be adapted.

-roger
Valeska Andreozzi wrote:
Hi,
Does anyone know if there is a function to find the maximum likelihood 
estimates of glm using Newton Raphson metodology instead of using IWLS.

Thanks
Valeska Andreozzi

Department of Epidemiology and Quantitative Methods
FIOCRUZ - National School of Public Health
Tel: (55) 21 2598 2872
Rio de Janeiro - Brazil
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! 
http://www.R-project.org/posting-guide.html

--
Roger D. Peng
http://www.biostat.jhsph.edu/~rpeng/
__
[EMAIL PROTECTED] 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: The hidden costs of GPL software?

2004-11-19 Thread Siddique, Amer
my quick thought:
R is a programming language and shouldn't be wrapped up in a GUI to serve
the interests of those too complacent to learn to leverage its power. 

and to echo others: I feel an IDE approach with, say, a code editor and a
hyperlinked help system with a richer set of examples is sufficient. we
already have the former. cheers

__
[EMAIL PROTECTED] 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] accessing the attributes of a list inside lapply()

2004-11-19 Thread Adrian Alexa
Hello R-users, 


I have the following problem, that I want to solve efficiently:


I have a named list, for example:

> l <- list(a = 1, b = 3, c = 'asd')
> l
$a
[1] 1

$b
[1] 3

$c
[1] "asd"


I know that I can iterate through it using lapply() function, but I
would also like to able to get the list names or some attributes of l
in the lapply(). For example if I use names() function in the call of
lapply() I get:


> lapply(l, names)
$a
NULL

$b
NULL

$c
NULL
 

My question is if I can get something like:


> lapply(l, get_attr)
$a
[1] a

$b
[1] b

$c
[1] c
 

I can do this very easy with a for() loop but my list is quite big and
I would like to get a decent running time. I don't need only the
attributes of the list(I can obtain them by using attributes() or
attr() function), but for my list the names of the elements are given
me information that I need. Also I must mention that the elements of
the list can by of any type.


Any solution is welcome.

 

Many thanks, 

Adrian 




-- 
Adrian Alexa 
Max-Planck-Institut fuer Informatik  
Stuhlsatzenhausweg 85 Room 514 
66123 Saarbruecken, Germany

__
[EMAIL PROTECTED] 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] Question on panel corrected standard errors by Beck and Katz

2004-11-19 Thread Kihong Eom
Dear colleagues, 

I am looking for a program which can run OLS with panel corrected standard
errors developed by Beck and Katz.  Thanks for your help in advance.

Kihong Eom, Ph.D.
539 Ross Hall
Iowa State University
Ames, IA 50011

__
[EMAIL PROTECTED] 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] glm with Newton Raphson

2004-11-19 Thread Valeska Andreozzi
Hi,
Does anyone know if there is a function to find the maximum likelihood 
estimates of glm using Newton Raphson metodology instead of using IWLS.

Thanks
Valeska Andreozzi

Department of Epidemiology and Quantitative Methods
FIOCRUZ - National School of Public Health
Tel: (55) 21 2598 2872
Rio de Janeiro - Brazil
__
[EMAIL PROTECTED] 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] Building package on Linux and Windows

2004-11-19 Thread michael watson (IAH-C)
No need, got it now :-)

Thanks
M

-Original Message-
From: michael watson (IAH-C) 
Sent: 19 November 2004 14:06
To: [EMAIL PROTECTED]
Subject: [R] Building package on Linux and Windows


Hi

OK, final stretch now, thank you to everyone who has helped!

(hopefully) final question - what does R CMD build actually do that
tar/gzip and WinZip do not?

I have successfully used R CMD build to create a .tar.gz version of my
package, which installs well and works under Linux - hurray!  I naively
thought that all I had to do now was create a .zip version (using
something like WinZip) and it would work on Windows too - wrong!

On Windows I get:

Error in file(file, "r") : unable to open connection
In addition: Warning messages: 
1: error -1 in extracting from zip file 
2: cannot open file `coXpress/DESCRIPTION' 

I didn't run R CMD build on Windows because I don't have "suitable
versions of Unix tools including make, sh, rm, sed, awk,mkdir, echo, cp
and cat; we have packaged a set at
http://www.murdoch-sutherland.com/Rtools/tools.zip.";.  Do I really have
to install all of these on my Windows machine to build a package?  

Asked another way - I have a linux .tar.gz file which works, how do I
make a windows version?

Thanks in advance!

Mick

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html

__
[EMAIL PROTECTED] 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] Building package on Linux and Windows

2004-11-19 Thread michael watson (IAH-C)
Hi

OK, final stretch now, thank you to everyone who has helped!

(hopefully) final question - what does R CMD build actually do that
tar/gzip and WinZip do not?

I have successfully used R CMD build to create a .tar.gz version of my
package, which installs well and works under Linux - hurray!  I naively
thought that all I had to do now was create a .zip version (using
something like WinZip) and it would work on Windows too - wrong!

On Windows I get:

Error in file(file, "r") : unable to open connection
In addition: Warning messages: 
1: error -1 in extracting from zip file 
2: cannot open file `coXpress/DESCRIPTION' 

I didn't run R CMD build on Windows because I don't have "suitable
versions of Unix tools including make, sh, rm, sed, awk,mkdir, echo, cp
and cat; we have packaged a set at
http://www.murdoch-sutherland.com/Rtools/tools.zip.";.  Do I really have
to install all of these on my Windows machine to build a package?  

Asked another way - I have a linux .tar.gz file which works, how do I
make a windows version?

Thanks in advance!

Mick

__
[EMAIL PROTECTED] 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] The hidden costs of GPL software?

2004-11-19 Thread Pfaff, Bernhard
Dear list member,

this thread as well as the first one started by Philippe about the
usefulness of a GUI is interesting and overwhelming alike. IMHO, it
wittnesses the greatness and superiority of R compared to other statistical
programming environments and programs: the core team and all people involved
with it. Everyday I am flabbergasted and amazed anew; learning new concepts,
programming tricks, statistical methods I was unfamiliar with and much much
more: kudos to all of you. Let me now toss in my two cents:

First cent: Comments about a GUI
Although I use Emacs/ESS and R batch mode mostly, a GUI is beneficial in
terms of teaching statistics and/or econometrics with R. This conclusion
draws upon experience nine years back, while I was giving, beside
econometric classes, computer labs at university. At that time we had only
commercial products at hand: RATS, GAUSS and EViews. From a students
perspective EViews (menu-driven) was the most convenient one. The
econometric method comprehension and the interpretation of its application
is of utmost importance. Hence, novices should concentrate on this to
familiarise themselves with the subject. Most of the students got scared and
distracted by learning a command driven programming language too, i.e. this
was too much to swallow at one time. With other words: do not challenge
novices to statistics/econometrics programmatically. A point mentioned by
Phillipe in an earlier email too. 
Now given Rcmdr: I like its flexibility and that everybody can tailormade
his own `version' by adding new menus and functionalities. So to speak, a
very decent ground work has been provided by John Fox and I appreciate it
alot. I can only speak for myself: I am currently writing an `urca' add-in
to Rcmdr, such that the package is more amenable to novice users in a
computer lab for example; that is: they do not have to worry about the
correct syntax or what can be achieved with which function. In order to do
so, two files are needed: one is an addendum to the menu's file and the
other one contains the R functions to be executed within Rcmdr. It is at the
leisure of the instructure to include these into Rcmdr. They can be shipped
in the package's /inst directory, for example. This seems to be a feasible
approach for other package maintainers working in different fields too. Or
would such an approach be to simple?

Second cent: help system
As voiced in earlier emails in this thread the R documentation, contributed
tutorials and the likes as well as the help facilities are indeed great. The
only snag, is a lack of an `easy to find' approach to be taken. Surely there
is help.search(), apropos, help.start() etc. etc. But what would be nice,
would be something similar to `texdoctk' for LaTeX document retrieval. That
is: categorise the manuals, package manuals, vignettes and other contributed
docs with respect to the catergory they belong to. Well, the snag is: who
does this labour intensive work? Hm, I am sceptic, but it might turn out
that this is not a feasible approach to be taken, but maybe my second
suggestion is: making greater use of \concepts and/or \keyword by providing
a file for download on CRAN that contains the \concepts entries & the
function & the package in which it is contained. One could then download
this file and execute a `zgrep' on it, as could be done likewise with a
contents file from an apt repository to find out which file is contained in
which rpm. The advantage would be the decentralisation of the work. It does
not take that long when each package maintainer utilises \concepts in his
.Rd files. Once, a package is contributed to CRAN, one could scan the
tarballs and extract the relevant information into the above mentioned file.
Another advantage would be, that users would find functions of packages that
are currently not in their search path, because the packages have not been
installed. And not a few questions on this list are answered by: `This
functionality is contained in package xyz'. Anyway, I will introduce
\concepts within the next release of `urca'.

Best Regards,
Bernhard   

> 
> "Philippe Grosjean" <[EMAIL PROTECTED]> writes:
> 
> > Peter,
> > 
> > You don't need the ActiveState Tcl distribution to add 
> extensions. If you
> > compile extensions yourself (and these extensions have a compatible
> > license), then you have no problems... (well, almost! You 
> must make sure
> > those extensions compile correctly on all supproted 
> platforms). This is
> > exactly what I do in the tcltk2 package.
> > Best,
> > 
> > Philippe Grosjean 
> 
> I know, it's just that it feels silly that we cannot build on the fine
> work of ActiveState.
> 
> -- 
>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] Legend

2004-11-19 Thread Losier, Randy J

I have recently converted from S-Plus (Dec Alpha) to R (Mandrake 10.0). The
differences are subtle but in some cases not easily converted. My Splus
Command plotting deck was over 1200 lines and R has simplified this down to
900 lines so far. I do a lot of mapping with polygons and I am trying to
figure out how to increase the default size of the fill boxes in the legend
call. Splus had a convienient rectangle call in the Key module that did
this. Will I have to use the lattice library for this functionality? Also,
how does one get around removing the grey background produce by the
following xyplot. The postscript works great but my boss wants the figures
for the Microsoft world.
Thanks 
Randy

Coding used for fill question?
dense <- rep(0,length(LTtempmean))
for(i in 1:length(LTtempmean)){
if(LTtempmean[i] < 2)dense[i]=5
else if(LTtempmean[i] >= 2 & LTtempmean[i] < 4)dense[i]=12
else if(LTtempmean[i] >= 4 & LTtempmean[i] < 6)dense[i]=30
else if(LTtempmean[i] >= 6 & LTtempmean[i] < 8)dense[i]=45
else if(LTtempmean[i] >= 8 & LTtempmean[i] < 10)dense[i]=62
else if(LTtempmean[i] >= 10)dense[i]=99}
dense <- paste("grey",dense,sep="")
axislong <- c(-68,-57)
axislat <- c(42,48)
par(fig=c(0,1.0,.43,1.0))
plot(axislong,axislat,type='n',xlim=c(-68,-57),err=-1,mgp=c(0,.5,0),
ylim=c(41.5,47.5),xlab="",ylab="",xaxt="n",cex=.8)
#plot Scotian Shelf Map
polygon(long,lat,density=-1,angle=45,border=F,col="grey",err=-1)
par(new=T,xaxt="n",yaxt="n")
#plot coastline outline
lines(longcoast,latcoast)
#Shade in Polygons   
polygon(strlong,strlat,border=T,density=-1,col=dense)  
polygon(strlong74,strlat74,border=T,density=-1,col=dense[30])
#Draw outlines of Strata
polygon(strlong,strlat,border=T,density=0)
par(cex=.8)
legend(-61.7,42.6,
c("Below 2.0","2.0 to 4.0","4.0 to 6.0","6.0 to 8.0","8.0 to 10.0","10 &
Above"),
 
fill=c('grey5','grey12','grey30','grey45','grey62','grey99'),ncol=2,bty="o",
bg='white')
text(-61.7,42.6,"Temperature Anomaly",adj=c(0,0))

##Coding used for grey background issue.
require(grid)
library(lattice)
background<-trellis.par.get("background")
background$col<-"transparent"
trellis.par.set("background",background)
caption<-"Figure 4: Time series of sampling depths for 4VW summer surveys.
Numbers\nin strip panels indicate strata locations. Closed circles represent
one sampled\nstation."
#function
format.figure<-function(latticePlot,caption){
vp1<-viewport(x=0,y=.08,width=1,height=.8,just=c("left","bottom"))
vp2<-viewport(x=0,y=0,width=1,height=.06,just=c("left","bottom"))
pushViewport(vp1)
print(latticePlot,newpage=F)
#grid.rect()
popViewport(1)
pushViewport(vp2)
grid.text(caption,x=.1,just=c("left","bottom"),gp=gpar(cex=.99))
#grid.rect()
popViewport(1)
}
#postscript("fig20.eps",horizontal=F,width=7.0,height=9.3)
png("fig20.png", bg = "transparent", width = 480, height = 640,pointsize =
12,  res = 1200)
caption <- "Figure 20: Time series of near-bottom salinities for 4X summer
surveys.\nNumbers in strip panels indicate strata locations. Closed circles
represent one\nsampled station."
randy <- xyplot(xsal~xyr | xstrat,type="p",ylab="Salinity
(psu)",xlab="Year",background="white",
pch=16,mkh=.03,
as.table=T,
strip = function(...) strip.default(..., style = 1))
format.figure(randy,caption)
dev.off()

[[alternative HTML version deleted]]

__
[EMAIL PROTECTED] 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-pkgs] new package gsl, a wrapper for the Gnu Scientific Library

2004-11-19 Thread Robin Hankin
Dear list
R package "gsl" is now on  CRAN.  This  is a wrapper for
the special functions of the Gnu Scientific Library (GSL).  Functions include
elliptic integrals, Airy functions, hypergeometric functions, and so on.
Most functions optionally return error estimates.
This library is a little odd in that documentation is limited to a 
pointer to the GSL reference
manual, and occasional re-productions of tables and figures from 
Abramowitz and Stegun.

It passes R CMD check  under Fedora Linux, and MacOSX 10.3 if the GSL
(version 1.5)  is installed in the default locations.
A windows version is available at  http://www.stats.ox.ac.uk/pub/RWin/2.0.0/

(also, a big Thank You to Kurt Hornik for advice on configure.ac)

--
Robin Hankin
Uncertainty Analyst
Southampton Oceanography Centre
SO14 3ZH
tel +44(0)23-8059-7743
[EMAIL PROTECTED] (edit in obvious way; spam precaution)
___
R-packages mailing list
[EMAIL PROTECTED]
https://stat.ethz.ch/mailman/listinfo/r-packages
__
[EMAIL PROTECTED] 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] Creating logical value from the difference of two absolute values

2004-11-19 Thread Douglas Bates
Nathan Leon Pace, MD, MStat wrote:
Hi,
Using R 2.0.1 on Mac g5 running Mac OS X 10.3.6.
I would expect that
abs(.7 - .5) >= abs(.3 - .5) should be returned TRUE.
Instead
 > www <- abs(.7 - .5) >= abs(.3 - .5)
 > www
[1] FALSE
Is this a result of floating point or the implementation of abs or 
something else?
Due to floating point arithmetic in general, not specifically the abs 
function.  The number .5 will have an exact floating point 
representation but .3 and .7 will not.  Making equality comparisons with 
floating point values is always risky.

In a function I need to compare two absolute values - each being of the 
form |variable - constant|.
On a Mac I get
> abs(.7-.5) - abs(.3-.5)
[1] -5.551115e-17
so you need to make a relative comparison, not an absolute comparison. 
You could write the relative comparison using the all.equal function, 
such as

> v1 <- abs(.7-.5)
> v2 <- abs(.3-.5)
> (v1 > v2) || all.equal(v1, v2)
[1] TRUE
__
[EMAIL PROTECTED] 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] The hidden costs of GPL software?

2004-11-19 Thread Mike Prager
At 09:45 PM 11/18/2004, John Fox wrote:
[...]
6) As has been pointed out, e.g., by Duncan Murdoch, solving the
function-locating problem is best done by a method or methods that
automatically accommodate the growing and changing set of contributed
packages on CRAN.  Why not, as previously has been proposed, replace the
current static (and, in my view, not very useful) set of keywords in R
documentation with the requirement that package authors supply their own
keywords for each documented object? I believe that this is the intent of
the concept entries in Rd files, but their use certainly is not required or
even actively encouraged. (They're just mentioned in passing in the Writing
R Extensions manual.) [...]
That should prove extremely helpful.  Would it be practical to have the 
complete index installed with base R?  That would help identify useful 
packages not yet in a user's installation.

--
Michael Prager, Ph.D.<[EMAIL PROTECTED]>
NOAA Beaufort Laboratory
Beaufort, North Carolina  28516
http://shrimp.ccfhrb.noaa.gov/~mprager/
***
__
[EMAIL PROTECTED] 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] The hidden costs of GPL software?

2004-11-19 Thread Peter Dalgaard
"Philippe Grosjean" <[EMAIL PROTECTED]> writes:

> Peter,
> 
> You don't need the ActiveState Tcl distribution to add extensions. If you
> compile extensions yourself (and these extensions have a compatible
> license), then you have no problems... (well, almost! You must make sure
> those extensions compile correctly on all supproted platforms). This is
> exactly what I do in the tcltk2 package.
> Best,
> 
> Philippe Grosjean 

I know, it's just that it feels silly that we cannot build on the fine
work of ActiveState.

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

__
[EMAIL PROTECTED] 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] Tools for data preparation?

2004-11-19 Thread Liaw, Andy
My choices are (in the order of my preference):

- use connections and readLines()/strsplit()/etc. in R to process the file a
chunk at a time

- use cut/paste/grep/etc., perhaps within pipe() in R

- use awk, perhaps within pipe() in R

- Python is my last resort, as I'm not familiar with it

The first preference is to do it all in R, mostly for the reason that I can
keep track of what was done all in one place (the R script or function).

Andy

> From: David Mitchell
> 
> Hello list,
> 
> I'm regularly in the position where I have to do a lot of data
> manipulation, in order to get the data I have into a format R is happy
> with.  This manipulation would generally be in one of two forms:
> - getting data from e.g. text log files into a tabular format
> - extracting sensible sample data from a very large data set (i.e. too
> large for R to handle)
> 
> In general, I use Perl or Python to do the task; I'm curious as to
> what others use when they hit the same problem.
> 
> Regards
> 
> Dave Mitchell
> 
> __
> [EMAIL PROTECTED] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! 
> http://www.R-project.org/posting-guide.html
> 
>

__
[EMAIL PROTECTED] 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] The hidden costs of GPL software?

2004-11-19 Thread Philippe Grosjean
 
Peter Dalgaard wrote:
> [...]
> Strategically, that might actually be a valid (and valiant) 
> design goal! From my limited experience with Rcmdr and SAS 
> Analyst, I'd say that Rcmdr is almost there, just a few 
> little niggles like not remembering values from the last time 
> a form was filled in.

Humm, in my view, this is a feature! The first time the user calls the form,
it creates the corresponding R script. If the user needs to make
corrections, or to run the analysis a second time, he is now supposed to
work with this script! By not remembering last values in a dialog box, Rcmdr
makes the script edition more obvious than recalling the dialog box
again,... even for lazy people! Otherwise, you are sure that those lazy
people will not switch to script: they will call the same dialog box again
and again.

Of course, one has to explain to the students that this is a feature.
Otherwise, it may look like a bad design, especially in comparison with
other "better designed" GUIs!

Best,

Philippe Grosjean

> [...]

__
[EMAIL PROTECTED] 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] The hidden costs of GPL software?

2004-11-19 Thread Philippe Grosjean
Peter,

You don't need the ActiveState Tcl distribution to add extensions. If you
compile extensions yourself (and these extensions have a compatible
license), then you have no problems... (well, almost! You must make sure
those extensions compile correctly on all supproted platforms). This is
exactly what I do in the tcltk2 package.
Best,

Philippe Grosjean 

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of Peter Dalgaard
> Sent: Friday, November 19, 2004 11:46 AM
> To: John Fox
> Cc: [EMAIL PROTECTED]
> Subject: Re: [R] The hidden costs of GPL software?
> 
> "John Fox" <[EMAIL PROTECTED]> writes:
> 
> > I don't think that
> > it would be hard (although it would be time-consuming) to produce a 
> > much broader extension, but the result (in my opinion) would be as 
> > dubiously useful as the GUIs for SAS or S-PLUS.
> 
> Strategically, that might actually be a valid (and valiant) 
> design goal! From my limited experience with Rcmdr and SAS 
> Analyst, I'd say that Rcmdr is almost there, just a few 
> little niggles like not remembering values from the last time 
> a form was filled in.
> 
> > By the way, if there were something I
> > could wish for here it would be a slightly broader set of 
> Tk widgets 
> > to be included with the Tcl/Tk that installs with R for 
> Windows, since 
> > using widgets outside of this set creates installation 
> obstacles for 
> > lower-level users.
> 
> Argh. Please stop poking at my guilty conscience Wrapping 
> Tcl/Tk extensions as R packages has been on my wish list too 
> for some time, with tktable as the obvious first candidate. 
> (It's not just on Windows; the default Unix/Linux installs of 
> Tcl/Tk tend to be pretty minimal too. On Windows we have this 
> instructive twist on the BSD/GPL debacle, that ActiveState 
> made a very nice Tcl/Tk distribution with all sorts of 
> "batteries included", but we cannot bundle it with R as they 
> are restricting redistribution.)
> 
> 
> -- 
>O__   Peter Dalgaard Blegdamsvej 3  
>   c/ /'_ --- Dept. of Biostatistics 2200 Cph. N   
>  (*) \(*) -- University of Copenhagen   Denmark  Ph: 
> (+45) 35327918
> ~~ - ([EMAIL PROTECTED]) FAX: 
> (+45) 35327907
> 
> __
> [EMAIL PROTECTED] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! 
> http://www.R-project.org/posting-guide.html
> 
>

__
[EMAIL PROTECTED] 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] The hidden costs of GPL software?

2004-11-19 Thread Peter Dalgaard
"John Fox" <[EMAIL PROTECTED]> writes:

> I don't think that
> it would be hard (although it would be time-consuming) to produce a much
> broader extension, but the result (in my opinion) would be as dubiously
> useful as the GUIs for SAS or S-PLUS. 

Strategically, that might actually be a valid (and valiant) design
goal! From my limited experience with Rcmdr and SAS Analyst, I'd say
that Rcmdr is almost there, just a few little niggles like not
remembering values from the last time a form was filled in.

> By the way, if there were something I
> could wish for here it would be a slightly broader set of Tk widgets to be
> included with the Tcl/Tk that installs with R for Windows, since using
> widgets outside of this set creates installation obstacles for lower-level
> users.

Argh. Please stop poking at my guilty conscience Wrapping Tcl/Tk
extensions as R packages has been on my wish list too for some time,
with tktable as the obvious first candidate. (It's not just on
Windows; the default Unix/Linux installs of Tcl/Tk tend to be pretty
minimal too. On Windows we have this instructive twist on the BSD/GPL
debacle, that ActiveState made a very nice Tcl/Tk distribution with
all sorts of "batteries included", but we cannot bundle it with R as
they are restricting redistribution.)


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

__
[EMAIL PROTECTED] 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] More problems checking an R package

2004-11-19 Thread Uwe Ligges
michael watson (IAH-C) wrote:
Hi
I am having a few more miscellaneous problems when I run R CMD check on
my package.
All of the early stuff works OK.  I get a WARNING at the "checking S3
generic/method consistency" stage, where it seems to think two of my
fucntions are inconsistent with plot() (I don't understand why it thinks
that).
I then get another WARNING indicating that I have an undocumented data
set called ".Traceback", but I can't find anything called .Traceback on
my entire system.
Finally, all my examples run fine, all my Latex is checked and that's
OK, and I get:
* creating mypackage-manual.tex ... OK
* checking mypackage-manual.tex ... ERROR
LaTeX errors when creating DVI version.
This typically indicates Rd problems.
See the log file in the check directory, it shows where the error comes 
from.


This is in contrast to the first line of the output which states:
* checking for working latex ... OK
So I'm kind of stuck here.  I'd like to ask if there is something I can
use to check my Rd files WITHOUT having to run the examples, as the
examples all take about 30 minutes to run, and so it's not a quick
bug-tracking cycle...
R CMD check --help  tells you:
R CMD check --no-examples .
Uwe Ligges

Any ideas, comments welcome!
Thanks
Mick
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
__
[EMAIL PROTECTED] 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] Where has the Debian respository gone?

2004-11-19 Thread Christoph Bier
Dirk Eddelbuettel schrieb am 19.11.2004 00:05

> On Thu, Nov 18, 2004 at 08:21:04PM +, Chris Evans wrote:

[...]

>>Any chance I can be useful?  Could I team up with someone who really
>>knows what s/he is doing but doesn't use Debian stable and work this
>>together?
>>
>>Let me know, I'd love to put something very direct back into the R project.
> 
> Thanks a bunch -- I'll follow up off-list!

Include me, if you want. I have very less time at the moment (and
the near future) but maybe I can be useful, too (e.g. in compiling).

Regards,
Christoph

__
[EMAIL PROTECTED] 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] The hidden costs of GPL software?

2004-11-19 Thread Prof Brian Ripley
On Fri, 19 Nov 2004, Bill Northcott wrote:
  If the GPL were not so tight on this point, someone could
commercialize a GUI for R without having to offer their source code
under the GPL.
There is nothing in GPL to stop a commercial GUI for R.  Have a look at what 
Apple do.  They have a complete commercial GUI and numerous applications 
built on a an almost completely GPL'ed operating system.  There are loads of 
shareware GUIs which drive GPL utilities.  Most obviously there are plenty of 
commercial apps which run on GNU Linux.
Perhaps you could look at earlier replies, for as Thomas Lumley said in
  https://stat.ethz.ch/pipermail/r-help/2004-November/059625.html
  `A GUI that ran R just by sending commands to stdin and getting results
  from stdout could clearly be proprietary without violating the GPL.  The
  question of exactly what level of closer integration is allowed would
  get complicated and I won't speculate.'
I will speculate as far as to say that the Free Software Foundation seems 
to regard the degree of integration that involves linking against libR.so 
or R.dll as subject to the `based on' provisions of GPL: for example

  http://www.gnu.org/licenses/gpl-faq.html#MereAggregation
says
  Combining two modules means connecting them together so that they form a
  single larger program. If either part is covered by the GPL, the whole
  combination must also be released under the GPL--if you can't, or won't,
  do that, you may not combine them.
  What constitutes combining two parts into one program? This is a legal
  question, which ultimately judges will decide. We believe that a proper
  criterion depends both on the mechanism of communication (exec, pipes,
  rpc, function calls within a shared address space, etc.) and the
  semantics of the communication (what kinds of information are interchanged).
  If the modules are included in the same executable file, they are
  definitely combined in one program. If modules are designed to run
  linked together in a shared address space, that almost surely means combining
  them into one program.
  By contrast, pipes, sockets and command-line arguments are communication
  mechanisms normally used between two separate programs. So when they are
  used for communication, the modules normally are separate programs. But if
  the semantics of the communication are intimate enough, exchanging
  complex internal data structures, that too could be a basis to consider the 
two
  parts as combined into a larger program.
--
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595
__
[EMAIL PROTECTED] 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] Clipboard under Linux/Unix

2004-11-19 Thread Ted Harding
On 19-Nov-04 Philippe Grosjean wrote:
> Hello,
> 
> This may be a trivial question, but I don't find the answer
> in R online help. Under Windows, I can copy/paste to the
> clipboard using readClipboard()/writeClipboard(), or something
> like cat(..., file = "clipboard"). Are there equivalent function
> for other platforms?
> Best,
> 
> Philippe Grosjean

Hi Philippe,
Leaving aside the situation described by Brian, where the network
is set up to prevent it, normally in Unix/Linux running X windows
you could in certain circumstances (see below) do it transparantly
over the net between machines, as well as within the machine you
are working on, under program control.

Of course there is the usual "block-copy using mouse left button
and paste using mouse middle button" manoeuvre, but -- provided
you have WindowMaker installed (part of GNUstep, the NeXTstep
emulator; you don't need to be running WindowMaker, only to
have the relevant binaries available as /usr/X11R6/bin/wxcopy
and /usr/X11R6/bin/wxpaste) -- then there are also two commands
which put it under program control, especially useful for larger
blocks of text.

1. From 'man wxcopy':

wxcopy(1x) wxcopy(1x)
NAME
   wxcopy - copy stdin or file into cutbuffer
SYNOPSIS
   wxcopy [options] [filename]
DESCRIPTION
   wxcopy  copies stdin or filename into the cutbuffer. If no
   cutbuffer is specified, the data will be copied into  cut-
   buffer 0 and the other cutbuffers will be rotated, if pre-
   sent.  If a cutbuffer is specified,  the  data  is  copied
   into  that  cutbuffer,  and no rotation of buffers is per-
   formed.

2. From 'man wxpaste':

wxpaste(1x)   wxpaste(1x)
NAME
   wxpaste - output a cutbuffer to stdout
SYNOPSIS
   wxpaste [options]
DESCRIPTION
   wxpaste outputs the contents of the specified cutbuffer to
   stdout. If no cutbuffer is specified, the cutbuffer 0 will
   be used as default.

(Read the man pages in full for information on the options, etc.)

Using these two commands, you should be able to write an R function
(using 'system()' function to invoke these commands) which does
what you want; you will probably need to exploit the Unix-type
redirection methods as well, e.g. to redirect stdout from 'wpaste'
as in

  wpaste > file.to.paste.into

As a trivial example:

  wxcopy < file1
  wxpaste > file2

Then file2 will contain a copy of the contents of file1.

To illustrate how it works (as typed in):
-
wxcopy << EOT
This is something  
I want to copy into the cut buffer
and then
paste into the file
"mycopy"
EOT

wxpaste > mycopy

and this gives the contents of the file mycopy:
---
cat mycopy
This is something  
I want to copy into the cut buffer
and then
paste into the file
"mycopy"


Hoping this helps,
Ted.



E-Mail: (Ted Harding) <[EMAIL PROTECTED]>
Fax-to-email: +44 (0)870 094 0861  [NB: New number!]
Date: 19-Nov-04   Time: 09:49:19
-- XFMail --

__
[EMAIL PROTECTED] 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] Tools for data preparation?

2004-11-19 Thread Ted Harding
On 19-Nov-04 David Mitchell wrote:
> Hello list,
> 
> I'm regularly in the position where I have to do a lot of data
> manipulation, in order to get the data I have into a format R
> is happy with.  This manipulation would generally be in one of
> two forms:
> - getting data from e.g. text log files into a tabular format
> - extracting sensible sample data from a very large data set
> (i.e. too large for R to handle)
> 
> In general, I use Perl or Python to do the task; I'm curious
> as to what others use when they hit the same problem.

I generally use 'awk' with help from 'sed' when needed.
This is on the same lines as your choice though lighter-weight
and less powerful (but I've never had a case that needed more).

Since the sort of task you describe is basically on a line-by-line
basis (and what's meant by a "line" can be pretty flexible in 'awk'),
this sort of thing can be done straightforwardly; but greater
flexibility is also possible.

E.g. it is easy to extract a line from the input, or apply a certain
transformation to fields in a line, if & only if it has already been
preceded by a line satisfying a certain condition, and so on.

Best wishes,
Ted.



E-Mail: (Ted Harding) <[EMAIL PROTECTED]>
Fax-to-email: +44 (0)870 094 0861  [NB: New number!]
Date: 19-Nov-04   Time: 08:56:47
-- XFMail --

__
[EMAIL PROTECTED] 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] More problems checking an R package

2004-11-19 Thread michael watson (IAH-C)
Hi

I am having a few more miscellaneous problems when I run R CMD check on
my package.

All of the early stuff works OK.  I get a WARNING at the "checking S3
generic/method consistency" stage, where it seems to think two of my
fucntions are inconsistent with plot() (I don't understand why it thinks
that).

I then get another WARNING indicating that I have an undocumented data
set called ".Traceback", but I can't find anything called .Traceback on
my entire system.

Finally, all my examples run fine, all my Latex is checked and that's
OK, and I get:

* creating mypackage-manual.tex ... OK
* checking mypackage-manual.tex ... ERROR
LaTeX errors when creating DVI version.
This typically indicates Rd problems.

This is in contrast to the first line of the output which states:

* checking for working latex ... OK

So I'm kind of stuck here.  I'd like to ask if there is something I can
use to check my Rd files WITHOUT having to run the examples, as the
examples all take about 30 minutes to run, and so it's not a quick
bug-tracking cycle...

Any ideas, comments welcome!

Thanks
Mick

__
[EMAIL PROTECTED] 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 to rewrite this without a loop ?

2004-11-19 Thread Stijn Lievens
Thomas Lumley wrote:
On Thu, 18 Nov 2004, Stijn Lievens wrote:

add.fun <- function(perf.data) {
  ss <- 0
  for (i in 0:29) {
  ss <- ss + cor(subset(perf.data, dataset == i)[3], 
subset(perf.data, dataset == i)[7], method = "kendall")
  }
  ss}


As one can see this function uses a for-loop.  Now chapter 9 of 'An 
introduction to R' tells us that we should avoid for-loops as much as 
possible.

You don't say whether `dataset' is the name of a column in `perf.data'. 
Assuming it is, and assuming that 0:29 are all the values of `dataset'

sum(by(perf.data, list(perf.data$dataset),
  function(d)  cor(d[,3],d[,7], method="kendall")))
would work.  
Indeed, this works.  The 'by' command is exactly what I was looking for.
As far as I can tell, this useful command it isn't mentioned in 'An 
introduction to R'.

If this is faster it will be because you don't call 
subset() twice per iteration, rather than because you are avoiding a 
loop.  However it has other benefits: it doesn't have the variable `i', 
it doesn't have to change the value of `ss', and it doesn't have the 
range of `dataset' hard-coded into it.  These are all clarity 
optimisations.

In fact I don't care too much about speed at the moment, but a one-line 
statement is more convenient to type (and recall) in the command line 
interface then a multi-line statmement.

Your solution really does the trick for me.  Thanks,
Stijn.

-thomas
__
[EMAIL PROTECTED] 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] Tools for data preparation?

2004-11-19 Thread Marc Mamin
Hello David,


I had the same problem with log files containing many fields separated by the 
"|" character.

My task was to extract parts of some fields with regular expression and 
normalize the result to compact them (using R functions factor and table)

To reduce the data size, I first split the logfile into "subfiles" containing 
only one field from the original data.
So I could process one field after the other instead of loading the complete 
log file.

under Linux:

cutfile<-function(index,afile,tmpdir,wd){
#index: list of fields to keep
#afile: logfile
setwd(wd)
system(paste('for n  in ',index,'; \n',
 'do sudo gzip -dc ',afile,' | cut -f$n -d"|" > ',tmpdir,'/',afile,'.$n 
\n',
 'done;',sep=''))
return(1)
}

exampe: cutfile(c(1,5,8),'mylog',outputdir,sourcedir)

=> files mylog,1, mylog.5, mylog.8

HTH,

Marc Mamin


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of David Mitchell
Sent: Friday, November 19, 2004 4:54 AM
To: [EMAIL PROTECTED]
Subject: [R] Tools for data preparation?


Hello list,

I'm regularly in the position where I have to do a lot of data
manipulation, in order to get the data I have into a format R is happy
with.  This manipulation would generally be in one of two forms:
- getting data from e.g. text log files into a tabular format
- extracting sensible sample data from a very large data set (i.e. too
large for R to handle)

In general, I use Perl or Python to do the task; I'm curious as to
what others use when they hit the same problem.

Regards

Dave Mitchell

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

__
[EMAIL PROTECTED] 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] The hidden costs of GPL software?

2004-11-19 Thread Bill Northcott
  If the GPL were not so tight on this point, someone could
commercialize a GUI for R without having to offer their source code
under the GPL.
There is nothing in GPL to stop a commercial GUI for R.  Have a look at 
what Apple do.  They have a complete commercial GUI and numerous 
applications built on a an almost completely GPL'ed operating system.  
There are loads of shareware GUIs which drive GPL utilities.  Most 
obviously there are plenty of commercial apps which run on GNU Linux.

Bill Northcott
__
[EMAIL PROTECTED] 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] The hidden costs of GPL software?

2004-11-19 Thread Philippe Grosjean
John Fox wrote:
> [...] (sorry, this is long mail, and I want to comment only details)
> By the way, if there were 
> something I could wish for here it would be a slightly 
> broader set of Tk widgets to be included with the Tcl/Tk that 
> installs with R for Windows, since using widgets outside of 
> this set creates installation obstacles for lower-level users.

Then, take a look at the tcltk2 package in the SciViews bundle (probably, in
the next version, I will take it out of the bundle). You have there tile
(themable widgets with notebook tabs, progress bar, and many more... and
very soon combo boxes and lists/trees). You have also the famous tkTable,
and a separate combobox and a tree, and a support for tooltips everywhere...
Just propose if you need more! All this runs under Windows, but I still got
problems to compile it under other platforms.

> I doubt that many list 
> members would look favourably on the statistical-methods 
> "decision tree" in MicrOsiris, for example. One solution is 
> to include PDF "manuals" with packages. I've done this, for 
> example, with my effects and Rcmdr packages.
> The introductory manual supplied with Thomas Lumley's survey 
> package is another, similar example. Maybe there's a better 
> way of integrating such non-vignette manuals with the help 
> system -- something like help(manual=package).

I tend to have the same opinion than John (although I thing that both a good
manual, and a better online help could be beneficial): a PDF manual is much
more readable than a wiki! Why not to propose PDF manuals in the \doc
section of CRAN which have a GNU Free Documentation License
(http://www.gnu.org/copyleft/fdl.html), so that the manual could be
progressively enhanced by many authors?

Best,

Philippe Grosjean

__
[EMAIL PROTECTED] 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] Clipboard under Linux/Unix

2004-11-19 Thread Prof Brian Ripley
On Fri, 19 Nov 2004, Philippe Grosjean wrote:
This may be a trivial question, but I don't find the answer in R online
help. Under Windows, I can copy/paste to the clipboard using
readClipboard()/writeClipboard(), or something like cat(..., file =
"clipboard"). Are there equivalent function for other platforms?
No.  There is not necessarily even the equivalent of a clipboard; I am 
typing this in a terminal session on a remote computer that has no access 
to the clipboard on my local windowing system (nor even to my local 
display: for performance reasons the X11 connection is not forwarded, 
and even if it were, I do the same thing from my Windows laptop and 
there Exceed and Windows have separate clipboards in different formats).

Please do use R-devel and not R-help for programming questions: see the 
posting guide.

--
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595
__
[EMAIL PROTECTED] 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 to get to interesting part of pattern match

2004-11-19 Thread Peter Wolf
Vadim Ogranovich wrote:
Hi,
I am looking for a way to extract an "interesting" part of the match to
a regular expression. For example the pattern "[./](*.)" matches a
substring that begins with either "." or "/" followed by anything. I am
interested in this "anything" w/o the "." or "/" prefix. If say I match
the pattern against "abc/foo" I want to get "foo", not "/foo". In Perl
one can simply wrap the "interesting" part in () and get it out of the
match. Is it possible to do a similar thing in R?
There seems to be a way to refer to the match, see below, but I couldn't
figure out how to make gsub return it.
 

gsub("[./](*.)", "\\1", "abc/foo")
   

[1] "abcfoo"
Thanks,
Vadim
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
 

what about:
gsub(".*[./](*.)", "\\1", "abc/foo")
output-start
[1] "foo"
output-end
or try:
strsplit("abc/foo","/")[[1]][2]
output-start
[1] "foo"
output-end
Peter Wolf
__
[EMAIL PROTECTED] 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] Clipboard under Linux/Unix

2004-11-19 Thread Philippe Grosjean
Hello,

This may be a trivial question, but I don't find the answer in R online
help. Under Windows, I can copy/paste to the clipboard using
readClipboard()/writeClipboard(), or something like cat(..., file =
"clipboard"). Are there equivalent function for other platforms?
Best,

Philippe Grosjean

..<°}))><
 ) ) ) ) )
( ( ( ( (Prof. Philippe Grosjean
 ) ) ) ) )
( ( ( ( (Numerical Ecology of Aquatic Systems
 ) ) ) ) )   Mons-Hainaut University, Pentagone
( ( ( ( (Academie Universitaire Wallonie-Bruxelles
 ) ) ) ) )   6, av du Champ de Mars, 7000 Mons, Belgium  
( ( ( ( (   
 ) ) ) ) )   phone: + 32.65.37.34.97, fax: + 32.65.37.33.12
( ( ( ( (email: [EMAIL PROTECTED]
 ) ) ) ) )  
( ( ( ( (web:   http://www.umh.ac.be/~econum
 ) ) ) ) )
..

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html