Re: [R] http proxies: setting and unsetting

2007-05-30 Thread Gabor Grothendieck
One other point.  If you find you need to set a system or user environment
variable then microsoft has a free tool called setx.exe that you can find here:

http://support.microsoft.com/kb/927229

You can do this from within R using system().

On 5/30/07, Gabor Grothendieck [EMAIL PROTECTED] wrote:
 On 5/29/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
  OK, I think I get that... do you know which namespace the Sys.setenv() 
  function affects?  Do you know if there are functions in R that can alter 
  the user/system/process environment variables?
 

 Use the R Sys.getenv() command to get the process environment variables.
 To get user and system environment variables, from the Desktop right click on
 My Computer and choose Properties.  Then choose the Advanced tab
 and click on the Environment Variables button near the bottom of the
 window that appears.


__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] [R-pkgs] new packages psyphy and MLDS

2007-05-30 Thread ken knoblauch
New packages psyphy and MLDS are available on CRAN:

psyphy ncludes an assortment of functions
  useful in  analyzing data from pyschophysical experiments. It
   includes functions for calculating d' from several
   different experimental designs, links for mafc to be
   used with the binomial family in glm (and possibly
   other contexts) and selfStart functions for estimating gamma values
  for CRT (and possibley other RGB) screen calibration data.

MLDS implements analyses for Maximum Likelihood Difference Scaling.
Difference scaling is a method for scaling perceived super-threshold
differences. The package contains functions that allow the user to fit
the resulting data by maximum likelihood and to test the internal 
validity
of the estimated scale.   There are also example functions that might
be used to design and run a difference scaling experiment,

Any suggestioins, criticisms, bug-reports, etc. are always welcome.

Best,

Ken Knoblauch

-- 
Ken Knoblauch
Inserm U846
Institut Cellule Souche et Cerveau
Département Neurosciences Intégratives
18 avenue du Doyen Lépine
69500 Bron
France
tel: +33 (0)4 72 91 34 77
fax: +33 (0)4 72 91 34 61
portable: +33 (0)6 84 10 64 10
http://www.pizzerialesgemeaux.com/u846/

___
R-packages mailing list
[EMAIL PROTECTED]
https://stat.ethz.ch/mailman/listinfo/r-packages

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] [R-pkgs] DPpackage - New version

2007-05-30 Thread Alejandro Jara Vallejos
Dear List:

I have uploaded version 1.0-4 of DPpackage on CRAN. Since the first  
version (1.0-0), I have not communicated the improvements of the  
package. I'll use this email to summarize its current status.

The name of the package is motivated by the Dirichlet process.  
However, DPpackage tries to be a general package for Bayesian  
nonparametric and semi-parametric data analysis. So far, the package  
includes models based on Dirichlet processes, Dirichlet process  
mixtures of normals, Polya trees, and Random Bernstein polynomials. A  
list of current functions is given next:

1) Density estimation: DPdensity (using DPM of normals), PTdensity  
(using Mixtures of Polya Trees), and BDPdensity (using  
Bernstein-Dirichlet prior). The first two functions allow uni- and  
multi-variate analysis.

2) Nonparametric random effects distributions in mixed effects models:

2.1) DPlmm and DPMlmm, using a DP/MDP and DPM of normals prior,  
respectively, for the linear mixed effects model.

2.2) DPglmm and DPMglmm, using a DP/MDP and DPM of normals prior,  
respectively, for generalized linear mixed effects models,  
respectively. The sampling(link) considered by these functions are  
binomial(logit,probit), poisson(log) and gamma(log).

2.3) DPolmm and DPMolmm, using a DP/MDP and DPM of normals prior,  
respectively, for the probit-ordinal mixed effects models.

2.4) DPrasch and FPTrasch, using a DP/MDP and finite PT/MPT  
(mixture of Polya Trees) prior for the Rasch model with binary  
sampling distribution, respectively.

2.5) DPraschpoisson and FPTraschpoisson. The same as before (2.4)  
but with a Poisson sampling.

2.6) DPmeta and DPMmeta for the random (mixed) effects  
meta-analysis models, using a DP/MDP and DPM of normals prior,  
respectively.

3) Binary regression with nonparametric link:

3.1) CSDPbinary, using Newton, Czado and Chappell (1996)'s  
centrally standardized DP prior.

3.2) DPbinary, using the regular DP prior for the inverse of the  
link function.

3.3) FPTbinary, using a finite PT prior for the inverse of the  
link function.


4) AFT model for interval-censored data:

4.1) DPsurvint, using a MDP prior for the baseline distribution.

5) ROC curve estimation:

5.1) DProc, using DPM of normals.

6) Linear model with a nonparametric for the error distribution:

6.1) PTlm, using MPT.

7) DP prior elicitation:

7.1) DPelicit, using the exact and approximated formulas for the  
mean and variance of the number of clusters given the total mass  
parameter and the number of subjects.


Tim Hanson and Fernando Quintana have made contributions to the  
current version. I would also like to thank George Karabatsos for his  
input to the current status of the package and Peter Mueller for  
actively promoting the package.

Various other improvements have been motivated by questions asked by  
many people around the world. I would like to thank all of them too.

I welcome anyone who sends comments, suggestions, remarks, and  
particularly those who find bugs or mistakes in any part of the  
package or its documentation. DPpackage is an open source program for  
Bayesian nonparametric developments. All contributions are welcome.

Best regards,

Alejandro.


Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm

___
R-packages mailing list
[EMAIL PROTECTED]
https://stat.ethz.ch/mailman/listinfo/r-packages

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] functions without arguments

2007-05-30 Thread elyakhlifi mustapha
hello,
I wanna know if it's possible to write functions without argument 
in order to understand that I write down an example

f - function(){
 for (i in 1:length(C[[1]]) {
  print(10*C[[1]][i])
 }
}

I know that there are errors in this syntax


  
_ 

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Re : functions without arguments

2007-05-30 Thread justin bem
there are R function with zero args : plot.new,frame, colors. In your case make 
sure that you list C is present in environments that you use.
 
Justin BEM
Elève Ingénieur Statisticien Economiste
BP 294 Yaoundé.
Tél (00237)9597295.

- Message d'origine 
De : elyakhlifi mustapha [EMAIL PROTECTED]
À : R-help@stat.math.ethz.ch
Envoyé le : Mercredi, 30 Mai 2007, 8h37mn 36s
Objet : [R] functions without arguments

hello,
I wanna know if it's possible to write functions without argument 
in order to understand that I write down an example

f - function(){
 for (i in 1:length(C[[1]]) {
  print(10*C[[1]][i])
 }
}

I know that there are errors in this syntax


  
_ 

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.







  


ls.. et vos réactions !

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Factor function: odd behavior when labels argument contains duplicates?

2007-05-30 Thread Steen Ladelund
Hi all.

I think it would be nice to be able to combine levels of a factor on
creation a la

 x - rep(0:5,5)

 y - factor(x,levels=0:5,labels=c('1','1',2:5))  ## (1)

 y
 [1] 1 1 2 3 4 5 1 1 2 3 4 5 1 1 2 3 4 5 1 1 2 3 4 5 1 1 2 3 4 5
Levels: 1 1 2 3 4 5

I thougt this would (should?) create a factor with 5 levels, ie
combining 0 and 1 in x into one level in y.

I find it hard to predict the behavior of the following lines:

 table(factor(y))  ## Odd ?
 1  1  2  3  4  5 
10  0  5  5  5  5 
 table(factor(factor(y)))  ## This is what I want
 1  2  3  4  5 
10  5  5  5  5 

It also seems strange that this should be the way to go:
 levels(y) - levels(y)   ## Does what I want following (1) even tough
it appear to be a void statement?
 y
y
 [1] 1 1 2 3 4 5 1 1 2 3 4 5 1 1 2 3 4 5 1 1 2 3 4 5 1 1 2 3 4 5
Levels: 1 2 3 4 5

Am I missing an important point about factors or the factor function?

steen

Steen Ladelund, statistician
+4543233275 [EMAIL PROTECTED]
Research Center for Prevention and Health
Glostrup University Hospital, Denmark
www.fcfs.kbhamt.dk

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Re : functions without arguments

2007-05-30 Thread justin bem
You can see
Lexical Scope and Statistical Computing, Robert Gentleman; Ross Ihaka
 
Justin BEM
Elève Ingénieur Statisticien Economiste
BP 294 Yaoundé.
Tél (00237)9597295.

- Message d'origine 
De : elyakhlifi mustapha [EMAIL PROTECTED]
À : R-help@stat.math.ethz.ch
Envoyé le : Mercredi, 30 Mai 2007, 8h37mn 36s
Objet : [R] functions without arguments

hello,
I wanna know if it's possible to write functions without argument 
in order to understand that I write down an example

f - function(){
 for (i in 1:length(C[[1]]) {
  print(10*C[[1]][i])
 }
}

I know that there are errors in this syntax


  
_ 

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.







  


ls.. et vos réactions !

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] [ANN] Static and dynamic graphics course, July 2007, Salt Lake City

2007-05-30 Thread hadley wickham
We're pleased to announce a one day course covering static and dynamic
graphics using R, ggplot and GGobi. The course will be held just
before the JSM, on Saturday, 28 July 2007, in Salt Lake City. The
course will be presented by Dianne Cook and Hadley Wickham.

In the course you will learn:

* How to build presentation quality static graphics using the R
package, ggplot. We will cover plot creation and modification, and
discuss the grammar which underlies the package.

* How to explore your data with direct manipulation/dynamic graphics
using GGobi and rggobi. You'll learn the general toolbox, as well
specific approaches for dealing with missing data, supervised
classification, cluster analysis and multivariate longitudinal data
analysis.

Dianne Cook is a full professor at Iowa State University. She has been
an active researcher in the field of interactive and dynamic graphics
for 16 years, and regularly teaches information visualization,
multivariate analysis and data mining.

Hadley Wickham is a PhD student at Iowa State University. He won the
John Chambers Award for statistical computing in 2006 for his work on
ggplot.

For more details, or to book your place, please see http://lookingatdata.com

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] white test to check homoscedasticity of the residuals

2007-05-30 Thread Benoit Chemineau
Hi R-programmers,

I can't find find the White test to check the homoscedasticity of the
residuals from a linear model. Could you please help me with this?

Thank you !

BC

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] search path question

2007-05-30 Thread Barry Rowlingson
Prof Brian Ripley wrote:

 
 You could do this via a search_file() connection wrapper, but there is a 
 problem with ensuring connections get closed (which on.exit does here).
 

  I'm not sure exactly what you mean by a 'search_file() connection 
wrapper', but I have realised that its probably a better idea to write a 
function that checks a search path for a file and then returns that file:

search_file =
function(name,path=options()$scanpath,...){
for(p in path){
   file=file.path(p,name)
   if(file.exists(file)){
 return(file)
   }
 }
return(name)
}

  Then you can use that in any filename-using function:

  options(scanpath=c(/data1,/data2,/etc))

   search_file(passwd)
  [1] /etc/passwd

   passwd = read.table(search_file(passwd),sep=:)
   record = scan(search_file(passwd),what='')[1]

Barry

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] matrix in data.frame

2007-05-30 Thread Lina Hultin-Rosenberg
Dear list!

I have run into a problem that seems very simple but I can't find any
solution to it (have searched the internet, help-files and An introduction
to R etc without any luck). The problem is the following: I would like to
create a data.frame with two components (columns), the first component being
a matrix and the second component a vector. Whatever I have tried so far, I
end up with a data.frame containing all the columns from the matrix plus the
vector which is not what I am after. I have seen this kind of data.frame
among R example datasets (oliveoil and yarn).

I would greatly appreciate some help with this problem!

Kind regards,

Lina Hultin Rosenberg
Karolinska Biomics Center
Karolinska Institute
Sweden

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Help me understand colours on linux

2007-05-30 Thread michael watson \(IAH-C\)
Hi

Here is my sessionInfo():

Version 2.3.1 (2006-06-01) 
i686-redhat-linux-gnu 

attached base packages:
[1] methods   stats graphics  grDevices utils
datasets 
[7] base 

I have a function that is trying to draw rectangles using 136 different
colours, and I get the following error:

Error in rect(xstart, my.min, xstart + fcount[i, 2], my.max, col =
fcolors[i],  : 
Error: X11 cannot allocate additional graphics colours.
Consider using X11 with colortype=pseudo.cube or gray.

However, if I use pseudo.cube I don't get anywhere near enough
distinct colours.  I could use gray, but I would prefer colour.  So,
questions:

1) is there any set of options I can use which will actually let me
create that many colours?
2) if not, how do I test if there is not, and implement gray instead of
colours?  This function and package works on windows, and it works with
less colours.  I guess I could try and trap the error, and if I can, go
back and re-run the function with options(X11colortype=gray) but I'd
prefer something more elegant... What I'm looking for is some test where
I can say If you're going to fail, X11colortype='gray', else
X11colortype='true'.  Possible?

Many thanks
Mick

The information contained in this message may be confidentia...{{dropped}}

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] functions without arguments

2007-05-30 Thread Petr Klasterecky
Sure it is possible, but it is a very bad and possibly dangerous idea, 
since you may not control what's passed to your function. Consider this 
example:

  x - 1:5
  x
[1] 1 2 3 4 5
  foo - function(){mean(x)}
  foo()
[1] 3
  rm('x')
  foo()
Error in mean(x) : object x not found

It is much much beter to include argument(s) and to set them to some 
default value(s):
  foo - function(x=c(2,3,1,1,4,5,1)){mean(x)}
  foo()
[1] 2.428571
  foo(1:10)
[1] 5.5
 

Petr

elyakhlifi mustapha napsal(a):
 hello,
 I wanna know if it's possible to write functions without argument 
 in order to understand that I write down an example
 
 f - function(){
  for (i in 1:length(C[[1]]) {
   print(10*C[[1]][i])
  }
 }
 
 I know that there are errors in this syntax
 
 
   
 _ 
 
   [[alternative HTML version deleted]]
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
 

-- 
Petr Klasterecky
Dept. of Probability and Statistics
Charles University in Prague
Czech Republic

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] matrix in data.frame

2007-05-30 Thread michael watson \(IAH-C\)
Have you thought of using a list?

 a - matrix(1:10, nrow=2)
 b - 1:5
 x - list(a=a, b=b)
 x
$a
 [,1] [,2] [,3] [,4] [,5]
[1,]13579
[2,]2468   10

$b
[1] 1 2 3 4 5

 x$a
 [,1] [,2] [,3] [,4] [,5]
[1,]13579
[2,]2468   10
 x$b
[1] 1 2 3 4 5
 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Lina
Hultin-Rosenberg
Sent: 30 May 2007 10:26
To: r-help@stat.math.ethz.ch
Subject: [R] matrix in data.frame

Dear list!

I have run into a problem that seems very simple but I can't find any
solution to it (have searched the internet, help-files and An
introduction
to R etc without any luck). The problem is the following: I would like
to
create a data.frame with two components (columns), the first component
being
a matrix and the second component a vector. Whatever I have tried so
far, I
end up with a data.frame containing all the columns from the matrix plus
the
vector which is not what I am after. I have seen this kind of data.frame
among R example datasets (oliveoil and yarn).

I would greatly appreciate some help with this problem!

Kind regards,

Lina Hultin Rosenberg
Karolinska Biomics Center
Karolinska Institute
Sweden

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] matrix in data.frame

2007-05-30 Thread Prof Brian Ripley
You need to use I() or something similar. E.g.

A - matrix(1:6, 2,3)
data.frame(x=1:2, I(A))

X - data.frame(x=1:2)
X$A - A

both insert A as a single column.


On Wed, 30 May 2007, Lina Hultin-Rosenberg wrote:

 Dear list!

 I have run into a problem that seems very simple but I can't find any
 solution to it (have searched the internet, help-files and An introduction
 to R etc without any luck). The problem is the following: I would like to
 create a data.frame with two components (columns), the first component being
 a matrix and the second component a vector. Whatever I have tried so far, I
 end up with a data.frame containing all the columns from the matrix plus the
 vector which is not what I am after. I have seen this kind of data.frame
 among R example datasets (oliveoil and yarn).

 I would greatly appreciate some help with this problem!

 Kind regards,

 Lina Hultin Rosenberg
 Karolinska Biomics Center
 Karolinska Institute
 Sweden

-- 
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

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] comparing fit of cubic spline

2007-05-30 Thread Simon Wood
On Monday 21 May 2007 16:17, Thomas Reed wrote:
 I want to compare the fit of a quadratic model to continuous data, with
 that of a cubic spline fit. Is there a way of computing AIC from for e.g. a
 GAM with a smoothing spine, and comparing this to AIC from a quadratic
 model?
library(mgcv)
AIC(gam(y~s(x))) ## a `generalized aic' since effective df used 
AIC(gam(y~x+I(x^2)))





 Cheers



 **

 Tom Reed
 PhD Student
 Institute of Evolutionary Biology
 102 Ashworth Laboratories
 Kings Buildings
 University of Edinburgh
 Edinburgh EH9 3JT



 [EMAIL PROTECTED]


 Tel. 00 44 (0)131 6505462
 http://homepages.ed.ac.uk/ecunning/tom.html
 http://homepages.ed.ac.uk/loeske/tom.html

 **




   [[alternative HTML version deleted]]

 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html and provide commented, minimal,
 self-contained, reproducible code.

-- 
 Simon Wood, Mathematical Sciences, University of Bath, Bath, BA2 7AY UK
 +44 1225 386603  www.maths.bath.ac.uk/~sw283

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] matrix in data.frame

2007-05-30 Thread Lina Hultin-Rosenberg
Thank you so much for your help, it worked of course!

Best regards,

Lina Hultin-Rosenberg


-Ursprungligt meddelande-
Från: Prof Brian Ripley [mailto:[EMAIL PROTECTED] 
Skickat: den 30 maj 2007 12:44
Till: Lina Hultin-Rosenberg
Kopia: r-help@stat.math.ethz.ch
Ämne: Re: [R] matrix in data.frame

You need to use I() or something similar. E.g.

A - matrix(1:6, 2,3)
data.frame(x=1:2, I(A))

X - data.frame(x=1:2)
X$A - A

both insert A as a single column.


On Wed, 30 May 2007, Lina Hultin-Rosenberg wrote:

 Dear list!

 I have run into a problem that seems very simple but I can't find any
 solution to it (have searched the internet, help-files and An
introduction
 to R etc without any luck). The problem is the following: I would like to
 create a data.frame with two components (columns), the first component
being
 a matrix and the second component a vector. Whatever I have tried so far,
I
 end up with a data.frame containing all the columns from the matrix plus
the
 vector which is not what I am after. I have seen this kind of data.frame
 among R example datasets (oliveoil and yarn).

 I would greatly appreciate some help with this problem!

 Kind regards,

 Lina Hultin Rosenberg
 Karolinska Biomics Center
 Karolinska Institute
 Sweden

-- 
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

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] search path question

2007-05-30 Thread Prof Brian Ripley
I meant essentially the same thing but returning file(fixed_up_name).
You can vectorize this BTW:

search_file - function(name, path=getOption(scanpath))
{
 fp - c(name, file.path(path, name)) # better to use direct name first
 fp - fp[file.exists(fp)]
 if(length(fp)) file(fp[1]) else stop(name,  not found)
}

Shortly things like

 read.table(search_file(passwd))

will close the unnamed connection for you.

On Wed, 30 May 2007, Barry Rowlingson wrote:

 Prof Brian Ripley wrote:


 You could do this via a search_file() connection wrapper, but there is a
 problem with ensuring connections get closed (which on.exit does here).


  I'm not sure exactly what you mean by a 'search_file() connection
 wrapper', but I have realised that its probably a better idea to write a
 function that checks a search path for a file and then returns that file:

 search_file =
 function(name,path=options()$scanpath,...){
 for(p in path){
   file=file.path(p,name)
   if(file.exists(file)){
 return(file)
   }
 }
 return(name)
 }

  Then you can use that in any filename-using function:

  options(scanpath=c(/data1,/data2,/etc))

   search_file(passwd)
  [1] /etc/passwd

   passwd = read.table(search_file(passwd),sep=:)
   record = scan(search_file(passwd),what='')[1]

 Barry

 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


-- 
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

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] How to analyse simple study: Placebo-controlled (2 groups) repeated measurements (ANOVA, ANCOA???)

2007-05-30 Thread Karl Knoblick
Dear Frank Harrell,

many thanks for your answers!!!

I have downloaded your Harrell_notes.pdf and I think it would be best to have a 
look in some books you mentioned in the bibliographie. Can you recommend one 
especially?

TO ANYBODY:
Has anybody examples for similar data sets (as below) with R code? This would 
be a great help!

(My impression of the example of Frank Harrell at the end of Harrell_notes.pdf 
is that it is more complicated and therefore more difficult to understand than 
the simplier data set I want to analyse.) 

Thanks!!!
Karl


- Ursprüngliche Mail 
Von: Frank E Harrell Jr [EMAIL PROTECTED]
An: Karl Knoblick [EMAIL PROTECTED]
CC: r-help@stat.math.ethz.ch
Gesendet: Donnerstag, den 17. Mai 2007, 14:29:08 Uhr
Betreff: Re: [R] How to analyse simple study: Placebo-controlled (2 groups) 
repeated measurements (ANOVA, ANCOA???)


Karl Knoblick wrote:
 Hallo!
 
 I have two groups (placebo/verum), every subject is measured at 5 times, the 
 first time t0 is the baseline measurement, t1 to t4 are the measurements 
 after applying the medication (placebo or verum). The question is, if there 
 is a significant difference in the two groups and how large the differnce is 
 (95% confidence intervals).
 
 Let me give sample data
 # Data
 ID-factor(rep(1:50,each=5)) # 50 subjects
 GROUP-factor(c(rep(Verum, 115), rep(Placebo, 135)))
 TIME-factor(rep(paste(t,0:4,sep=), 50))
 set.seed(1234)
 Y-rnorm(250)
 # to have an effect:
 Y[GROUP==Verum  TIME==t1]-Y[GROUP==Verum  TIME==t1] + 0.6 
 Y[GROUP==Verum  TIME==t2]-Y[GROUP==Verum  TIME==t2] + 0.3 
 Y[GROUP==Verum  TIME==t3]-Y[GROUP==Verum  TIME==t3] + 0.9 
 Y[GROUP==Verum  TIME==t4]-Y[GROUP==Verum  TIME==t4] + 0.9 
 DF-data.frame(Y, ID, GROUP, TIME)
 
 I have heard of different ways to analyse the data
 1) Comparing the endpoint t4 between the groups (t-test), ignoring baseline

Don't even consider this

 2) Comparing the difference t4 minus t0 between the two groups (t-test)

This is not optimal

 3) Comparing the endpoint t4 with t0 as a covariate between the groups (ANOVA 
 - how can this model be calculated in R?)

Using t0 as a covariate is the way to go.  A question is whether to just 
use t4.  Generally this is not optimum.

 4) Taking a summary score (im not sure but this may be a suggestion of 
 Altman) istead of t4
 5) ANOVA (repeated measurements) times t0 to t5, group placebo/verum), 
 subject as random factor - interested in interaction times*groups (How to do 
 this in R?)
 6) as 5) but times t1 to t5, ignoring baseline (How to do this in R?)
 7) as 6) but additional covariate baseline t0 (How to do this in R?)
 
 What will be best? - (Advantages / disadvantages?)
 How to analyse these models in R with nested and random effects and possible 
 covariate(ID, group - at least I think so) and random parameter ID)? Or is 
 there a more simple possibility?

It's not obvious that random effects are needed if you take the 
correlation into account in a good way.  Generalized least squares using 
for example an AR1 correlation structure (and there are many others) is 
something I often prefer.  A detailed case study with R code (similar to 
your situation) is in http://biostat.mc.vanderbilt.edu/FrankHarrellGLS . 
  This includes details about why t0 is best to consider as a covariate. 
  One reason is that the t0 effect may not be linear.

If you want to focus on t4 it is easy to specify a contrast (after 
fitting is completed) that tests t4.  If time is continuous this 
contrast would involve predicted values at the 4th time, otherwise 
testing single parameters.

Frank Harrell

 
 Perhaps somebody can recommend a book or weblink where these different 
 strategies of analysing are discussed - preferable with examples with raw 
 data which I can recalculate. And if there is the R syntax includede - this 
 would be best!
 
 Any help will be appreciate!
 
 Thanks!
 Karl

-- 
Frank E Harrell Jr   Professor and Chair   School of Medicine
  Department of Biostatistics   Vanderbilt University


  __  Yahoo! Clever: Stellen Sie Fragen und 
finden Sie Antworten. Teilen Sie Ihr Wissen. www.yahoo.de/clever

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] missing values

2007-05-30 Thread Allan Clark
hello all


i would like to perform multiple imputation using the norm library.


but i seem to get the following error when i use the da.norm function.


Error in as.double.default(list(V1 = c(0.058177827, 0.123076923, 0.138713745,  
: 
(list) object cannot be coerced to 'double'



can anyone help?  

thanking you in advance

Allan Clark

Lecturer in Statistical Sciences Department
University of Cape Town
7701 Rondebosch
South Africa
TEL (Office): +27-21-650-3228
FAX: +27-21-650-4773
http://web.uct.ac.za/depts/stats/aclark.htm

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] test to compare significant correlation increase

2007-05-30 Thread David Riano
Hi!
I am calculating correlation between two variables:
1. X versus Y
2. X versus Y(with a 3 steps lag)

I would like to test if the correlation 
increase/decrease from 1 to 2 is significant or not.

Is there any function in R to do this? any hints?

Thanks for help :)

David Riaño
Center for Spatial Technologies and Remote Sensing (CSTARS)
University of California
250-N, The Barn
One Shields Avenue
Davis, CA 95616-8527
USA
1-(517) 629-5499
http://www.cstars.ucdavis.edu/~driano/index.html
http://www.cstars.ucdavis.edu

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] white test to check homoscedasticity of the residuals

2007-05-30 Thread Achim Zeileis
On Wed, 30 May 2007, Benoit Chemineau wrote:

 Hi R-programmers,

 I can't find find the White test to check the homoscedasticity of the
 residuals from a linear model. Could you please help me with this?

The package lmtest includes the function bptest() for performing
Breusch-Pagan tests. White's test is a special case of this. For example,
if you fit a linear regression
  fm - lm(y ~ x + z, data = foo)
then you can carry out White's test via
  bptest(fm, ~ x * z + I(x^2) + I(z^2), data = foo)
i.e., include all regressors and the squares/cross-products in the
auxiliary regression.

I haven't yet written a simple convenience interface for this...

hth,
Z

 Thank you !

 BC

   [[alternative HTML version deleted]]

 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.



__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Smoothing a path in 2D

2007-05-30 Thread Dieter Vanderelst
Hello,

I'm currently trying to find a method to interpolate or smooth data that
represent a trajectory in space.

For example, I have an ordered (=time) set of (x,y) tuples which
constitute a path in a 2D space.

Is there a way using R to interpolate between these points in a way
similar to spline interpolation so that I get a smooth path in space?

Greetings,
Dieter

-- 
Dieter Vanderelst
[EMAIL PROTECTED]
Department of Industrial Design
Designed Intelligence

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Smoothing a path in 2D

2007-05-30 Thread roger koenker
You might have a look at the fda package of Ramsay on CRAN.


url:www.econ.uiuc.edu/~rogerRoger Koenker
email[EMAIL PROTECTED]Department of Economics
vox: 217-333-4558University of Illinois
fax:   217-244-6678Champaign, IL 61820


On May 30, 2007, at 9:42 AM, Dieter Vanderelst wrote:

 Hello,

 I'm currently trying to find a method to interpolate or smooth data  
 that
 represent a trajectory in space.

 For example, I have an ordered (=time) set of (x,y) tuples which
 constitute a path in a 2D space.

 Is there a way using R to interpolate between these points in a way
 similar to spline interpolation so that I get a smooth path in space?

 Greetings,
 Dieter

 -- 
 Dieter Vanderelst
 [EMAIL PROTECTED]
 Department of Industrial Design
 Designed Intelligence

   [[alternative HTML version deleted]]

 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting- 
 guide.html
 and provide commented, minimal, self-contained, reproducible code.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] codamenu() :Error in coda.options....

2007-05-30 Thread Luwis Diya
Dear all, 

I recently started having some problemd with the coda package. I have also 
deleted it and then installed the package again. 

The problem is that I cant access the codamenu. That is ;

*
 library(coda)
 codamenu()
Error in coda.options(default = TRUE) : cannot change value of locked binding 
for '.Coda.Options'

Quitting codamenu ...
Error in !coda.options(data.saved) : invalid argument type
 

*

Thank you,

Regards,

Luwis Diya


[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] [R-pkgs] Revised Rcmdr.HH package

2007-05-30 Thread Richard M. Heiberger
I posted a revised Rcmdr.HH_1.8-0 package on CRAN.

The Rcmdr.HH package adds additional menu items to the Rcmdr package by
John Fox.  Our introductory course at Temple University includes several
topics that were not addressed in the Rcmdr.  This revision uses the new
RcmdrPlugin technology that John announced a few days ago.

Rich

___
R-packages mailing list
[EMAIL PROTECTED]
https://stat.ethz.ch/mailman/listinfo/r-packages

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] missing values

2007-05-30 Thread Prof Brian Ripley
When it says 'matrix' it means it, not 'data frame'.

On Wed, 30 May 2007, Allan Clark wrote:

 hello all


 i would like to perform multiple imputation using the norm library.


 but i seem to get the following error when i use the da.norm function.


 Error in as.double.default(list(V1 = c(0.058177827, 0.123076923, 0.138713745, 
  :
(list) object cannot be coerced to 'double'



 can anyone help?

 thanking you in advance

 Allan Clark
 
 Lecturer in Statistical Sciences Department
 University of Cape Town
 7701 Rondebosch
 South Africa
 TEL (Office): +27-21-650-3228
 FAX: +27-21-650-4773
 http://web.uct.ac.za/depts/stats/aclark.htm

 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


-- 
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

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Smoothing a path in 2D

2007-05-30 Thread Clint Bowman
?KalmanLike

Clint BowmanINTERNET:   [EMAIL PROTECTED]
Air Dispersion Modeler  INTERNET:   [EMAIL PROTECTED]
Air Quality Program VOICE:  (360) 407-6815
Department of Ecology   FAX:(360) 407-7534

USPS:   PO Box 47600, Olympia, WA 98504-7600
Parcels:300 Desmond Drive, Lacey, WA 98503-1274

On Wed, 30 May 2007, Dieter Vanderelst wrote:

 Hello,

 I'm currently trying to find a method to interpolate or smooth data that
 represent a trajectory in space.

 For example, I have an ordered (=time) set of (x,y) tuples which
 constitute a path in a 2D space.

 Is there a way using R to interpolate between these points in a way
 similar to spline interpolation so that I get a smooth path in space?

 Greetings,
 Dieter

 --
 Dieter Vanderelst
 [EMAIL PROTECTED]
 Department of Industrial Design
 Designed Intelligence

   [[alternative HTML version deleted]]

 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] separate y-limits in xYplot panels

2007-05-30 Thread Nitin Jain
Hello,

I would like to get the scales of y-axes dependent only on the data points in a 
particular panel. Have attached a test example below.
When using 'relation=free', it does not make the scales 'free', however when 
using 'relation=sliced', I get a warning Explicitly specified limits ignored 
in: limitsFromLimitlist(have.lim = have.ylim, lim = ylim, relation = 
y.relation, (although in this particular case, I get the desired result, but 
in my real data, I do not get the free y-scale for each panel). Can you please 
let me know what should be correct syntax?

Thanks.
-Nitin

library(Hmisc)

test1 - data.frame(
y = c(rnorm(33), rnorm(33, mean=10),
rnorm(34, mean=100)),
x = 1:100,
f = factor(c(rep(a, 33), rep(b, 33), rep(c, 34))),
g = factor(sample(LETTERS[1:2], size=100, replace=TRUE))
)


CI - rnorm(100)
lb - test1$y - CI
ub - test1$y + CI


xYplot(Cbind(y, lb,ub )~x|f,
   groups=g,
   scales = list(relation=free), ## Changing it to sliced gives warning
   data=test1)

 




 

Don't pick lemons.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] How to check for existence url from within a function?

2007-05-30 Thread Martin Maechler
 Duncan == Duncan Murdoch [EMAIL PROTECTED]
 on Sat, 26 May 2007 08:02:11 -0400 writes:

Duncan On 26/05/2007 7:13 AM, Heinz Tuechler wrote:
 Dear All,
 
 To check if an url exists, I can use try(). This works, as I expected, 
if I
 do it directly, as in the first part of the following example, but I 
could
[..]


Duncan .Last.value isn't set until your function returns.  You should 
write this as

Duncan con.url - try(url(url.string, open='rb'))
Duncan try.error - inherits(con.url, try-error)

Duncan Notice that I used inherits, rather than testing for equality.  
It's 
Duncan documented that the result of try() will be of class 'try-error' 
if an 
Duncan error occurs, but there may be circumstances (in the future?) where 
Duncan different types of errors are signalled by using a more complicated 
class.

There's an additional reason for inherits(.,.)  and hence
against  class(foo) == bar :

Whenever try() does not catch an error, since there was none,
i.e., the result of try(foobar(..)) is just foobar(..),
foobar(..) may well return an object with an (S3) class vector
of length  1.
In those cases, the equality test returns a logical vector,
typically  c(FALSE, FALSE)
and using that in if(.) gives at least a warning.

Martin

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] http proxies: setting and unsetting

2007-05-30 Thread Gabor Grothendieck
There is also a free program setenv.exe which is more powerful than setx.exe.
You mentioned that deleting http_proxy from your environment through the OS
would fix your problem.  setenv.exe can both set and delete environment
variables and you can specify user, system, etc.  See description and link here:
http://www.jsifaq.com/SF/Tips/Tip.aspx?id=4928


Grothendieck [EMAIL PROTECTED] wrote:
 One other point.  If you find you need to set a system or user environment
 variable then microsoft has a free tool called setx.exe that you can find 
 here:

 http://support.microsoft.com/kb/927229

 You can do this from within R using system().

 On 5/30/07, Gabor Grothendieck [EMAIL PROTECTED] wrote:
  On 5/29/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
   OK, I think I get that... do you know which namespace the Sys.setenv() 
   function affects?  Do you know if there are functions in R that can alter 
   the user/system/process environment variables?
  
 
  Use the R Sys.getenv() command to get the process environment variables.
  To get user and system environment variables, from the Desktop right click 
  on
  My Computer and choose Properties.  Then choose the Advanced tab
  and click on the Environment Variables button near the bottom of the
  window that appears.
 


__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] http proxies: setting and unsetting

2007-05-30 Thread matt.pettis
Thanks... I'll check the documentation to see which file on Windows I
need to alter to issue one of those commands.

matt 

-Original Message-
From: Prof Brian Ripley [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, May 30, 2007 12:39 AM
To: Gabor Grothendieck
Cc: Pettis, Matthew (Thomson); r-help@stat.math.ethz.ch
Subject: Re: [R] http proxies: setting and unsetting

That was misleading advice.  R is a C program and accesses the
environment via the C calls getenv and (on Windows) putenv.  This is not
Windows scripting (Grothendieck's earlier reference): the C runtime
maintains only one environment block.

I've re-checked, and suspect the problem is in the following comment in
?download.file

  These environment variables must be set before the download code
  is first used: they cannot be altered later by calling
  'Sys.setenv'.

If I have http_proxy set in the environment, the proxy is not used in
any of the following cases:

- Calling R from a shortcut with http_proxy= on the target (see the
rw-FAQ).

- Calling R from a shortcut with no_proxy=* on the target.

- Using Sys.unsetenv(http_proxy) right at the start of the R session.

- Using Sys.setenv(no_proxy=*) right at the start of the R session.

If you set options(internet.info=0) you will see exactly what is tried.

Another possibility is that R is being used with --internet2, in which
case none of this applies, and the simple answer is not to use
--internet2 at home.



On Tue, 29 May 2007, Gabor Grothendieck wrote:

 You can have 4 different http_proxy environment variables and if you 
 set one type but try to unset a different type then that will have no 
 effect on the one you originally set.  For example, if you originally 
 set it as a system or user environment variable and then try to unset 
 the process environment variable of the same name then that will have 
 no effect on the system or user environment variable.

 On 5/29/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 Hi Gabor,

 Thanks for the reply and link.

 I took a look at the link -- one thing I don't understand is why if I
delete the 'http_proxy' variable via the cmd shell (or equivalent OS
dialog box), why I can get R to ignore the proxy, but using
Sys.setenv(http_proxy=) won't do that for me (at least for the scope
of the session).  If there were other variables affecting it, I would
think my deleting 'http_proxy' in the OS would also have no effect --
yet it does.

 Any ideas?

 Thanks again,
 Matt


 -Original Message-
 From: Gabor Grothendieck [mailto:[EMAIL PROTECTED]
 Sent: Tue 5/29/2007 9:49 PM
 To: Pettis, Matthew (Thomson)
 Cc: r-help@stat.math.ethz.ch
 Subject: Re: [R] http proxies: setting and unsetting

 Note that Windows XP has 4 types of environment variables and I 
 suspect that the problem stems from not taking that into account:

 http://www.microsoft.com/technet/scriptcenter/guide/sas_wsh_kmmj.mspx
 ?mfr=true

 On 5/29/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 Hi,

 I am trying to use R at work and at home on the same computer.  At
work, I have a proxy, and at home, I do not.  I have, for work, a User
environment variable http_proxy which I set in the OS (Windows XP
Pro).  When I am at work, and I try to retrieve data from the web with
'read.csv', things work just fine.  I assume it knows how to use the
proxy.

 The trouble is when I am at home and have no proxy, R still tries to
use my work proxy.  I have tried the following:

 Sys.setenv(http_proxy=)
 Sys.setenv(no_proxy=TRUE)
 Sys.setenv(no_proxy=1)

 none of which seems to work.  Whenever I try to use read.csv, it
tells me that it cannot find my work proxy, which I am trying to tell R
to ignore.

 I can solve this problem by removing the http_proxy environment
variable binding in the OS when at home, but that is a pain, because
then I have to reset it when I go back into work.

 Is there a way to tell R within a session to ignore the proxy?  If
so, what am I doing wrong?

 thanks,
 matt

 __
 R-help@stat.math.ethz.ch mailing list 
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide 
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.




 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide 
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


-- 
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

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help

Re: [R] separate y-limits in xYplot panels

2007-05-30 Thread Sundar Dorai-Raj


Nitin Jain said the following on 5/30/2007 8:12 AM:
 Hello,
 
 I would like to get the scales of y-axes dependent only on the data points in 
 a particular panel. Have attached a test example below.
 When using 'relation=free', it does not make the scales 'free', however 
 when using 'relation=sliced', I get a warning Explicitly specified limits 
 ignored in: limitsFromLimitlist(have.lim = have.ylim, lim = ylim, relation = 
 y.relation, (although in this particular case, I get the desired result, but 
 in my real data, I do not get the free y-scale for each panel). Can you 
 please let me know what should be correct syntax?
 
 Thanks.
 -Nitin
 
 library(Hmisc)
 
 test1 - data.frame(
 y = c(rnorm(33), rnorm(33, mean=10),
 rnorm(34, mean=100)),
 x = 1:100,
 f = factor(c(rep(a, 33), rep(b, 33), rep(c, 34))),
 g = factor(sample(LETTERS[1:2], size=100, replace=TRUE))
 )
 
 
 CI - rnorm(100)
 lb - test1$y - CI
 ub - test1$y + CI
 
 
 xYplot(Cbind(y, lb,ub )~x|f,
groups=g,
scales = list(relation=free), ## Changing it to sliced gives warning
data=test1)
 
  

You want scales = list(y = list(relation = free))

HTH,

--sundar

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] http proxies: setting and unsetting

2007-05-30 Thread matt.pettis
Thanks... I'll give it a whirl...

matt 

-Original Message-
From: Gabor Grothendieck [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, May 30, 2007 10:22 AM
To: Pettis, Matthew (Thomson)
Cc: r-help@stat.math.ethz.ch
Subject: Re: [R] http proxies: setting and unsetting

There is also a free program setenv.exe which is more powerful than
setx.exe.
You mentioned that deleting http_proxy from your environment through the
OS would fix your problem.  setenv.exe can both set and delete
environment variables and you can specify user, system, etc.  See
description and link here:
http://www.jsifaq.com/SF/Tips/Tip.aspx?id=4928


Grothendieck [EMAIL PROTECTED] wrote:
 One other point.  If you find you need to set a system or user 
 environment variable then microsoft has a free tool called setx.exe
that you can find here:

 http://support.microsoft.com/kb/927229

 You can do this from within R using system().

 On 5/30/07, Gabor Grothendieck [EMAIL PROTECTED] wrote:
  On 5/29/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
   OK, I think I get that... do you know which namespace the
Sys.setenv() function affects?  Do you know if there are functions in R
that can alter the user/system/process environment variables?
  
 
  Use the R Sys.getenv() command to get the process environment
variables.
  To get user and system environment variables, from the Desktop right

  click on My Computer and choose Properties.  Then choose the 
  Advanced tab and click on the Environment Variables button near the 
  bottom of the window that appears.
 


__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] learning lattice graphics

2007-05-30 Thread Tyler Smith
On 2007-05-27, Sundar Dorai-Raj [EMAIL PROTECTED] wrote:
 I would also suggest Paul Murrell's book R Graphics.

 http://www.amazon.com/Graphics-Computer-Science-Data-Analysis/dp/158488486X/

 --sundar



Thanks all! I have the relevant chapters from the Murrell book now
(which were available as samples), and between that, the bell labs
site, and the help pages I think I'll be ok!

Tyler

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] manova permutations and pair-wise contrasts

2007-05-30 Thread Tyler Smith
Hi,

I have a function for doing permutation tests for Manovas, written
with the help of folks here on the list. It seems to work ok, and I've
found that there is indeed a significant difference among groups in my
analysis. I want to follow up on this by testing for which pairs of
groups are significantly different. Reasoning that since Wilks Lambda
is a generalization of the Hotelling T test, it should be appropriate
for testing difference between two groups as well as between many
groups, I used the same function. 

This appears to work, with one exception. For one pair of groups the
residuals have rank 14  15. Reading through the archives I see that
this problem comes up with permutation tests on occassion. My question
is, does this problem indicate a mistaken assumption or faulty code on
my part, and is there anyway to address it, either with a different
approach or a change to my function?

The actual function I use is:

wilks.perm - function(data.mat, cat.vect, n=999){
  res.vect - numeric(n+1)

  for (i in 1:n){
wilks - summary(manova(data.mat ~ sample(cat.vect)),
 test=Wilks)$stats[1,2]
res.vect[i] - wilks
  }

  res.vect[n+1] - obs -
summary(manova(data.mat~cat.vect), test=Wilks)$stats[1,2]

  return(sum(res.vect = res.vect[n+1])/(n+1))

}

Thanks!

Tyler

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] separate y-limits in xYplot panels

2007-05-30 Thread Gabor Grothendieck
You could consider doing this directly with lattice.  See:

   demo(intervals)


On 5/30/07, Nitin Jain [EMAIL PROTECTED] wrote:
 Hello,

 I would like to get the scales of y-axes dependent only on the data points in 
 a particular panel. Have attached a test example below.
 When using 'relation=free', it does not make the scales 'free', however 
 when using 'relation=sliced', I get a warning Explicitly specified limits 
 ignored in: limitsFromLimitlist(have.lim = have.ylim, lim = ylim, relation = 
 y.relation, (although in this particular case, I get the desired result, but 
 in my real data, I do not get the free y-scale for each panel). Can you 
 please let me know what should be correct syntax?

 Thanks.
 -Nitin

 library(Hmisc)

 test1 - data.frame(
y = c(rnorm(33), rnorm(33, mean=10),
rnorm(34, mean=100)),
x = 1:100,
f = factor(c(rep(a, 33), rep(b, 33), rep(c, 34))),
g = factor(sample(LETTERS[1:2], size=100, replace=TRUE))
)


 CI - rnorm(100)
 lb - test1$y - CI
 ub - test1$y + CI


 xYplot(Cbind(y, lb,ub )~x|f,
   groups=g,
   scales = list(relation=free), ## Changing it to sliced gives warning
   data=test1)







 
 Don't pick lemons.

 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] codamenu() :Error in coda.options....

2007-05-30 Thread Uwe Ligges
Please report bugs in packages to the package maintainer (CCing) 
including version information and platform such as for me in this case: 
Same for me, R-2.5.0, Windows XP, coda 0.11-1.

Uwe Ligges


Luwis Diya wrote:
 Dear all, 
 
 I recently started having some problemd with the coda package. I have also 
 deleted it and then installed the package again. 
 
 The problem is that I cant access the codamenu. That is ;
 
 *
 library(coda)
 codamenu()
 Error in coda.options(default = TRUE) : cannot change value of locked binding 
 for '.Coda.Options'
 
 Quitting codamenu ...
 Error in !coda.options(data.saved) : invalid argument type
 
 *
 
 Thank you,
 
 Regards,
 
 Luwis Diya
 
 
   [[alternative HTML version deleted]]
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] test to compare significant correlation increase

2007-05-30 Thread Mike Lawrence
Just a guess (please correct if I'm way off on this), but maybe you  
could look at the difference in r betwen 1  2 and see if the  
confidence interval (http://davidmlane.com/hyperstat/B8544.html) for  
this value given your sample size includes 0.

On 30-May-07, at 11:24 AM, David Riano wrote:

 Hi!
 I am calculating correlation between two variables:
 1. X versus Y
 2. X versus Y(with a 3 steps lag)

 I would like to test if the correlation
 increase/decrease from 1 to 2 is significant or not.

 Is there any function in R to do this? any hints?

 Thanks for help :)

 David Riaño
 Center for Spatial Technologies and Remote Sensing (CSTARS)
 University of California
 250-N, The Barn
 One Shields Avenue
 Davis, CA 95616-8527
 USA
 1-(517) 629-5499
 http://www.cstars.ucdavis.edu/~driano/index.html
 http://www.cstars.ucdavis.edu

 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting- 
 guide.html
 and provide commented, minimal, self-contained, reproducible code.

--
Mike Lawrence
Graduate Student, Department of Psychology, Dalhousie University

Website: http://myweb.dal.ca/mc973993
Public calendar: http://icalx.com/public/informavore/Public

The road to wisdom? Well, it's plain and simple to express:
Err and err and err again, but less and less and less.
- Piet Hein

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] separate y-limits in xYplot panels

2007-05-30 Thread Nitin Jain
Thanks Sundar and Gabor for your prompt help.

Sundar - Even after changing the line to scales = list(y = list(relation = 
free)), I do not get the free scales in my test code (below), and relation 
=sliced still gives warning.

Gabor - I'll try using code as demo(intervals) suggests.

Best,
Nitin



Nitin Jain said the following on 5/30/2007 8:12 AM:
 Hello,


I would like to get the scales of y-axes dependent only on the data
points in a particular panel. Have attached a test example below.

When using 'relation=free', it does not make the scales 'free',
however when using 'relation=sliced', I get a warning Explicitly
specified limits ignored in: limitsFromLimitlist(have.lim = have.ylim,
lim = ylim, relation = y.relation, (although in this particular case,
I get the desired result, but in my real data, I do not get the free
y-scale for each panel). Can you please let me know what should be
correct syntax?

 Thanks.
 -Nitin

 library(Hmisc)

 test1 - data.frame(
 y = c(rnorm(33), rnorm(33, mean=10),
 rnorm(34, mean=100)),
 x = 1:100,
 f = factor(c(rep(a, 33), rep(b, 33), rep(c, 34))),
 g = factor(sample(LETTERS[1:2], size=100, replace=TRUE))
 )


 CI - rnorm(100)
 lb - test1$y - CI
 ub - test1$y + CI


 xYplot(Cbind(y, lb,ub )~x|f,
groups=g,
scales = list(relation=free), ## Changing it to sliced gives warning
data=test1)



You want 


HTH,


--sundar 




   
Choose
 the right car based on your needs.  Check out Yahoo! Autos new Car Finder tool.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] test to compare significant correlation increase

2007-05-30 Thread Jonathan Baron
In response to the original message, see
http://finzi.psych.upenn.edu/R/Rhelp02a/archive/85753.html

which describes two papers about comparing dependent correlations,
which I think is a relevant question.  (Try Google too.  I didn't.)

There is also a paper by Steiger in Psychological Bulletin, 1980,
which I implemented in the following R code.  (Not tested since I
translated it from a BASIC script written in 1981.)

r12 - as.numeric(readline(Difference r12 and r13, given r23. Input r12: ))
r13 - as.numeric(readline(r13: ))
r23 - as.numeric(readline(r23: ))
N - as.numeric(readline(Number of Ss: ))
rd - 1-r12*r12-r13*r13-r23*r23+2*r12*r13*r23
t2 - (r12-r13)*sqrt((N-1)*(1+r23)/(2*rd*(N-1)/(N-3)+((r12+r13)/2)^2*(1-r23)^3))
print(paste(t(,N-3,)=,t2, p=,pt(t2,N-3), one tailed,sep=))
print(Steiger, J.H. (1980). Tests for comparing elements of a)
print(correlation matrix.  Psychological Bulletin, 87, 245-251.)

 On 30-May-07, at 11:24 AM, David Riano wrote:
 
  Hi!
  I am calculating correlation between two variables:
  1. X versus Y
  2. X versus Y(with a 3 steps lag)
 
  I would like to test if the correlation
  increase/decrease from 1 to 2 is significant or not.
 
  Is there any function in R to do this? any hints?
 
  Thanks for help :)
 
  David Ria�o
  Center for Spatial Technologies and Remote Sensing (CSTARS)
  University of California
  250-N, The Barn
  One Shields Avenue
  Davis, CA 95616-8527
  USA
  1-(517) 629-5499
  http://www.cstars.ucdavis.edu/~driano/index.html
  http://www.cstars.ucdavis.edu
 
  __
  R-help@stat.math.ethz.ch mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide http://www.R-project.org/posting- 
  guide.html
  and provide commented, minimal, self-contained, reproducible code.
 
 --
 Mike Lawrence
 Graduate Student, Department of Psychology, Dalhousie University
 
 Website: http://myweb.dal.ca/mc973993
 Public calendar: http://icalx.com/public/informavore/Public
 
 The road to wisdom? Well, it's plain and simple to express:
 Err and err and err again, but less and less and less.
   - Piet Hein
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

-- 
Jonathan Baron, Professor of Psychology, University of Pennsylvania
Home page: http://www.sas.upenn.edu/~baron

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Empirical Complementary CDF

2007-05-30 Thread Shiazy Fuzzy
Hi all,

I'd like to plot an empirical LLCD (log-log-CCDF, where CCDF == 1-CDF).
It seems ecdf() and plot(ecdf()) can't do it. I'd like to reuse some
graphics features of ECDF plot.
The fastest way I've found is to copypaste the ecdf code and writing
this function:
--- [R-code] ---
eccdf - function(x)
{
x - sort(x)
n - length(x)
if (n  1)
stop('x' must have 1 or more non-missing values)
vals - sort(unique(x))
rval - approxfun(vals, 1-cumsum(tabulate(match(x, vals)))/n, #[CHANGED]
method = constant, yleft = 1, yright = 0, f = 0, ties = ordered)
class(rval) - c(eccdf, stepfun, class(rval)) #[CHANGED]
attr(rval, call) - sys.call()
rval
}
--- [/R-code] ---

and the rewriting the plot.ecdf function:

--- [R code] ---
plot.eccdf - function (x, ..., ylab = 1-Fn(x), verticals = FALSE,
col.01line = gray70) #CHANGED
{
plot.stepfun(x, ..., ylab = ylab, verticals = verticals)
abline(h = c(0, 1), col = col.01line, lty = 2)
}
--- [/R-code] ---

So, is there a even faster way to get it?

Thank you so much!!

-- Marco

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] checking for viability of a GUI component

2007-05-30 Thread Hao Liu
Dear All:

The question: How do I check for existance of the GUI, instead of 
checking  the variable of the GUI?

I created a log window for several applications, they will check for the 
existance of log window, if it exists, append output to it, otherwise, 
create log window and insert to it. What I found out is that if I close 
the X window of the GUI, the variable logwin still exists, confuse 
arises to other components that are supposed to use the GUI.

create.log.win - function(inputtext){
if(exists(is.null(logwin))) {return} else {
logwin - tktoplevel()
logtext - tktext(logwin, bg=white)
tkwm.title(logwin, Log Window)
loglabel - tklabel(logwin, text=Logging Analaysis Information)
tkgrid(loglabel)
tkgrid(logtext)
if (is.matrix(inputtext)) {
for (i in 1:nrow(inputtext))
tkinsert(logtext, end,paste(paste(inputtext[i,],collapse= 
),\n,sep=))
}
else tkinsert(logtext, end,paste(inputtext,\n,sep=))
export_button - tkbutton(logwin, text = Export Log, 
command=savelog)
tkgrid(export_button)
}
}

-- I understand I should bind a function to remove the varialbe with a 
close button, however, we can't stop users from closing window just by 
clicking on the upper right corner.

How do I check for existance of the GUI, instead of the variable?

Thanks

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Connecting to PostgreSQL/PostGIS from R (rgdal?)

2007-05-30 Thread Mike Leahy
Hello,

I've been trying every now and then to find a cross operating system
solution that would let me access PostgreSQL (and PostGIS) from R, or to
access R from PostgreSQL.  I know of pl/r, which accomplishes the
latter, but has yet to be successfully ported to Windows.  Similarly,
I've tried to use Rdbi and DBI, but I haven't had luck with those on
Windows either for connecting to PostgreSQL from R.  Can anyone suggest
a solution for this?

It would seem that rgdal could also help me in this case. Unfortunately,
the version of the GDAL library that is included in the rdgal binary
available on CRAN (for windows) doesn't include the PostgreSQL driver
for OGR (i.e., it's not listed by the ogrDrivers() function).

I compiled rgdal on Windows myself using the GDAL library from
FWTools-1.3.1, but I was unsuccessful at creating a proper binary
package for R.  I was only able to get it to work by substituting the
rgdal.dll that was installed by CRAN with the one that I compiled that
links against the GDAL library from FWTools.  Even though it works (at
first glance with ogrInfo(), and readOGR()), I still get a warning
message when I load the libary: DLL attempted to change FPU control
word from 8001f to 9001f.

So my question with respect to rgdal is a) is it likely that an rgdal
package is going to be released in the future with the PostgreSQL driver
included in GDAL/OGR, or b) are there any suggestions/instructions that
might get me through the compilation and packaging process for rgdal
with better success?

Thanks in advance for any help,
Mike

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] riv-package, how to deal with missing values?

2007-05-30 Thread Jan Störger
Hello everyone!

I want to calculate an instrumental variable estimator using the
riv-package:

riv(Y,Xex,Xend,W,method=classical) 

and my problem is that I either get an error because missing values are
not allowed in the matrices or when I exclude NA's from the matrices it
says that matrices have to be at the same length. Is there a special
option how to deal with missing values when using the riv-package?

Thanks to everyone how might be able to help!

Jan Störger
Mannheim University

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] opinions please: text editors and reporting/Sweave?

2007-05-30 Thread Tim Howard
dear all - 

I currently use Tinn-R as my text editor to work with code that I submit to R, 
with some output dumped to text files, some images dumped to pdf. (system: 
Windows 2K and XP, R 2.4.1 and R 2.5). We are using R for overnight runs to 
create large output data files for GIS, but then I need simple output reports 
for analysis results for each separate data set. Thus, I create many reports of 
the same style, but just based on different input data.

I am recognizing that I need a better reporting system, so that I can create 
clean reports for each separate R run. This obviously means using Sweave and 
some implementation of LaTex, both of which are new to me. I've installed 
MikTex and successfully completed a demo or two for creating pdfs from raw 
LaTeX.

It appears that if I want to ease my entry into the world of LaTeX, I might 
need to switch editors to something like Emacs (I read somewhere that Emacs 
helps with the TeX markup?). After quite a while wallowing at the Emacs site, I 
am finding that ESS is well integrated with R and might be the way to go. 
Aaaagh... I'm in way over my head!

My questions:

What, in your opinion, is the simplest way to integrate text and graphics 
reports into a single report such as a pdf file. 

If the answer to this is LaTeX and Sweave, is it difficult to use a text editor 
such as Tinn-R or would you strongly recommend I leave behind Tinn and move 
over to an editor that has more LaTeX help?  

In reading over Friedrich Leisch's Sweave User Manual (v 1.6.0) I am 
beginning to think I can do everything I need with my simple editor. Before 
spending many hours going down that path, I thought it prudent to ask the R 
community.

It is likely I am misunderstanding some of the process here and any 
clarifications are welcome. 

Thank you in advance for any thoughts. 
Tim Howard

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] [R-sig-Geo] Connecting to PostgreSQL/PostGIS from R (rgdal?)

2007-05-30 Thread Roger Bivand
On Wed, 30 May 2007, Mike Leahy wrote:

 Hello,
 
 I've been trying every now and then to find a cross operating system
 solution that would let me access PostgreSQL (and PostGIS) from R, or to
 access R from PostgreSQL.  I know of pl/r, which accomplishes the
 latter, but has yet to be successfully ported to Windows.  Similarly,
 I've tried to use Rdbi and DBI, but I haven't had luck with those on
 Windows either for connecting to PostgreSQL from R.  Can anyone suggest
 a solution for this?
 
 It would seem that rgdal could also help me in this case. Unfortunately,
 the version of the GDAL library that is included in the rdgal binary
 available on CRAN (for windows) doesn't include the PostgreSQL driver
 for OGR (i.e., it's not listed by the ogrDrivers() function).
 
 I compiled rgdal on Windows myself using the GDAL library from
 FWTools-1.3.1, but I was unsuccessful at creating a proper binary
 package for R.  I was only able to get it to work by substituting the
 rgdal.dll that was installed by CRAN with the one that I compiled that
 links against the GDAL library from FWTools.  Even though it works (at
 first glance with ogrInfo(), and readOGR()), I still get a warning
 message when I load the libary: DLL attempted to change FPU control
 word from 8001f to 9001f.
 
 So my question with respect to rgdal is a) is it likely that an rgdal
 package is going to be released in the future with the PostgreSQL driver
 included in GDAL/OGR, or b) are there any suggestions/instructions that
 might get me through the compilation and packaging process for rgdal
 with better success?

The warning is harmless - R is just reporting that it has stopped the 
dynamically linked libraries resetting a flag that they should not change 
while R is running. If you followed the notes in README.windows in rgdal, 
you ought to be OK. There are no plans to provide more Windows binary 
drivers than those present now, because the others involve further 
external dependencies, which most users would not welcome. 

So please try to do an ogrinfo at the command line in Windows using
FWTools to your PostGIS data, and then the equivalent within R with your
locally built rgdal, and see how it goes. Even on Linux, getting all the
components lined up isn't easy, according to people who have tried, but
can be done if you need to do it.

Hope this helps,

Roger

 
 Thanks in advance for any help,
 Mike
 
 ___
 R-sig-Geo mailing list
 [EMAIL PROTECTED]
 https://stat.ethz.ch/mailman/listinfo/r-sig-geo
 

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: [EMAIL PROTECTED]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] opinions please: text editors and reporting/Sweave?

2007-05-30 Thread michael watson \(IAH-C\)
Have you tried R2HTML, or is HTML not what you're looking for?


-Original Message-
From: [EMAIL PROTECTED] on behalf of Tim Howard
Sent: Wed 30/05/2007 9:43 PM
To: r-help@stat.math.ethz.ch
Subject: [R] opinions please: text editors and reporting/Sweave?
 
dear all - 

I currently use Tinn-R as my text editor to work with code that I submit to R, 
with some output dumped to text files, some images dumped to pdf. (system: 
Windows 2K and XP, R 2.4.1 and R 2.5). We are using R for overnight runs to 
create large output data files for GIS, but then I need simple output reports 
for analysis results for each separate data set. Thus, I create many reports of 
the same style, but just based on different input data.

I am recognizing that I need a better reporting system, so that I can create 
clean reports for each separate R run. This obviously means using Sweave and 
some implementation of LaTex, both of which are new to me. I've installed 
MikTex and successfully completed a demo or two for creating pdfs from raw 
LaTeX.

It appears that if I want to ease my entry into the world of LaTeX, I might 
need to switch editors to something like Emacs (I read somewhere that Emacs 
helps with the TeX markup?). After quite a while wallowing at the Emacs site, I 
am finding that ESS is well integrated with R and might be the way to go. 
Aaaagh... I'm in way over my head!

My questions:

What, in your opinion, is the simplest way to integrate text and graphics 
reports into a single report such as a pdf file. 

If the answer to this is LaTeX and Sweave, is it difficult to use a text editor 
such as Tinn-R or would you strongly recommend I leave behind Tinn and move 
over to an editor that has more LaTeX help?  

In reading over Friedrich Leisch's Sweave User Manual (v 1.6.0) I am 
beginning to think I can do everything I need with my simple editor. Before 
spending many hours going down that path, I thought it prudent to ask the R 
community.

It is likely I am misunderstanding some of the process here and any 
clarifications are welcome. 

Thank you in advance for any thoughts. 
Tim Howard

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] opinions please: text editors and reporting/Sweave?

2007-05-30 Thread Greg Snow
Tim,

First, I personnally am a big fan of LaTeX, Emacs, and ESS and I think
that in the long run you would benefit from learning all of them
(probably start with Emacs, then ESS, then LaTeX once you already have a
knowledge of Emacs and how it can help).

Since you asked about the simplest way to go, you may want to look at
the odfWeave package.  This gives you the power of Sweave, but without
having to learn LaTeX.  It works with documents in openoffice (a free
office suite similar to and mostly compatible with microsoft office
(word)).  Using this you can create your template using openoffice
writer (or MS word, then convert using openoffice), run it through
R/odfWeave, and have the result as another openoffice document that can
then be converted to MS word or pdf.

Personally, if I am doing something for myself, or in which the output
format does not matter, then I use Sweave with LaTeX (using Emacs and
ESS).  But, often my results need to be sent to a client that will cut
and past my results into an MS word document or power point
presentation.  Then I find it easier to use openoffice and odfWeave and
have the end result be an MS word document that can be e-mailed to the
client for them to mangle in ways they feel the need to.

(there is also an HTML driver for Sweave I nthe the R2HTML package where
you can have the template file resemble html and the final output is in
html)

Hope this helps, 

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
[EMAIL PROTECTED]
(801) 408-8111
 
 

 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of Tim Howard
 Sent: Wednesday, May 30, 2007 2:43 PM
 To: r-help@stat.math.ethz.ch
 Subject: [R] opinions please: text editors and reporting/Sweave?
 
 dear all - 
 
 I currently use Tinn-R as my text editor to work with code 
 that I submit to R, with some output dumped to text files, 
 some images dumped to pdf. (system: Windows 2K and XP, R 
 2.4.1 and R 2.5). We are using R for overnight runs to create 
 large output data files for GIS, but then I need simple 
 output reports for analysis results for each separate data 
 set. Thus, I create many reports of the same style, but just 
 based on different input data.
 
 I am recognizing that I need a better reporting system, so 
 that I can create clean reports for each separate R run. This 
 obviously means using Sweave and some implementation of 
 LaTex, both of which are new to me. I've installed MikTex and 
 successfully completed a demo or two for creating pdfs from raw LaTeX.
 
 It appears that if I want to ease my entry into the world of 
 LaTeX, I might need to switch editors to something like Emacs 
 (I read somewhere that Emacs helps with the TeX markup?). 
 After quite a while wallowing at the Emacs site, I am finding 
 that ESS is well integrated with R and might be the way to 
 go. Aaaagh... I'm in way over my head!
 
 My questions:
 
 What, in your opinion, is the simplest way to integrate text 
 and graphics reports into a single report such as a pdf file. 
 
 If the answer to this is LaTeX and Sweave, is it difficult to 
 use a text editor such as Tinn-R or would you strongly 
 recommend I leave behind Tinn and move over to an editor that 
 has more LaTeX help?  
 
 In reading over Friedrich Leisch's Sweave User Manual (v 
 1.6.0) I am beginning to think I can do everything I need 
 with my simple editor. Before spending many hours going down 
 that path, I thought it prudent to ask the R community.
 
 It is likely I am misunderstanding some of the process here 
 and any clarifications are welcome. 
 
 Thank you in advance for any thoughts. 
 Tim Howard
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide 
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] [R-sig-Geo] Connecting to PostgreSQL/PostGIS from R (rgdal?)

2007-05-30 Thread Tim Keitt
I would also recommend you take a look at RODBC for general purpose
database access. My impression is that it has received a lot more
maintenance attention lately.

I can't comment on the windows gdal binaries as I'm not too familiar
with that platform.

THK

On 5/30/07, Mike Leahy [EMAIL PROTECTED] wrote:
 Hello,

 I've been trying every now and then to find a cross operating system
 solution that would let me access PostgreSQL (and PostGIS) from R, or to
 access R from PostgreSQL.  I know of pl/r, which accomplishes the
 latter, but has yet to be successfully ported to Windows.  Similarly,
 I've tried to use Rdbi and DBI, but I haven't had luck with those on
 Windows either for connecting to PostgreSQL from R.  Can anyone suggest
 a solution for this?

 It would seem that rgdal could also help me in this case. Unfortunately,
 the version of the GDAL library that is included in the rdgal binary
 available on CRAN (for windows) doesn't include the PostgreSQL driver
 for OGR (i.e., it's not listed by the ogrDrivers() function).

 I compiled rgdal on Windows myself using the GDAL library from
 FWTools-1.3.1, but I was unsuccessful at creating a proper binary
 package for R.  I was only able to get it to work by substituting the
 rgdal.dll that was installed by CRAN with the one that I compiled that
 links against the GDAL library from FWTools.  Even though it works (at
 first glance with ogrInfo(), and readOGR()), I still get a warning
 message when I load the libary: DLL attempted to change FPU control
 word from 8001f to 9001f.

 So my question with respect to rgdal is a) is it likely that an rgdal
 package is going to be released in the future with the PostgreSQL driver
 included in GDAL/OGR, or b) are there any suggestions/instructions that
 might get me through the compilation and packaging process for rgdal
 with better success?

 Thanks in advance for any help,
 Mike

 ___
 R-sig-Geo mailing list
 [EMAIL PROTECTED]
 https://stat.ethz.ch/mailman/listinfo/r-sig-geo



-- 
Timothy H. Keitt, University of Texas at Austin
Contact info and schedule at http://www.keittlab.org/tkeitt/
Reprints at http://www.keittlab.org/tkeitt/papers/
ODF attachment? See http://www.openoffice.org/

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] opinions please: text editors and reporting/Sweave?

2007-05-30 Thread Mike Lawrence
One minor warning regarding LaTeX: I have encountered journals in the  
psychological field (specifically, journals of the psychonomic  
society) that refuse to accept articles prepared in LaTeX, even if  
they are submitted as PDF. I'm a big LaTeX fan myself, so I really  
can't comprehend this.

On 30-May-07, at 6:07 PM, Greg Snow wrote:

 Tim,

 First, I personnally am a big fan of LaTeX, Emacs, and ESS and I think
 that in the long run you would benefit from learning all of them
 (probably start with Emacs, then ESS, then LaTeX once you already  
 have a
 knowledge of Emacs and how it can help).

 Since you asked about the simplest way to go, you may want to look at
 the odfWeave package.  This gives you the power of Sweave, but without
 having to learn LaTeX.  It works with documents in openoffice (a free
 office suite similar to and mostly compatible with microsoft office
 (word)).  Using this you can create your template using openoffice
 writer (or MS word, then convert using openoffice), run it through
 R/odfWeave, and have the result as another openoffice document that  
 can
 then be converted to MS word or pdf.

 Personally, if I am doing something for myself, or in which the output
 format does not matter, then I use Sweave with LaTeX (using Emacs and
 ESS).  But, often my results need to be sent to a client that will cut
 and past my results into an MS word document or power point
 presentation.  Then I find it easier to use openoffice and odfWeave  
 and
 have the end result be an MS word document that can be e-mailed to the
 client for them to mangle in ways they feel the need to.

 (there is also an HTML driver for Sweave I nthe the R2HTML package  
 where
 you can have the template file resemble html and the final output  
 is in
 html)

 Hope this helps,

 -- 
 Gregory (Greg) L. Snow Ph.D.
 Statistical Data Center
 Intermountain Healthcare
 [EMAIL PROTECTED]
 (801) 408-8111



 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On Behalf Of Tim Howard
 Sent: Wednesday, May 30, 2007 2:43 PM
 To: r-help@stat.math.ethz.ch
 Subject: [R] opinions please: text editors and reporting/Sweave?

 dear all -

 I currently use Tinn-R as my text editor to work with code
 that I submit to R, with some output dumped to text files,
 some images dumped to pdf. (system: Windows 2K and XP, R
 2.4.1 and R 2.5). We are using R for overnight runs to create
 large output data files for GIS, but then I need simple
 output reports for analysis results for each separate data
 set. Thus, I create many reports of the same style, but just
 based on different input data.

 I am recognizing that I need a better reporting system, so
 that I can create clean reports for each separate R run. This
 obviously means using Sweave and some implementation of
 LaTex, both of which are new to me. I've installed MikTex and
 successfully completed a demo or two for creating pdfs from raw  
 LaTeX.

 It appears that if I want to ease my entry into the world of
 LaTeX, I might need to switch editors to something like Emacs
 (I read somewhere that Emacs helps with the TeX markup?).
 After quite a while wallowing at the Emacs site, I am finding
 that ESS is well integrated with R and might be the way to
 go. Aaaagh... I'm in way over my head!

 My questions:

 What, in your opinion, is the simplest way to integrate text
 and graphics reports into a single report such as a pdf file.

 If the answer to this is LaTeX and Sweave, is it difficult to
 use a text editor such as Tinn-R or would you strongly
 recommend I leave behind Tinn and move over to an editor that
 has more LaTeX help?

 In reading over Friedrich Leisch's Sweave User Manual (v
 1.6.0) I am beginning to think I can do everything I need
 with my simple editor. Before spending many hours going down
 that path, I thought it prudent to ask the R community.

 It is likely I am misunderstanding some of the process here
 and any clarifications are welcome.

 Thank you in advance for any thoughts.
 Tim Howard

 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting- 
 guide.html
 and provide commented, minimal, self-contained, reproducible code.

--
Mike Lawrence
Graduate Student, Department of Psychology, Dalhousie University

Website: http://myweb.dal.ca/mc973993
Public calendar: http://icalx.com/public/informavore/Public

The road to wisdom? Well, it's plain and simple to express:
Err and err and err again, but less and less and less.
- Piet Hein

__
R-help@stat.math.ethz.ch 

[R] determining a parent function name

2007-05-30 Thread Sundar Dorai-Raj
Hi, All,

I'm writing a wrapper for stop that produces a popup window using tcltk. 
Something like:

error - function(...) {
   msg - paste(..., sep = )
   if(!length(msg)) msg - 
   if(require(tcltk, quiet = TRUE)) {
 tt - tktoplevel()
 tkwm.title(tt, Error)
 tkmsg - tktext(tt, bg = white)
 tkinsert(tkmsg, end, sprintf(Error in %s: %s, ???, msg))
 tkconfigure(tkmsg, state = disabled, font = Tahoma 12,
 width = 50, height = 3)
 tkpack(tkmsg, side = bottom, fill = y)
   }
   stop(msg)
}

But, I would like to know from which function error() is called. For 
example, if I have

foo - function() stop()
bar - function() error()
  foo()
Error in foo() :
  bar()
Error in error() :

and in the tk window I get

Error in ???:

I need the output of bar (in the tk window only) to be

Error in bar():

then it's clear where error is called. I'm not worried about the output 
bar() produces on the console.

Hope this makes sense.

Thanks,

--sundar

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] runif with weights

2007-05-30 Thread João Fadista
Dear all,
 
I would like to generate 25 numbers from 1 to 100 but I would like to have some 
numbers that could  be more probable to come out. I was thinking of the 
function runif:
runif(25, 1, 100) , but I don´t know how to give more weight to some numbers.
 
Example:
each number from 2 to 10 has the probability of 40% to come out but the 
probability of each number from 11 to 100 to come out is 60%.
 
 
 
Kind regards and thanks in advance,
João Fadista

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] runif with weights

2007-05-30 Thread Ken Knoblauch
Not sure why you have set the probability of a 1 to 0 but maybe something
like this might be what you want:

round( ifelse( rbinom(25, 1, 0.4), runif(25, 2, 10), runif(25, 11, 100) ) )
 [1]  2  6 34 90 79 71 83  8 47 36 21 32 17 71  3 16  9 65 94  6 30  5  7
10 13



I would like to generate 25 numbers from 1 to 100 but I would like to have
some numbers that could  be more probable to come out. I was thinking of
the function runif:
runif(25, 1, 100) , but I don´t know how to give more weight to some numbers.

Example:
each number from 2 to 10 has the probability of 40% to come out but the
probability of each number from 11 to 100 to come out is 60%.


-- 
Ken Knoblauch
Inserm U846
Institut Cellule Souche et Cerveau
Département Neurosciences Intégratives
18 avenue du Doyen Lépine
69500 Bron
France
tel: +33 (0)4 72 91 34 77
fax: +33 (0)4 72 91 34 61
portable: +33 (0)6 84 10 64 10
http://www.pizzerialesgemeaux.com/u846/

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] runif with weights

2007-05-30 Thread Bert Gunter
You did not explicitly say it, but your example indicates that you want to
sample from integers only (else what would weights mean?). So...

?sample  -- in particular note the prob argument and read help docs
carefully

e.g.

sample(100,25,prob=c(0,rep.int(.4,9),rep.int(.6,90))) ## without replacement

Bert Gunter
Genentech Nonclinical Statistics


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Ken Knoblauch
Sent: Wednesday, May 30, 2007 5:59 PM
To: [EMAIL PROTECTED]
Cc: r-help@stat.math.ethz.ch
Subject: [R] runif with weights

Not sure why you have set the probability of a 1 to 0 but maybe something
like this might be what you want:

round( ifelse( rbinom(25, 1, 0.4), runif(25, 2, 10), runif(25, 11, 100) ) )
 [1]  2  6 34 90 79 71 83  8 47 36 21 32 17 71  3 16  9 65 94  6 30  5  7
10 13



I would like to generate 25 numbers from 1 to 100 but I would like to have
some numbers that could  be more probable to come out. I was thinking of
the function runif:
runif(25, 1, 100) , but I don´t know how to give more weight to some
numbers.

Example:
each number from 2 to 10 has the probability of 40% to come out but the
probability of each number from 11 to 100 to come out is 60%.


-- 
Ken Knoblauch
Inserm U846
Institut Cellule Souche et Cerveau
Département Neurosciences Intégratives
18 avenue du Doyen Lépine
69500 Bron
France
tel: +33 (0)4 72 91 34 77
fax: +33 (0)4 72 91 34 61
portable: +33 (0)6 84 10 64 10
http://www.pizzerialesgemeaux.com/u846/

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] sizing and saving graphics in R

2007-05-30 Thread Felicity Jones

Dear R wizards,

I am seeking advice on graphics in R.  Specifically, how to manipulate  
the size and save a plot I have produced using the LDheatmap library.   
I confess I am relatively new to graphics in R, but I would greatly  
appreciate any suggestions you may have.

LDheatmap produces a coloured triangular matrix of pairwise  
associations between 600 genetic markers in my dataset.  Initially the  
graphical output was confined to the computer screen, such that each  
pairwise marker association was displayed as approximately 1 pixel  
(too small for me to interpret).

I have successfully managed to play with the LDheatmap function to  
enlarge the size of viewport by changing the following code in   
LDheatmap

#From

heatmapVP - viewport(width = unit(0.8, snpc), height = unit(0.8, snpc),
name=vp.name)

#To
heatmapVP - viewport(width = unit(25, inches), height = unit(25,  
inches), name=vp.name)

This produces a much larger plot (so big that the majority is not seen  
on the screen).  I would like to save the entire thing so that I can  
import it into photoshop or some other image software.

My problem is that when I save using the R graphics console  
(File-Save As-bmp), it only saves the section I can see on the  
screen.  Any suggestions on how to save the whole plot or manipulate  
the plot so I get higher resolution would be much appreciated.

Thanks for your help in advance,

Felicity.








___

Dr Felicity Jones
Department of Developmental Biology
Stanford University School of Medicine
Beckman Center
279 Campus Drive
Stanford CA 94305-5329
USA

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] sizing and saving graphics in R

2007-05-30 Thread Murray Pung
I use the savePlot function for saving graphics. The following will save the
active graphics panel in your working directory, in format wmf, which I find
has a high resolution. Check out other possible formats in help.

savePlot(filename = myfilename,type = c(wmf))

Murray



On 31/05/07, Felicity Jones [EMAIL PROTECTED] wrote:


 Dear R wizards,

 I am seeking advice on graphics in R.  Specifically, how to manipulate
 the size and save a plot I have produced using the LDheatmap library.
 I confess I am relatively new to graphics in R, but I would greatly
 appreciate any suggestions you may have.

 LDheatmap produces a coloured triangular matrix of pairwise
 associations between 600 genetic markers in my dataset.  Initially the
 graphical output was confined to the computer screen, such that each
 pairwise marker association was displayed as approximately 1 pixel
 (too small for me to interpret).

 I have successfully managed to play with the LDheatmap function to
 enlarge the size of viewport by changing the following code in
 LDheatmap

 #From

 heatmapVP - viewport(width = unit(0.8, snpc), height = unit(0.8,
 snpc),
 name=vp.name)

 #To
 heatmapVP - viewport(width = unit(25, inches), height = unit(25,
 inches), name=vp.name)

 This produces a much larger plot (so big that the majority is not seen
 on the screen).  I would like to save the entire thing so that I can
 import it into photoshop or some other image software.

 My problem is that when I save using the R graphics console
 (File-Save As-bmp), it only saves the section I can see on the
 screen.  Any suggestions on how to save the whole plot or manipulate
 the plot so I get higher resolution would be much appreciated.

 Thanks for your help in advance,

 Felicity.








 ___

 Dr Felicity Jones
 Department of Developmental Biology
 Stanford University School of Medicine
 Beckman Center
 279 Campus Drive
 Stanford CA 94305-5329
 USA

 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.




-- 
Murray Pung
Statistician, Datapharm Australia Pty Ltd
0404 273 283

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] cox goodness of fit

2007-05-30 Thread Murray Pung
Is there an implementation of the Cox-Snell residuals / Nelson-Aalen plot
for goodness of fit?

Or otherwise is there an appropriate Goodness of Fit diagnostic?

Thanks
Murray

-- 
Murray Pung
Statistician, Datapharm Australia Pty Ltd
0404 273 283

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] how to preserve trained model in LDA?

2007-05-30 Thread Feng Qiu
Hi all:

   I'm developing an application in which I use standard data to
train the model in LDA and use the trained model to predict on test data. I
can't train the model every time when I do prediction. So I need to save the
trained model onto disk after the first training. Does anybody have idea
about this? You help is highly appreciated. 

 

Best Regards

 

Feng


[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] opinions please: text editors and reporting/Sweave?

2007-05-30 Thread Duncan Murdoch
Tim Howard wrote:
 dear all - 

 I currently use Tinn-R as my text editor to work with code that I submit to 
 R, with some output dumped to text files, some images dumped to pdf. (system: 
 Windows 2K and XP, R 2.4.1 and R 2.5). We are using R for overnight runs to 
 create large output data files for GIS, but then I need simple output reports 
 for analysis results for each separate data set. Thus, I create many reports 
 of the same style, but just based on different input data.

 I am recognizing that I need a better reporting system, so that I can create 
 clean reports for each separate R run. This obviously means using Sweave and 
 some implementation of LaTex, both of which are new to me. I've installed 
 MikTex and successfully completed a demo or two for creating pdfs from raw 
 LaTeX.

 It appears that if I want to ease my entry into the world of LaTeX, I might 
 need to switch editors to something like Emacs (I read somewhere that Emacs 
 helps with the TeX markup?). After quite a while wallowing at the Emacs site, 
 I am finding that ESS is well integrated with R and might be the way to go. 
 Aaaagh... I'm in way over my head!
   

If you are used to Windows, you might find the shareware editors WinEdt 
or Textpad more familiar.  WinEdt has advantages of lots of LaTeX 
integration.

Duncan Murdoch
 My questions:

 What, in your opinion, is the simplest way to integrate text and graphics 
 reports into a single report such as a pdf file. 

 If the answer to this is LaTeX and Sweave, is it difficult to use a text 
 editor such as Tinn-R or would you strongly recommend I leave behind Tinn and 
 move over to an editor that has more LaTeX help?  

 In reading over Friedrich Leisch's Sweave User Manual (v 1.6.0) I am 
 beginning to think I can do everything I need with my simple editor. Before 
 spending many hours going down that path, I thought it prudent to ask the R 
 community.

 It is likely I am misunderstanding some of the process here and any 
 clarifications are welcome. 

 Thank you in advance for any thoughts. 
 Tim Howard

 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] opinions please: text editors and reporting/Sweave?

2007-05-30 Thread Jared O'Connell
Winshell (http://www.winshell.de/) is another (free) option if you want a
Windows editor with good MikTEX integration.

On 5/31/07, Duncan Murdoch [EMAIL PROTECTED] wrote:

 Tim Howard wrote:
  dear all -
 
  I currently use Tinn-R as my text editor to work with code that I submit
 to R, with some output dumped to text files, some images dumped to pdf.
 (system: Windows 2K and XP, R 2.4.1 and R 2.5). We are using R for
 overnight runs to create large output data files for GIS, but then I need
 simple output reports for analysis results for each separate data set. Thus,
 I create many reports of the same style, but just based on different input
 data.
 
  I am recognizing that I need a better reporting system, so that I can
 create clean reports for each separate R run. This obviously means using
 Sweave and some implementation of LaTex, both of which are new to me. I've
 installed MikTex and successfully completed a demo or two for creating pdfs
 from raw LaTeX.
 
  It appears that if I want to ease my entry into the world of LaTeX, I
 might need to switch editors to something like Emacs (I read somewhere that
 Emacs helps with the TeX markup?). After quite a while wallowing at the
 Emacs site, I am finding that ESS is well integrated with R and might be the
 way to go. Aaaagh... I'm in way over my head!
 

 If you are used to Windows, you might find the shareware editors WinEdt
 or Textpad more familiar.  WinEdt has advantages of lots of LaTeX
 integration.

 Duncan Murdoch
  My questions:
 
  What, in your opinion, is the simplest way to integrate text and
 graphics reports into a single report such as a pdf file.
 
  If the answer to this is LaTeX and Sweave, is it difficult to use a text
 editor such as Tinn-R or would you strongly recommend I leave behind Tinn
 and move over to an editor that has more LaTeX help?
 
  In reading over Friedrich Leisch's Sweave User Manual (v 1.6.0) I am
 beginning to think I can do everything I need with my simple editor. Before
 spending many hours going down that path, I thought it prudent to ask the R
 community.
 
  It is likely I am misunderstanding some of the process here and any
 clarifications are welcome.
 
  Thank you in advance for any thoughts.
  Tim Howard
 
  __
  R-help@stat.math.ethz.ch mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
  and provide commented, minimal, self-contained, reproducible code.
 

 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Generating Data using Formulas

2007-05-30 Thread Charles C. Berry

Christian,

The formula language is not suited to such recursive useage 
AFAICS.

You can _vectorize_ your code like this:

cmat - outer( 1:25, 1:25, function(y,x) ifelse( xy, 0, 0.8^(y-x) ) )
res - replicate(1000,{
y - 1 + cmat %*% rnorm(25)
coef(lm(y[-1]~y[-25]))
})
rowMeans(res) # mean of 1000 replicates

HTH,

Chuck

On Tue, 29 May 2007, Chrisitan Falde wrote:

 Hello,

 My name is Christian Falde.  I am new to R.

 My problem is this.  I am attempting to learn R on my own. In so doing I 
 am using some problems from Davidson and MacKinnon Econometric Theory 
 and Methods to do so.  This is because I can already do the some of the 
 problems in SAS so I am attempting to rework them using R. Seemed 
 logical to me, now I am stuck and its really bugging me.


 The problem is this

 Generate a data set sample size of 25 with the formula y=1+.8*y(t-1)+ u. 
 Where y is the dependent, y(t-1) is the dependent variable lagged one 
 peroid, and u is the classical error term.  Assume y0=0 and the u is 
 NID(0,1). Use this sample to compute the OLS estimates B1 (1) and 
 B2(.8).  Repeat at least 100 times and find the average of the B's. 
 Use these average to estimate the bias of the ols estimators.

 To start I did the following non lagged program.

 final-function(i,j){x-function(i) {10*i}
 y-function(i,j) {1+.8*10*i+100*rnorm(j)}
 datathreeone- data.frame(replicate(100,coef(lm(y(i,j)~x(i)
 rowMeans(datathreeone)}
 final(1:25,25)
 final(1:50,50)
 final(1:100,100)
 final(1:200,200)
 final(1:1,1)


 Now the only thing I need to to is change .8*10*i  which is 
 exogenous to .8* y(t-1) .

 There are two reasons why I did it this way. I needed the rnorm(i) to 
 generate a new set of u's each replication, and I wanted to be able to 
 use the function as i did to make the results more concise.

 For the lag in SAS we used an if then else logic relating to the number 
 of observation.  This in R would have to be linked to the invisable row 
 number.  I think I need an index variable for the row.  Perhaps, sorry 
 thinking while typing.

 Another reason why I am stuck, the lag function was seemingly straight 
 forward.

 lag (x, k=1)

 yet x has to be a matrix so when I tried to do it like above with y as a 
 function R complained.

 I have been working on this for a couple of days now so everything is 
 begining to not make sense.  It just seems to me to get the matrix to 
 work out I would need to have two matrices.

 dependentand   explanatory
 y1 = sum (  1 +.8*0 + 100*rnorm(i))
 y2 = sum ( 1 +.8* (dependent row 1) + 100*rnorm(i))
 etc

 I just am not sure how to do that.

 Please help and thank you for your time,

 christian falde

[snip]

Charles C. Berry(858) 534-2098
  Dept of Family/Preventive Medicine
E mailto:[EMAIL PROTECTED]   UC San Diego
http://biostat.ucsd.edu/~cberry/ La Jolla, San Diego 92093-0901

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Factor function: odd behavior when labels argument containsduplicates?

2007-05-30 Thread Bill.Venables
There is a difference between levels and labels.  I think this is what
you want.

 x - factor(rep(0:5, 2))
 x
 [1] 0 1 2 3 4 5 0 1 2 3 4 5
Levels: 0 1 2 3 4 5
 levels(x) - c(1,1:5)
 x
 [1] 1 1 2 3 4 5 1 1 2 3 4 5
Levels: 1 2 3 4 5
 table(x)
x
1 2 3 4 5 
4 2 2 2 2 

 


Bill Venables
CSIRO Laboratories
PO Box 120, Cleveland, 4163
AUSTRALIA
Office Phone (email preferred): +61 7 3826 7251
Fax (if absolutely necessary):  +61 7 3826 7304
Mobile:(I don't have one!)
Home Phone: +61 7 3286 7700
mailto:[EMAIL PROTECTED]
http://www.cmis.csiro.au/bill.venables/ 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Steen Ladelund
Sent: Wednesday, 30 May 2007 6:27 PM
To: r-help@stat.math.ethz.ch
Subject: [R] Factor function: odd behavior when labels argument
containsduplicates?

Hi all.

I think it would be nice to be able to combine levels of a factor on
creation a la

 x - rep(0:5,5)

 y - factor(x,levels=0:5,labels=c('1','1',2:5))  ## (1)

 y
 [1] 1 1 2 3 4 5 1 1 2 3 4 5 1 1 2 3 4 5 1 1 2 3 4 5 1 1 2 3 4 5
Levels: 1 1 2 3 4 5

I thougt this would (should?) create a factor with 5 levels, ie
combining 0 and 1 in x into one level in y.

I find it hard to predict the behavior of the following lines:

 table(factor(y))  ## Odd ?
 1  1  2  3  4  5 
10  0  5  5  5  5 
 table(factor(factor(y)))  ## This is what I want
 1  2  3  4  5 
10  5  5  5  5 

It also seems strange that this should be the way to go:
 levels(y) - levels(y)   ## Does what I want following (1) even tough
it appear to be a void statement?
 y
y
 [1] 1 1 2 3 4 5 1 1 2 3 4 5 1 1 2 3 4 5 1 1 2 3 4 5 1 1 2 3 4 5
Levels: 1 2 3 4 5

Am I missing an important point about factors or the factor function?

steen

Steen Ladelund, statistician
+4543233275 [EMAIL PROTECTED]
Research Center for Prevention and Health
Glostrup University Hospital, Denmark
www.fcfs.kbhamt.dk

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] lattice: aligning independent graphs

2007-05-30 Thread Sebastian P. Luque
On Sun, 27 May 2007 15:09:43 -0700,
Deepayan Sarkar [EMAIL PROTECTED] wrote:

[...]

 Better in what sense? You are trying to use lattice to do something that
 lattice isn't designed to do, so there is no solution that is clean in
 a philosophical sense. Ideally, you want something like grid, that
 allows you to control the layout in as much detail as you want (you can
 still use panel.xyplot, panel.grid, etc. as panel functions once you
 set up everything else). On the other hand, lattice gets you very close,
 and the only improvement I can think of is some sort of automated scheme
 to align the x labels to the respective columns. Here's one approach to
 do that (taking advantage of the fact that xlab can be an arbitrary
 grob):

[...]

I'm not yet savvy with grid, but if one were to do the same for y axis
labels, I thought the following modification to your code might do that:


--cut here---start-
myXlabGrob -
function(...) ## ...is lab1, lab2, etc
{
## you can add arguments to textGrob for more control
## in the next line
labs - lapply(list(...), textGrob, rot=90)
nlabs - length(labs)
lab.heights -
lapply(labs,
   function(lab) unit(1, grobheight, data=list(lab)))
lab.layout -
grid.layout(ncol=1, nrow=nlabs,
heights=unit(1, null),
widths=do.call(max, lab.heights),
respect=TRUE)
lab.gf - frameGrob(layout=lab.layout)
for (i in seq_len(nlabs))
{
lab.gf - placeGrob(lab.gf, labs[[i]], row=i, col=1)
}
lab.gf
}


xyplot(1:9 ~ 1:9 | gl(3, 1, 9), layout=c(1, 3),
   ylab=myXlabGrob('Trial number', 'Subject number',
   'Experimental condition'), strip=FALSE)
--cut here---end---


which gives wrong width and placement.  How can this be modified so it
places the labels close to the axis annotation, centered on each panel?
Thanks in advance.



Cheers,

-- 
Seb

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.