Re: [R] linux compile options (64-bit)

2005-08-02 Thread Prof Brian Ripley
We find it equally strange that you posted this!

The advice _is_ in the R-admin manual which the INSTALL file asks you to 
read if you have any questions.  It covers using enhanced BLAS libraries.

R builds out of the box on FC3, FC4 and Suse on AMD64.  I use Goto's BLAS, 
but ATLAS can be used (except that building a shared version is tricky).

Quite a few packages have been written in ways that stop them building on 
64-bit platforms (and the maintainers have been informed but not fixed 
them).

On Mon, 1 Aug 2005, Jacob Michaelson wrote:

 Sorry--sent this before I added a subject line...

 Begin forwarded message:

 From: Jacob Michaelson [EMAIL PROTECTED]
 Date: August 1, 2005 8:51:58 PM MDT
 To: r-help@stat.math.ethz.ch


 I've been using R for a while under Mac OS X, which thanks to the R
 on OS X developers, is probably the best platform for learning R.
 I recently built a Linux box with a Pentium D processor, and am
 running an AMD64 port of Ubuntu with the SMP kernel.

 After setting up the basics on the box, I thought I'd install R as
 well. I've had a very hard time finding good documentation on some
 configure flags/options for compiling a 64-bit version of R on
 Linux.  I thought this was very strange, considering Linux is
 apparently the R developer's platform of choice.

 Can anyone point me to some good build instructions for 64-bit R
 under Linux?  Should I compile it against any additional libraries
 for better performance?

   [[alternative HTML version deleted]]

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

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


Re: [R] Rgdal windows binary warning message

2005-08-02 Thread Prof Brian Ripley
This is a consequence of how VC++ compiled gdal.  R is protecting 
itself against that.  Since R did not crash, there is nothing to worry 
about.

On Tue, 2 Aug 2005, Tony Gill wrote:

 Hi all,

 I just downloaded windows binaries of RGDAL (from
 http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/2.1/) and installed.

 I ran the example R_HOME\library\rgdal\R-ex\getPixmapGDAL.R and everything
 seemed to work as expected. However I got the following warning message:

 DLL attempted to change FPU control word from 8001f to 9001f

 The R-help (?dyn.load) describes the problem as:

 
 External code must not change the floating point control word, but
 many DLLs do so.  Common changes are to set it to use 53 bit
 precision instead of R's default 64 bit precision, or to unmask
 some exceptions.  'dyn.load' detects such changes,  and restores
 R's control word to its default value of hex 8001F.   This may
 cause the DLL to malfunction; if so, it should be rewritten to
 save and restore the control word itself.  If 'warn.FPU' is set to
 'TRUE' using the 'options' function,  a warning will be printed.
 (If the warning says that the control word was changed from some
 other value than 8001F,  please report the circumstances to the
 Windows maintainers:   that probably indicates an internal bug.)

 

 Does anyone know if this is a major problem for reading and manipulating
 image files using RDAL? And if so are there windows binaries which have
 patched it up?

 Thanks in advance

 Tony

 **
 Tony Gill - PhD Candidate
 Centre for Remote Sensing  Spatial Information Science
 School of Geography, Planning  Architecture
 University of Queensland
 Brisbane, Queensland, AUSTRALIA, 4072
 Ph: 61-7-3365-7027
 email: [EMAIL PROTECTED]

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


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


Re: [R] can we manage memory usage to increase speed?

2005-08-02 Thread Prof Brian Ripley
On Mon, 1 Aug 2005, Haibo Huang wrote:

 Please refer to the following post.

Which is about Windows only, not Linux.  (And on Windows, the answer given 
is on the help page for memory.size. together with a better one.)


 Ed

 --- Mike Lawrence [EMAIL PROTECTED] wrote:

 Date: Mon,  1 Aug 2005 00:19:06 -0300
 From: Mike Lawrence [EMAIL PROTECTED]
 To: Briggs, Meredith M
 [EMAIL PROTECTED]
 CC: r-help@stat.math.ethz.ch
 Subject: Re: [R] How do you increase memeory?

 memory.limit(size = x)

 where x is the desired memory limit in MB.



 Quoting Briggs, Meredith M
 [EMAIL PROTECTED]:

 Hello


 Function memory.size() =435109888. How do I
 increase it by, say 30%?

 Thanks
 Meredith

 --- Zhilin Liu [EMAIL PROTECTED] wrote:

 Hi,

 Thanks for reading.

 I am running  a process in R for microarray data
 analysis. RedHat Enterprise Linux 4, dual AMD CPU,
 6G memory. However, the R process use only a total
 of 200M memory. And the CPU usage is total to ~110%
 for two. The program takes at least 2 weeks to run
 at the current speed. Is there some way we can
 increase the usage of CPUs and memories and speed
 up? Any suggestion is appreciated.

 Thanks again.

 Zhilin

  [[alternative HTML version deleted]]

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


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


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


Re: [R] linux compile options (64-bit)

2005-08-02 Thread Göran Broström
On Tue, Aug 02, 2005 at 07:34:39AM +0100, Prof Brian Ripley wrote:
 We find it equally strange that you posted this!
 
 The advice _is_ in the R-admin manual which the INSTALL file asks you to 
 read if you have any questions.  It covers using enhanced BLAS libraries.
 
 R builds out of the box on FC3, FC4 and Suse on AMD64.  I use Goto's BLAS, 
 but ATLAS can be used (except that building a shared version is tricky).

Incidentally, I have just tried building R on a Fujitsu Amilo amd64 with
debian-amd64 (unstable) and ATLAS. Both 'make' and 'make check' worked
without complaints with gcc-3.4.5, but when I tried gcc-4.0.1, 'make check' 
failed with a segmentation error after
-
R is now configured for x86_64-unknown-linux-gnu

  Source directory:  .
  Installation directory:/usr/local

  C compiler:/usr/bin/gcc-4.0  -g -O2
  C++ compiler:  /usr/bin/g++-4.0  -g -O2
  Fortran compiler:  /usr/bin/gfortran-4.0  -g -O2

  Interfaces supported:  X11, tcltk
  External libraries:readline, BLAS(ATLAS)
  Additional capabilities:   PNG, JPEG, iconv, MBCS, NLS
  Options enabled:   R profiling

  Recommended packages:  yes
---
amilo:/usr/local/src/R/R-2.1.1# make check
make[1]: Entering directory `/usr/local/src/R/R-2.1.1/tests'
make[2]: Entering directory `/usr/local/src/R/R-2.1.1/tests'
make[3]: Enteri|ng directory `/usr/local/src/R/R-2.1.1/tests/Examples'
make[4]: Entering directory `/usr/local/src/R/R-2.1.1/tests/Examples'
make[4]: Leaving directory `/usr/local/src/R/R-2.1.1/tests/Examples'
make[4]: Entering directory `/usr/local/src/R/R-2.1.1/tests/Examples'
collecting examples for package 'base' ...
make[5]: Entering directory `/usr/local/src/R/R-2.1.1/src/library'
  Building/Updating help pages for package 'base'
 Formats: text html latex example
make[5]: Leaving directory `/usr/local/src/R/R-2.1.1/src/library'
running code in 'base-Ex.R' .../bin/sh: line 1:  9010 Segmentation fault  
../../bin/R --vanilla base-Ex.R base-Ex.Rout 21
make[4]: *** [base-Ex.Rout] Error 1
make[4]: Leaving directory `/usr/local/src/R/R-2.1.1/tests/Examples'
make[3]: *** [test-Examples-Base] Error 2
make[3]: Leaving directory `/usr/local/src/R/R-2.1.1/tests/Examples'
make[2]: *** [test-Examples] Error 2
make[2]: Leaving directory `/usr/local/src/R/R-2.1.1/tests'
make[1]: *** [test-all-basics] Error 1
make[1]: Leaving directory `/usr/local/src/R/R-2.1.1/tests'
make: *** [check] Error 2


 eigen(print(cbind(c(0,1i), c(-1i,0# Hermite == real Eigen values
 [,1] [,2]
[1,] 0+0i 0-1i
[2,] 0+1i 0+0i

Running it under 'R -d gdb': R hangs; after C-c:

Program received signal SIGINT, Interrupt.
zhetd2_ ([EMAIL PROTECTED], [EMAIL PROTECTED], a=0x10900f0,
[EMAIL PROTECTED], d=0x13b06e8, e=0xb6add8, tau=0x1bb6448,
[EMAIL PROTECTED], _uplo=1) at cmplx.f:8330
8330   CALL ZAXPY( N-I, ALPHA, A( I+1, I ), 1, TAU( I ), 1 )
Current language:  auto; currently fortran
---

[...]

Göran
-- 
Göran Broströmtel: +46 90 786 5223
Department of Statistics  fax: +46 90 786 6614
Umeå University   http://www.stat.umu.se/~goran.brostrom/
SE-90187 Umeå, Sweden 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


[R] Putting all elementes of the list in an enviorment of a function

2005-08-02 Thread Aleš Žiberna
Hello!

I have two functions.

The first one prepares the arguments for the second one. What is the best 
way to put all resoults of the first one into the second one? I tried 
attach, however the object in the main enviorment have a priority over the 
ones in list. An example is at the end.

Thanks in advance for any suggestions!
Ales Ziberna

For example - I would like to use just a instead of list$a in fuction 
second

first-function(a,b){
if(length(a)!=1) a - a[1]
if(length(b)!=1) b - b[1]
list(a=a,b=b)
}

second-function(list,c){
list$a + list$b + c
}

a-c(2,3)
b-4:64
c-5

res-first(a,b)
second(res,c)

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


Re: [R] linux compile options (64-bit)

2005-08-02 Thread Prof Brian Ripley

On Tue, 2 Aug 2005, Göran Broström wrote:


On Tue, Aug 02, 2005 at 07:34:39AM +0100, Prof Brian Ripley wrote:

We find it equally strange that you posted this!

The advice _is_ in the R-admin manual which the INSTALL file asks you to
read if you have any questions.  It covers using enhanced BLAS libraries.

R builds out of the box on FC3, FC4 and Suse on AMD64.  I use Goto's BLAS,
but ATLAS can be used (except that building a shared version is tricky).


Incidentally, I have just tried building R on a Fujitsu Amilo amd64 with
debian-amd64 (unstable) and ATLAS. Both 'make' and 'make check' worked
without complaints with gcc-3.4.5,


There is no gcc 3.4.5!  There are versions 3.3.5 and 3.4.4.

but when I tried gcc-4.0.1, 'make check' failed with a segmentation 
error after


I have seen this on FC3.  Note that ZAXPY is a BLAS routine, and you are 
using ATLAS: was that also built with gcc-4.0.1?  On FC3 I get the failure 
if I use its BLAS, and not if I configure R with --without-blas.  (I did 
not see the problem using the gcc4 RPM from FC3 update, and I gather 
others have managed to use gcc4 from FC4.)


We do not recommend gcc-4.0.x as yet: we have yet to see any performance 
gains (only losses) from it, and this is one of a number of known 
nuisances.  More serious are places where it apparently generates 
incorrect code and so gives incorrect answers.


...


eigen(print(cbind(c(0,1i), c(-1i,0# Hermite == real Eigen values

[,1] [,2]
[1,] 0+0i 0-1i
[2,] 0+1i 0+0i

Running it under 'R -d gdb': R hangs; after C-c:

Program received signal SIGINT, Interrupt.
zhetd2_ ([EMAIL PROTECTED], [EMAIL PROTECTED], a=0x10900f0,
   [EMAIL PROTECTED], d=0x13b06e8, e=0xb6add8, tau=0x1bb6448,
   [EMAIL PROTECTED], _uplo=1) at cmplx.f:8330
8330   CALL ZAXPY( N-I, ALPHA, A( I+1, I ), 1, TAU( I ), 1 )
Current language:  auto; currently fortran


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

Re: [R] Putting all elementes of the list in an enviorment of a function

2005-08-02 Thread Prof Brian Ripley
?with will help you.

I would avoid using 'list' as a function name, as it will confuse people 
and might confuse R too.

On Tue, 2 Aug 2005, [iso-8859-2] Alea }iberna wrote:

 Hello!

 I have two functions.

 The first one prepares the arguments for the second one. What is the best
 way to put all resoults of the first one into the second one? I tried
 attach, however the object in the main enviorment have a priority over the
 ones in list. An example is at the end.

 Thanks in advance for any suggestions!
 Ales Ziberna

 For example - I would like to use just a instead of list$a in fuction
 second

 first-function(a,b){
if(length(a)!=1) a - a[1]
if(length(b)!=1) b - b[1]
list(a=a,b=b)
 }

 second-function(list,c){
list$a + list$b + c
 }

 a-c(2,3)
 b-4:64
 c-5

 res-first(a,b)
 second(res,c)

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


Re: [R] Putting all elementes of the list in an enviorment of a function

2005-08-02 Thread Ales Ziberna
Thank you!

However, this does not do exacty what I want. I would like somehow to modify 
only the function second.

BTW, I used list only to create a list, it is not one of my functions.

Thanks again,
Ales Ziberna

- Original Message - 
From: Prof Brian Ripley [EMAIL PROTECTED]
To: Ales Ziberna [EMAIL PROTECTED]
Cc: R-help r-help@stat.math.ethz.ch
Sent: Tuesday, August 02, 2005 10:35 AM
Subject: Re: [R] Putting all elementes of the list in an enviorment of a 
function


 ?with will help you.

 I would avoid using 'list' as a function name, as it will confuse people
 and might confuse R too.

 On Tue, 2 Aug 2005, [iso-8859-2] Alea }iberna wrote:

 Hello!

 I have two functions.

 The first one prepares the arguments for the second one. What is the best
 way to put all resoults of the first one into the second one? I tried
 attach, however the object in the main enviorment have a priority over 
 the
 ones in list. An example is at the end.

 Thanks in advance for any suggestions!
 Ales Ziberna

 For example - I would like to use just a instead of list$a in fuction
 second

 first-function(a,b){
if(length(a)!=1) a - a[1]
if(length(b)!=1) b - b[1]
list(a=a,b=b)
 }

 second-function(list,c){
list$a + list$b + c
 }

 a-c(2,3)
 b-4:64
 c-5

 res-first(a,b)
 second(res,c)

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

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


Re: [R] linux compile options (64-bit)

2005-08-02 Thread Göran Broström
On Tue, Aug 02, 2005 at 09:33:45AM +0100, Prof Brian Ripley wrote:
 On Tue, 2 Aug 2005, Göran Broström wrote:
[...]

 Incidentally, I have just tried building R on a Fujitsu Amilo amd64 with
 debian-amd64 (unstable) and ATLAS. Both 'make' and 'make check' worked
 without complaints with gcc-3.4.5,
 
 There is no gcc 3.4.5!  There are versions 3.3.5 and 3.4.4.

I apologize for the incomplete description; gcc -v gives:

gcc version 3.4.5 20050706 (prerelease) (Debian 3.4.4-5)

 but when I tried gcc-4.0.1, 'make check' failed with a segmentation 
 error after
 
 I have seen this on FC3.  Note that ZAXPY is a BLAS routine, and you are 
 using ATLAS: was that also built with gcc-4.0.1?  

Probably not; I just 'apt-get install'ed atlas3-base etc. I'll build atlas
from source and try again. 

 On FC3 I get the failure 
 if I use its BLAS, and not if I configure R with --without-blas.  (I did 
 not see the problem using the gcc4 RPM from FC3 update, and I gather 
 others have managed to use gcc4 from FC4.)
 
 We do not recommend gcc-4.0.x as yet: we have yet to see any performance 
 gains (only losses) from it, and this is one of a number of known 
 nuisances.  More serious are places where it apparently generates 
 incorrect code and so gives incorrect answers.

OK. An additional advantage with gfortran(-4.x) will be the possibility to
use fortan95 code, n'est ce pas?

Göran

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


Re: [R] Putting all elementes of the list in an enviorment of a function

2005-08-02 Thread Prof Brian Ripley
On Tue, 2 Aug 2005, Ales Ziberna wrote:

 Thank you!

 However, this does not do exacty what I want. I would like somehow to modify 
 only the function second.

What happened when you tried my suggestion as

second - function(l, c) with(l, a + b + c)

?  It does work for me.

 BTW, I used list only to create a list, it is not one of my functions.

You used it as a variable within second()!


 Thanks again,
 Ales Ziberna

 - Original Message - From: Prof Brian Ripley 
 [EMAIL PROTECTED]
 To: Ales Ziberna [EMAIL PROTECTED]
 Cc: R-help r-help@stat.math.ethz.ch
 Sent: Tuesday, August 02, 2005 10:35 AM
 Subject: Re: [R] Putting all elementes of the list in an enviorment of a 
 function


 ?with will help you.
 
 I would avoid using 'list' as a function name, as it will confuse people
 and might confuse R too.
 
 On Tue, 2 Aug 2005, [iso-8859-2] Alea }iberna wrote:
 
 Hello!
 
 I have two functions.
 
 The first one prepares the arguments for the second one. What is the best
 way to put all resoults of the first one into the second one? I tried
 attach, however the object in the main enviorment have a priority over 
 the
 ones in list. An example is at the end.
 
 Thanks in advance for any suggestions!
 Ales Ziberna
 
 For example - I would like to use just a instead of list$a in fuction
 second
 
 first-function(a,b){
if(length(a)!=1) a - a[1]
if(length(b)!=1) b - b[1]
list(a=a,b=b)
 }
 
 second-function(list,c){
list$a + list$b + c
 }
 
 a-c(2,3)
 b-4:64
 c-5
 
 res-first(a,b)
 second(res,c)
 
 -- 
 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 



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


Re: [R] linux compile options (64-bit)

2005-08-02 Thread Prof Brian Ripley

On Tue, 2 Aug 2005, Göran Broström wrote:


On Tue, Aug 02, 2005 at 09:33:45AM +0100, Prof Brian Ripley wrote:

On Tue, 2 Aug 2005, Göran Broström wrote:

[...]


Incidentally, I have just tried building R on a Fujitsu Amilo amd64 with
debian-amd64 (unstable) and ATLAS. Both 'make' and 'make check' worked
without complaints with gcc-3.4.5,


There is no gcc 3.4.5!  There are versions 3.3.5 and 3.4.4.


I apologize for the incomplete description; gcc -v gives:

gcc version 3.4.5 20050706 (prerelease) (Debian 3.4.4-5)


but when I tried gcc-4.0.1, 'make check' failed with a segmentation
error after


I have seen this on FC3.  Note that ZAXPY is a BLAS routine, and you are
using ATLAS: was that also built with gcc-4.0.1?


Probably not; I just 'apt-get install'ed atlas3-base etc. I'll build atlas
from source and try again.


On FC3 I get the failure
if I use its BLAS, and not if I configure R with --without-blas.  (I did
not see the problem using the gcc4 RPM from FC3 update, and I gather
others have managed to use gcc4 from FC4.)

We do not recommend gcc-4.0.x as yet: we have yet to see any performance
gains (only losses) from it, and this is one of a number of known
nuisances.  More serious are places where it apparently generates
incorrect code and so gives incorrect answers.


OK. An additional advantage with gfortran(-4.x) will be the possibility to
use fortan95 code, n'est ce pas?


Some Fortran95 code, anyway.  (It is not yet a complete implementation.)

The problems we are seeing with gcc4 are mainly (but not 
entirely) with gfortran: it seems not quite ready for production use.

-4.0.1 is already a considerable improvement over -4.0.0.

There is another project (www.g95.org) that is using a slightly different 
version of these sources, and either g95 or gfortran can be used with 
gcc3 if you want to use F95 sources.  However, F95 is unlikely to be 
suitable for use in distributed R packages for a long time to come.


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

Re: [R] Putting all elementes of the list in an enviorment of a function

2005-08-02 Thread Ales Ziberna
I apologize, it seams did not interpret your first mail corectly!
Everything works now!

Thank you again!
Ales Ziberna
- Original Message - 
From: Prof Brian Ripley [EMAIL PROTECTED]
To: Ales Ziberna [EMAIL PROTECTED]
Cc: R-help r-help@stat.math.ethz.ch
Sent: Tuesday, August 02, 2005 11:25 AM
Subject: Re: [R] Putting all elementes of the list in an enviorment of a 
function


 On Tue, 2 Aug 2005, Ales Ziberna wrote:

 Thank you!

 However, this does not do exacty what I want. I would like somehow to 
 modify only the function second.

 What happened when you tried my suggestion as

 second - function(l, c) with(l, a + b + c)

 ?  It does work for me.

 BTW, I used list only to create a list, it is not one of my 
 functions.

 You used it as a variable within second()!


 Thanks again,
 Ales Ziberna

 - Original Message - From: Prof Brian Ripley 
 [EMAIL PROTECTED]
 To: Ales Ziberna [EMAIL PROTECTED]
 Cc: R-help r-help@stat.math.ethz.ch
 Sent: Tuesday, August 02, 2005 10:35 AM
 Subject: Re: [R] Putting all elementes of the list in an enviorment of a 
 function


 ?with will help you.

 I would avoid using 'list' as a function name, as it will confuse people
 and might confuse R too.

 On Tue, 2 Aug 2005, [iso-8859-2] Alea }iberna wrote:

 Hello!

 I have two functions.

 The first one prepares the arguments for the second one. What is the 
 best
 way to put all resoults of the first one into the second one? I tried
 attach, however the object in the main enviorment have a priority 
 over the
 ones in list. An example is at the end.

 Thanks in advance for any suggestions!
 Ales Ziberna

 For example - I would like to use just a instead of list$a in 
 fuction
 second

 first-function(a,b){
if(length(a)!=1) a - a[1]
if(length(b)!=1) b - b[1]
list(a=a,b=b)
 }

 second-function(list,c){
list$a + list$b + c
 }

 a-c(2,3)
 b-4:64
 c-5

 res-first(a,b)
 second(res,c)

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



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


Re: [R] converting stata's by syntax to R

2005-08-02 Thread Chris Wallace
Chris Wallace [EMAIL PROTECTED] writes:

 I am struggling with migrating some stata code to R

Thanks to all who replied.  It was very helpful to see a combination
of more direct stata-R translations and more R-ish code.  which.max()
solves my problem this time, but learning about split(), unsplit() and
duplicated() should make such problems fewer in the long run.

C.

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


[R] R: regression data set

2005-08-02 Thread Clark Allan
hi all

i am busy teaching a regression analysis course to second year science
students. the course is fairly theoretical with all of the standard
theorems and proofs...

i would like to give the class a practical assignment as well. could you
suggest a good problem and the location of the data set/s?

it would be good if the data set has been analysed by a number of other
people so that students can see the different ways of tackling a
regression problem. 

some of the issues to be covered:

estimation
is there really a model
variable selection ...
outliers and influential observations
interpreting the regression model


/
allan__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Re: [R] linux compile options (64-bit)

2005-08-02 Thread Göran Broström
On Tue, Aug 02, 2005 at 10:58:31AM +0100, Prof Brian Ripley wrote:

 The problems we are seeing with gcc4 are mainly (but not 
 entirely) with gfortran: it seems not quite ready for production use.
 -4.0.1 is already a considerable improvement over -4.0.0.
 
 There is another project (www.g95.org) that is using a slightly different 
 version of these sources, and either g95 or gfortran can be used with 
 gcc3 if you want to use F95 sources.  However, F95 is unlikely to be 
 suitable for use in distributed R packages for a long time to come.

Thanks; I'll stick to 3.4.4(!) and f77 for the time being.

Göran

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


[R] Read from data frame, and not from global environment

2005-08-02 Thread Jochen Einbeck
Dear members,

assume given  a function of type

test-function(formula,  data , w){
  ..
  glm1-glm(formula,  family=poisson, data=data, weights=w)
  ..
}

and a simple example data frame as

test.frame-data.frame(x=1:10,y=(1:10)*2,a=(1:10)^3).

Let us now execute

test(y ~ x, test.frame, a )

My question is: What do I have to insert at the first occurance of . 
in the test function to ensure that

1) 'a'  is read from the data frame (and is only read from the global 
environment if  and only if  'a' is not found in the data frame)
2) glm finds w in in the local environment of the function 'test'

The question is obviously related to  Fernando's problem with   
'Defining a local function'  some months ago, though the discussion 
there does not solve the questions above.

Cheers,

Jochen Einbeck
NUI Galway, Ireland

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


Re: [R] R: regression data set

2005-08-02 Thread Kevin Wang
Clark Allan wrote:

 i would like to give the class a practical assignment as well. could you
 suggest a good problem and the location of the data set/s?
 
 it would be good if the data set has been analysed by a number of other
 people so that students can see the different ways of tackling a
 regression problem. 

If you want some textbook examples I'd recommend
Ripley and Venables's  Modern Applied Statistics With S (VR bundle);

Maindonald and Braun's Data Analysis and Graphics using R (DAAG package)

Cheers,

Kev

-- 
Ko-Kang Kevin Wang
PhD Student
Centre for Bioinformation Science
Building 27, Room 1004
Mathematical Sciences Institute (MSI)
Australian National University
Canberra, ACT 2601
Australia

Homepage: http://wwwmaths.anu.edu.au/~wangk/
Ph (W): +61-2-6125-2431
Ph (H): +61-2-6125-7407
Ph (M): +61-40-451-8301

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


Re: [R] Read from data frame, and not from global environment

2005-08-02 Thread Prof Brian Ripley
I don't think that is the best way to do what I guess you intended. Try 
something like

test - function(formula,  data , weights)
{
 Call - match.call()
 Call[[1]] - as.name(glm)
 Call$family - quote(poisson)
 glm1 - eval.parent(Call)
 
}

which is probably giving the scoping that you want.

You could do what you ask for at 1) by something like

 wname - deparse(substitute(w))
 w - if(wname %in% names(data)) data[[wname]] else get(wname, .GlobalEnv)

and for 2) by replacing .GlobalEnv by an expression constructed by calls 
to environment() (I don't know exactly what you intended here).

On Tue, 2 Aug 2005, Jochen Einbeck wrote:

 Dear members,

 assume given  a function of type

 test-function(formula,  data , w){
  ..
  glm1-glm(formula,  family=poisson, data=data, weights=w)
  ..
 }

 and a simple example data frame as

 test.frame-data.frame(x=1:10,y=(1:10)*2,a=(1:10)^3).

 Let us now execute

 test(y ~ x, test.frame, a )

 My question is: What do I have to insert at the first occurance of .
 in the test function to ensure that

 1) 'a'  is read from the data frame (and is only read from the global
 environment if  and only if  'a' is not found in the data frame)
 2) glm finds w in in the local environment of the function 'test'

That contradicts 1)!

 The question is obviously related to  Fernando's problem with
 'Defining a local function'  some months ago, though the discussion
 there does not solve the questions above.

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


Re: [R] Rgdal windows binary warning message

2005-08-02 Thread Duncan Murdoch
Prof Brian Ripley wrote:
 This is a consequence of how VC++ compiled gdal.  R is protecting 
 itself against that.  Since R did not crash, there is nothing to worry 
 about.

To add to that:  the RGDAL maintainer could work around this bug in 
VC++.  I haven't used that compiler, but with others it is sufficient to 
ask R to set the FPU control word.  Instructions are here: 
http://www.stats.uwo.ca/faculty/murdoch/software/compilingDLLs/index.html#fpu

Duncan Murdoch
 
 On Tue, 2 Aug 2005, Tony Gill wrote:
 
 
Hi all,

I just downloaded windows binaries of RGDAL (from
http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/2.1/) and installed.

I ran the example R_HOME\library\rgdal\R-ex\getPixmapGDAL.R and everything
seemed to work as expected. However I got the following warning message:

DLL attempted to change FPU control word from 8001f to 9001f

The R-help (?dyn.load) describes the problem as:


External code must not change the floating point control word, but
many DLLs do so.  Common changes are to set it to use 53 bit
precision instead of R's default 64 bit precision, or to unmask
some exceptions.  'dyn.load' detects such changes,  and restores
R's control word to its default value of hex 8001F.   This may
cause the DLL to malfunction; if so, it should be rewritten to
save and restore the control word itself.  If 'warn.FPU' is set to
'TRUE' using the 'options' function,  a warning will be printed.
(If the warning says that the control word was changed from some
other value than 8001F,  please report the circumstances to the
Windows maintainers:   that probably indicates an internal bug.)



Does anyone know if this is a major problem for reading and manipulating
image files using RDAL? And if so are there windows binaries which have
patched it up?

Thanks in advance

Tony

**
Tony Gill - PhD Candidate
Centre for Remote Sensing  Spatial Information Science
School of Geography, Planning  Architecture
University of Queensland
Brisbane, Queensland, AUSTRALIA, 4072
Ph: 61-7-3365-7027
email: [EMAIL PROTECTED]

  [[alternative HTML version deleted]]

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

 


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


[R] question on graphs and finding area under a curve

2005-08-02 Thread Renuka Sane
Question on graphs:

The default case for drawing a graph in R, is where a little space is left 
on the x and y axis before the first tick i.e. even if I say xlim=c(0,1) -- 
there will be some space between the edge of the x-axis and where 0 is 
placed. If I want 0 on the edge, how do I do it in R?

Area under the curve:

I have a 45 degree line and a curve above or below it. Is there a way in R 
to find the area between the two?

Thanks,
Renuka

-- 
Renuka Sane
http://www.nyx.net/~rsane

[[alternative HTML version deleted]]

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


Re: [R] Conditional piece-wise dependent regression

2005-08-02 Thread Arie
Thank you Dimitris  Reid, you were very helpful.

Best wishes,
Arie.

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


Re: [R] can we manage memory usage to increase speed?

2005-08-02 Thread Tuszynski, Jaroslaw W.
 
If you have a code that takes 2 weeks to run, than it might be a case of
inefficient algorithm design. I was able to go from overnight runs (SELDI
data analysis) to 20 minute runs by identifying single inefficient function
that took most of the time, and writing it in C.

Jarek
\===

 Jarek Tuszynski, PhD.   o / \ 
 Science Applications International Corporation  \__,|  
 (703) 676-4192  \
 [EMAIL PROTECTED] `\


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Zhilin Liu
Sent: Monday, August 01, 2005 8:28 PM
To: r-help@stat.math.ethz.ch
Subject: [R] can we manage memory usage to increase speed?

Hi,
 
Thanks for reading.
 
I am running  a process in R for microarray data analysis. RedHat Enterprise
Linux 4, dual AMD CPU, 6G memory. However, the R process use only a total of
200M memory. And the CPU usage is total to ~110% for two. The program takes
at least 2 weeks to run at the current speed. Is there some way we can
increase the usage of CPUs and memories and speed up? Any suggestion is
appreciated.
 
Thanks again.
 
Zhilin 

[[alternative HTML version deleted]]

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

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


Re: [R] question on graphs and finding area under a curve

2005-08-02 Thread Marc Schwartz
On Tue, 2005-08-02 at 18:20 +0530, Renuka Sane wrote:
 Question on graphs:
 
 The default case for drawing a graph in R, is where a little space is left 
 on the x and y axis before the first tick i.e. even if I say xlim=c(0,1) -- 
 there will be some space between the edge of the x-axis and where 0 is 
 placed. If I want 0 on the edge, how do I do it in R?

See ?par and take note of the 'xaxs' and 'yaxs' parameters. By default,
these are set to 'r', where the axes are extended by 4% in each
direction. Thus, set one or both parameters to 'i' to set the axes to
exactly the ranges of xlim and/or ylim as you require.

 Area under the curve:
 
 I have a 45 degree line and a curve above or below it. Is there a way in R 
 to find the area between the two?

See Frank Harrell's somers2() function in the Hmisc package on CRAN.
Among other things, it outputs a value C, which is the AUC.

HTH,

Marc Schwartz

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


Re: [R] question on graphs and finding area under a curve

2005-08-02 Thread Romain Francois
Le 02.08.2005 14:50, Renuka Sane a écrit :

Question on graphs:

The default case for drawing a graph in R, is where a little space is left 
on the x and y axis before the first tick i.e. even if I say xlim=c(0,1) -- 
there will be some space between the edge of the x-axis and where 0 is 
placed. If I want 0 on the edge, how do I do it in R?

Area under the curve:

I have a 45 degree line and a curve above or below it. Is there a way in R 
to find the area between the two?

  

Hi,

integrate.xy in sfsmisc package might help you.

Romain

Thanks,
Renuka

- 
visit the R Graph Gallery : http://addictedtor.free.fr/graphiques
 ~ 
~~  Romain FRANCOIS - http://addictedtor.free.fr ~~
Etudiant  ISUP - CS3 - Industrie et Services   
~~http://www.isup.cicrp.jussieu.fr/  ~~
   Stagiaire INRIA Futurs - Equipe SELECT  
~~   http://www.inria.fr/recherche/equipes/select.fr.html~~
 ~ 

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


Re: [R] question on graphs and finding area under a curve

2005-08-02 Thread Tuszynski, Jaroslaw W.
How about:

trapz = function(x, y) 
{ # computes the integral of y with respect to x using trapezoidal
integration. 
  idx = 2:length(x)
  return (as.double( (x[idx] - x[idx-1]) %*% (y[idx] + y[idx-1])) / 2)
} 

Jarek
\===

 Jarek Tuszynski, PhD.   o / \ 
 Science Applications International Corporation  \__,|  
 (703) 676-4192  \
 [EMAIL PROTECTED] `\


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Renuka Sane
Sent: Tuesday, August 02, 2005 8:51 AM
To: r-help@stat.math.ethz.ch
Subject: [R] question on graphs and finding area under a curve

Question on graphs:

The default case for drawing a graph in R, is where a little space is left
on the x and y axis before the first tick i.e. even if I say xlim=c(0,1) --
there will be some space between the edge of the x-axis and where 0 is
placed. If I want 0 on the edge, how do I do it in R?

Area under the curve:

I have a 45 degree line and a curve above or below it. Is there a way in R
to find the area between the two?

Thanks,
Renuka

--
Renuka Sane
http://www.nyx.net/~rsane

[[alternative HTML version deleted]]

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

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


Re: [R] question on graphs and finding area under a curve

2005-08-02 Thread Ravi Varadhan
Hi,

To find the area lying between the curve y = y(x) and 45 degree line (which,
assuming it goes through the origin, is y = x), you can use the following
function based on trapezoidal rule:

trap.rule - function(x,f) {sum(diff(x)*(f[-1]+f[-length(f)]))/2}

trap.rule(x,f=y-x)

This area will be negative if y(x) is below the 45 degree line.

However, your question is not complete, I think.  You need to specify the
interval of integration. For this you may need to determine the points of
intersection of the two curves, which involves the solution of a fixed point
problem.

Hope this helps,
Ravi.

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:r-help-
 [EMAIL PROTECTED] On Behalf Of Renuka Sane
 Sent: Tuesday, August 02, 2005 8:51 AM
 To: r-help@stat.math.ethz.ch
 Subject: [R] question on graphs and finding area under a curve
 
 Question on graphs:
 
 The default case for drawing a graph in R, is where a little space is left
 on the x and y axis before the first tick i.e. even if I say xlim=c(0,1) -
 -
 there will be some space between the edge of the x-axis and where 0 is
 placed. If I want 0 on the edge, how do I do it in R?
 
 Area under the curve:
 
 I have a 45 degree line and a curve above or below it. Is there a way in R
 to find the area between the two?
 
 Thanks,
 Renuka
 
 --
 Renuka Sane
 http://www.nyx.net/~rsane
 
   [[alternative HTML version deleted]]
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-
 guide.html

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


[R] Contour plot crest line

2005-08-02 Thread Michael Kubovy
Any suggestions about drawing the ridge line on a response surface  
represented as a contour plot?

_
Professor Michael Kubovy
University of Virginia
Department of Psychology
USPS: P.O.Box 400400Charlottesville, VA 22904-4400
Parcels:Room 102Gilmer Hall
 McCormick RoadCharlottesville, VA 22903
Office:B011+1-434-982-4729
Lab:B019+1-434-982-4751
Fax:+1-434-982-4766
WWW:http://www.people.virginia.edu/~mk9y/

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


[R] how to print a data.frame without row.names

2005-08-02 Thread Heinz Tuechler
Dear All,
is there a simple way to print a data.frame without its row.names?

example:
datum - as.Date(c(2004-01-01, 2004-01-06, 2004-04-12))
content - c('Neujahr', 'Hl 3 K.', 'Ostern')
df1 - data.frame(datum, content)
print(df1)

   datum content
1 2004-01-01 Neujahr
2 2004-01-06 Hl 3 K.
3 2004-04-12  Ostern

Can I get this table without 1, 2, 3 ?

Thanks in advance

Heinz Tuechler

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


[R] (no subject)

2005-08-02 Thread [EMAIL PROTECTED]
hi all,

I wish to draw on the same graphic device 3 functions.

But i don't want them to be on different graph, i want to compare them on the 
same

I don't need mfrow or mfcol, I need something else... 

1 graph on 1 device inside this graph 3 ploted function.

I saw something unsing data.frame, but i think it's overkill, and something 
less complicated must exist, if not why?

why not plot(func1,func2,func3) ??

thks.


// Webmail Oreka : http://www.oreka.com


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


[R] plotting 3 functions on same graph

2005-08-02 Thread [EMAIL PROTECTED]
hi all,

I wish to draw on the same graphic device 3 functions.

But i don't want them to be on different graph, i want to compare them on the 
same

I don't need mfrow or mfcol, I need something else... 

1 graph on 1 device inside this graph 3 ploted function.

I saw something unsing data.frame, but i think it's overkill, and something 
less complicated must exist, if not why?

why not plot(func1,func2,func3) ??

thks.



// Webmail Oreka : http://www.oreka.com


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


Re: [R] how to print a data.frame without row.names

2005-08-02 Thread Romain Francois
Le 02.08.2005 15:45, Heinz Tuechler a écrit :

Dear All,
is there a simple way to print a data.frame without its row.names?

example:
datum - as.Date(c(2004-01-01, 2004-01-06, 2004-04-12))
content - c('Neujahr', 'Hl 3 K.', 'Ostern')
df1 - data.frame(datum, content)
print(df1)

   datum content
1 2004-01-01 Neujahr
2 2004-01-06 Hl 3 K.
3 2004-04-12  Ostern

Can I get this table without 1, 2, 3 ?
  

See write.table and its row.names argument

R write.table(df1, row.names=FALSE)

Romain

-- 
visit the R Graph Gallery : http://addictedtor.free.fr/graphiques
 ~ 
~~  Romain FRANCOIS - http://addictedtor.free.fr ~~
Etudiant  ISUP - CS3 - Industrie et Services   
~~http://www.isup.cicrp.jussieu.fr/  ~~
   Stagiaire INRIA Futurs - Equipe SELECT  
~~   http://www.inria.fr/recherche/equipes/select.fr.html~~
 ~ 

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


Re: [R] plotting 3 functions on same graph

2005-08-02 Thread Christoph Buser
Hi 

Maybe matplot (see ?matplot) can help you.

Regards,

Christoph Buser

--
Christoph Buser [EMAIL PROTECTED]
Seminar fuer Statistik, LEO C13
ETH (Federal Inst. Technology)  8092 Zurich  SWITZERLAND
phone: x-41-44-632-4673 fax: 632-1228
http://stat.ethz.ch/~buser/
--


[EMAIL PROTECTED] writes:
  hi all,
  
  I wish to draw on the same graphic device 3 functions.
  
  But i don't want them to be on different graph, i want to compare them on 
  the same
  
  I don't need mfrow or mfcol, I need something else... 
  
  1 graph on 1 device inside this graph 3 ploted function.
  
  I saw something unsing data.frame, but i think it's overkill, and something 
  less complicated must exist, if not why?
  
  why not plot(func1,func2,func3) ??
  
  thks.
  
  
  
  // Webmail Oreka : http://www.oreka.com
  
  
  __
  R-help@stat.math.ethz.ch mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

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


[R] [R-pkgs] [ANNOUNCE] mod_R: The R/Apache Integration Project

2005-08-02 Thread Jeffrey Horner

   What is it?
   ---
   mod_R is a project dedicated to embedding the R interpreter inside
   the Apache 2.0 (and beyond) web server for the purpose of writing web
   applications in R. It's composed of three parts:

   mod_R: the Apache 2.0 module that implements the glue to load the
   R interpreter.

   RApache: the R package that provides the API for programming web
   applications in R.

   libapreq 2.0.4: an Apache sponsored project for parsing request input.
   If you don't want to compile and install this version, then you can
   specify which libapreq2 library to use during configuration.

   The Latest Version
   --

   Details of the latest version can be found at the mod_R
   project page:

http://biostat.mc.vanderbilt.edu/twiki/bin/view/Main/ApacheRproject

   (mind the wrap)


   Prerequisites
   -
   This release has been tested under Debian Linux with Apache 2.0.54,
   R 2.1.1, and libapreq 2.0.4.  Apache2 _MUST_ be compiled with the
   prefork MPM to compile mod_R. Also, R must have been compiled with
   the --enable-R-shlib configure flag.

   Installation
   
   The following is the preferred way to compile and install mod_R:

 $ ./configure --with-apache2-apxs=/path/to/apxs --with-R=/path/to/R
 $ make
 $ make install

   Both --with-apache2-apxs and --with-R _MUST_ be specified.  Otherwise,
   trying to figure out the dependencies between the sources and headers
   and library paths becomes quite complex.

   If you don't want to compile and install the bundled libapreq2 version,
   then add --with-apreq2-config=/path/to/apreq2-config. The version _MUST_
   be equal to or greater than 2.0.4.

   Configuration
   -
   In order to use mod_R and RApache, you must configure apache to find
   it. Type help(directives,package=RApache) once mod_R is installed
   for a little more detail. Add something similar to this to the apache
   config file:

 LoadModule R_Module /path/to/mod_R.so

 Location /URL
SetHandler r-handler
Rsource /path/to/R/code.R
RreqHandler function-name
Rlibrary library-name
 /Location

   Also, libR.so _MUST_ be found in the shared library path as it is
   linked to by mod_R, RApache and the rest of the packages containing
   shared libraries. You can either set LD_LIBRARY_PATH like this:

  $ export LD_LIBRARY_PATH=`/path/to/R RHOME`/lib

   or add that path to /etc/ld.so.conf and then run ldconfig.

   NOTE: the latest apache2 debian packages cause the web server to run
   in a very reduced environment, thus one is unable to set LD_LIBRARY_PATH
   before calling /etc/init.d/apache2. One option is to actually edit that
   file and add the LD_LIBRARY_PATH explicitly. Another is to use the 
apache2ctl
   scripts which are also bundled with the debian packages. Or you can 
add it
   to /etc/ld.so.conf.

   Documentation
   -
   All of the documentation is currently in the RApache package. Once
   you install mod_R, start R and load the RApache package. You'll get
   a warning that you're currently not running the R interpreter within
   Apache; just don't try to run any of the code. Sample session:
 library(RApache)
Warning message:

RApache is only useful within the Apache web server.
It is loaded now for informational purposes only

 in: firstlib(which.lib.loc, package)
 help(package=RApache)

Information on package 'RApache'

Description:

Package:   RApache
Version:   0.1-0
Date:  2005-08-02
Title: An R interface to the Apache 2.0 web server
Author:Jeffrey Horner
Maintainer:Jeffrey Horner [EMAIL PROTECTED]
License:   Apache License, Version 2.0
Description:   RApache allows web applications to be written in R and
executed within the Apache 2.0 web server.
Built: R 2.1.0; i386-pc-linux-gnu; 2005-08-02 01:06:26; unix

Index:

IO  IO in RApache
apache.add_cookie   Adding Cookies to Outgoing Headers
apache.add_header   Adding HTTP headers
apache.allow_methodsRApache Methods
apache.log_errorLogging Errors to the Apache error log
apache.set_content_type
Setting the Content Type header
apr_table   Structure of the apr_table type in RApache
as.html Converting RApache objects to HTML
directives  RApache directives used in Apace config file
intro   Introduction to RApache
request_rec Structure of the RApache request record
return_codesRApache handler return codes


   Licensing
   -

   Please see the file called LICENSE.

-- 
Jeffrey Horner   Computer Systems Analyst School of Medicine
615-322-8606 Department of Biostatistics   Vanderbilt University

___
R-packages 

Re: [R] plotting 3 functions on same graph

2005-08-02 Thread Romain Francois
Le 02.08.2005 15:56, [EMAIL PROTECTED] a écrit :

hi all,

I wish to draw on the same graphic device 3 functions.

But i don't want them to be on different graph, i want to compare them on the 
same

I don't need mfrow or mfcol, I need something else... 

1 graph on 1 device inside this graph 3 ploted function.

I saw something unsing data.frame, but i think it's overkill, and something 
less complicated must exist, if not why?

why not plot(func1,func2,func3) ??

thks.
  

Take a look at :
?points
?lines
?curve
par(new=TRUE)

-- 
visit the R Graph Gallery : http://addictedtor.free.fr/graphiques
 ~ 
~~  Romain FRANCOIS - http://addictedtor.free.fr ~~
Etudiant  ISUP - CS3 - Industrie et Services   
~~http://www.isup.cicrp.jussieu.fr/  ~~
   Stagiaire INRIA Futurs - Equipe SELECT  
~~   http://www.inria.fr/recherche/equipes/select.fr.html~~
 ~ 

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


Re: [R] plotting 3 functions on same graph

2005-08-02 Thread Peter Dalgaard
Romain Francois [EMAIL PROTECTED] writes:

 Le 02.08.2005 15:56, [EMAIL PROTECTED] a écrit :
 
 hi all,
 
 I wish to draw on the same graphic device 3 functions.
 
 But i don't want them to be on different graph, i want to compare them on 
 the same
 
 I don't need mfrow or mfcol, I need something else... 
 
 1 graph on 1 device inside this graph 3 ploted function.
 
 I saw something unsing data.frame, but i think it's overkill, and something 
 less complicated must exist, if not why?
 
 why not plot(func1,func2,func3) ??
 
 thks.
   
 
 Take a look at :
 ?points
 ?lines
 ?curve
 par(new=TRUE)

...and curve(, add=TRUE). The minor gotcha is that you need to
adjust the ylim setting to make sure that all curves fit.

-- 
   O__   Peter Dalgaard Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
~~ - ([EMAIL PROTECTED])  FAX: (+45) 35327907

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


[R] a question about data manipulation

2005-08-02 Thread qi zhang
Dear R-user,
 I have a simple question, I just can't figure out a easy way to handle it.
 My importing data x is like this:
  COL1 COL2 id
1 12 49 1
2 70 120 1
3 58 124 1
51 14 13 2
52 88 100 2
53 90 134 2
 I want to change the format of the data, i want to group data into 
differenct part according id,so that when i use x[1], which will refer me to 
the information about first id.I use the command:
 
list(list(N=2,n=c(100,150),matrix(c(x[x$id==1,][,1],x[x$id==1,][,2]),nr=2,nc=3)),list(N=2,n=c(100,150),matrix(c(x[x$id==2,][,1],x[x$id==2,][,2]),nr=2,nc=3)))

so the data becomes :

[[1]]
[[1]]$N
[1] 2

[[1]]$n
[1] 100 150

[[1]][[3]]
[,1] [,2] [,3]
[1,] 12 58 120
[2,] 70 49 124


[[2]]
[[2]]$N
[1] 2

[[2]]$n
[1] 100 150

[[2]][[3]]
[,1] [,2] [,3]
[1,] 14 90 100
[2,] 88 13 134

This is the format I want, but problem is that for my data, id is not only 1 
to 2,but 1 to 100, so my code is not efficient. Could you help me find a 
efficient way? Thanks.

 Qi Zhang

PhD student,

University of Cincinnati

[[alternative HTML version deleted]]

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


Re: [R] how to print a data.frame without row.names

2005-08-02 Thread Heinz Tuechler
At 16:05 02.08.2005 +0200, Romain Francois wrote:
Le 02.08.2005 15:45, Heinz Tuechler a écrit :

Dear All,
is there a simple way to print a data.frame without its row.names?

example:
datum - as.Date(c(2004-01-01, 2004-01-06, 2004-04-12))
content - c('Neujahr', 'Hl 3 K.', 'Ostern')
df1 - data.frame(datum, content)
print(df1)

   datum content
1 2004-01-01 Neujahr
2 2004-01-06 Hl 3 K.
3 2004-04-12  Ostern

Can I get this table without 1, 2, 3 ?
  

See write.table and its row.names argument

R write.table(df1, row.names=FALSE)

Romain


write.table(df1, row.names=FALSE, quote=FALSE)
datum content
2004-01-01 Neujahr
2004-01-06 Hl 3 K.
2004-04-12 Ostern

I tried this, but then the column headers and column contents are not aligned.

If you expand the example, you see clearly the difference.

datum - as.Date(c(2004-01-01, 2004-01-06, 2004-04-12))
content - c('Neujahr', 'Hl 3 K.', 'Ostern')
number - c(1, 6, 110)
string - c('a', '', 'c')
df1 - data.frame(datum, content, number, string)
print(df1)
   datum content number string
1 2004-01-01 Neujahr  1  a
2 2004-01-06 Hl 3 K.  6   
3 2004-04-12  Ostern110  c

write.table(df1, row.names=FALSE, quote=FALSE)
datum content number string
2004-01-01 Neujahr 1 a
2004-01-06 Hl 3 K. 6 
2004-04-12 Ostern 110 c

Maybe I missed a function like print.xtable with type=ascii. It seems
that it has to be done with cat.

Thank you

Heinz

-- 
visit the R Graph Gallery : http://addictedtor.free.fr/graphiques
 ~ 
~~  Romain FRANCOIS - http://addictedtor.free.fr ~~
Etudiant  ISUP - CS3 - Industrie et Services   
~~http://www.isup.cicrp.jussieu.fr/  ~~
   Stagiaire INRIA Futurs - Equipe SELECT  
~~   http://www.inria.fr/recherche/equipes/select.fr.html~~
 ~ 



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


Re: [R] can we manage memory usage to increase speed?

2005-08-02 Thread Spencer Graves
  And you can identify inefficient code fairly easily taking snapshots 
from proc.time and computing elapsed time for sections of your code.

  spencer graves

Tuszynski, Jaroslaw W. wrote:

  
 If you have a code that takes 2 weeks to run, than it might be a case of
 inefficient algorithm design. I was able to go from overnight runs (SELDI
 data analysis) to 20 minute runs by identifying single inefficient function
 that took most of the time, and writing it in C.
 
 Jarek
 \===
 
  Jarek Tuszynski, PhD.   o / \ 
  Science Applications International Corporation  \__,|  
  (703) 676-4192  \
  [EMAIL PROTECTED] `\
 
 
 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On Behalf Of Zhilin Liu
 Sent: Monday, August 01, 2005 8:28 PM
 To: r-help@stat.math.ethz.ch
 Subject: [R] can we manage memory usage to increase speed?
 
 Hi,
  
 Thanks for reading.
  
 I am running  a process in R for microarray data analysis. RedHat Enterprise
 Linux 4, dual AMD CPU, 6G memory. However, the R process use only a total of
 200M memory. And the CPU usage is total to ~110% for two. The program takes
 at least 2 weeks to run at the current speed. Is there some way we can
 increase the usage of CPUs and memories and speed up? Any suggestion is
 appreciated.
  
 Thanks again.
  
 Zhilin 
 
   [[alternative HTML version deleted]]
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide!
 http://www.R-project.org/posting-guide.html
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

-- 
Spencer Graves, PhD
Senior Development Engineer
PDF Solutions, Inc.
333 West San Carlos Street Suite 700
San Jose, CA 95110, USA

[EMAIL PROTECTED]
www.pdf.com http://www.pdf.com
Tel:  408-938-4420
Fax: 408-280-7915

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


Re: [R] a question about data manipulation

2005-08-02 Thread jim holtman
use 'split'

 x.1 - data.frame(COL1=1:50, COL2=50:1, id=sample(1:4,50,T))
 x.2 - split(x.1, x.1$id)
 str(x.2)
List of 4
 $ 1:`data.frame':  10 obs. of  3 variables:
  ..$ COL1: int [1:10] 5 10 11 12 22 24 27 34 38 47
  ..$ COL2: int [1:10] 46 41 40 39 29 27 24 17 13 4
  ..$ id  : int [1:10] 1 1 1 1 1 1 1 1 1 1
 $ 2:`data.frame':  13 obs. of  3 variables:
  ..$ COL1: int [1:13] 1 2 14 16 19 25 26 28 30 31 ...
  ..$ COL2: int [1:13] 50 49 37 35 32 26 25 23 21 20 ...
  ..$ id  : int [1:13] 2 2 2 2 2 2 2 2 2 2 ...
 $ 3:`data.frame':  14 obs. of  3 variables:
  ..$ COL1: int [1:14] 3 8 9 13 17 23 32 36 39 42 ...
  ..$ COL2: int [1:14] 48 43 42 38 34 28 19 15 12 9 ...
  ..$ id  : int [1:14] 3 3 3 3 3 3 3 3 3 3 ...
 $ 4:`data.frame':  13 obs. of  3 variables:
  ..$ COL1: int [1:13] 4 6 7 15 18 20 21 29 35 37 ...
  ..$ COL2: int [1:13] 47 45 44 36 33 31 30 22 16 14 ...
  ..$ id  : int [1:13] 4 4 4 4 4 4 4 4 4 4 ...
 names(x.2)
[1] 1 2 3 4
 x.2[['1']]
   COL1 COL2 id
5 5   46  1
10   10   41  1
11   11   40  1
12   12   39  1
22   22   29  1
24   24   27  1
27   27   24  1
34   34   17  1
38   38   13  1
47   474  1
 x.2[['3']]
   COL1 COL2 id
3 3   48  3
8 8   43  3
9 9   42  3
13   13   38  3
17   17   34  3
23   23   28  3
32   32   19  3
36   36   15  3
39   39   12  3
42   429  3
44   447  3
45   456  3
49   492  3
50   501  3
 


On 8/2/05, qi zhang [EMAIL PROTECTED] wrote:
 Dear R-user,
  I have a simple question, I just can't figure out a easy way to handle it.
  My importing data x is like this:
  COL1 COL2 id
 1 12 49 1
 2 70 120 1
 3 58 124 1
 51 14 13 2
 52 88 100 2
 53 90 134 2
  I want to change the format of the data, i want to group data into
 differenct part according id,so that when i use x[1], which will refer me to
 the information about first id.I use the command:
 
 list(list(N=2,n=c(100,150),matrix(c(x[x$id==1,][,1],x[x$id==1,][,2]),nr=2,nc=3)),list(N=2,n=c(100,150),matrix(c(x[x$id==2,][,1],x[x$id==2,][,2]),nr=2,nc=3)))
 
 so the data becomes :
 
 [[1]]
 [[1]]$N
 [1] 2
 
 [[1]]$n
 [1] 100 150
 
 [[1]][[3]]
 [,1] [,2] [,3]
 [1,] 12 58 120
 [2,] 70 49 124
 
 
 [[2]]
 [[2]]$N
 [1] 2
 
 [[2]]$n
 [1] 100 150
 
 [[2]][[3]]
 [,1] [,2] [,3]
 [1,] 14 90 100
 [2,] 88 13 134
 
 This is the format I want, but problem is that for my data, id is not only 1
 to 2,but 1 to 100, so my code is not efficient. Could you help me find a
 efficient way? Thanks.
 
  Qi Zhang
 
 PhD student,
 
 University of Cincinnati
 
[[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
 


-- 
Jim Holtman
Convergys
+1 513 723 2929

What the problem you are trying to solve?

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


Re: [R] How to hiding code for a package

2005-08-02 Thread Spencer Graves
  The problem with this is that if someone thinks it's useful, they 
will likely slog through the obfuscation, then offer something much 
simpler to do the same thing -- and then be shocked and confused if the 
originator doesn't thank them for their efort!  I've heard that S-Plus 
allows you to encrypt your code.  Talk with Insightful if you want to 
protect your intellectual property.

  spencer graves

bogdan romocea wrote:

 There's something else you could try - since you can't hide the code,
 obfuscate it. Hide the real thing in a large pile of useless,
 complicated, awfully formatted code that would stop anyone except the
 most desperate (including yourself, after a couple of weeks/months)
 from trying to understand it. The best solution would be to compile
 the code, but R is not there yet.
 
 
 
-Original Message-
From: Prof Brian Ripley [mailto:[EMAIL PROTECTED] 
Sent: Saturday, July 30, 2005 5:35 AM
To: Gary Wong
Cc: r-help@stat.math.ethz.ch
Subject: Re: [R] How to hiding code for a package


What you ask is impossible.  For a function to be callable it 
has to be 
locatable and hence can be printed.

One possibility is to have a namespace, and something like

foo - function(...) foo_internal(...)

where foo is exported but foo_internal is not.  Then foo_internal is 
hidden from casual inspection, but it can be listed by cognescenti.

Why do you want to do this?  Anyhone can read the source code of your 
package, and any function which can be called can be 
deparsed, possibly 
after jumping through a few hoops.

On Sat, 30 Jul 2005, Gary Wong wrote:


Hey everyone,

I have made a package and wish to release it but
before then I have a problem. I have a few functions
in this package written in R that I wish to hide such
that after installation, someone can use say the
function foo(parameters = ) but cannot do foo.
Typing foo should not show the source code or at least
not all of it. Is there a way to do this ? I have
searched the mailing list and used google, and have
found something like [R] Hiding internal package
functions for the doc. pkg-internal.Rd but this seems
different since it seems that the keyword internal
just hides the function from showing in the index and
hides documentation, not the function itself. Can
someone help? Thanks

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

 
 
 __
 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

-- 
Spencer Graves, PhD
Senior Development Engineer
PDF Solutions, Inc.
333 West San Carlos Street Suite 700
San Jose, CA 95110, USA

[EMAIL PROTECTED]
www.pdf.com http://www.pdf.com
Tel:  408-938-4420
Fax: 408-280-7915

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


[R] multiple scale

2005-08-02 Thread [EMAIL PROTECTED]
Hi all

i need to put on one graph 2 functions who's x axis is the same and y not.

I mean on horizontal the time, and on vertical left: pressure, on vertical 
right: rpm of a motor, is R able to do that?

i've found this that i could adapt maybe (i don't need time series really?) :/ :

(http://tolstoy.newcastle.edu.au/R/help/04/03/1456.html)
## 
## Description: A simple function which plots two time series on one plot where 
## the series can have different value intervals over the same time interval. 
## Usage: ts.plot.2Axis(xleft, xright) 
## Arguments: xleft is the time series for the left vertical axis and xright 
## is for the right axis. xleft and xright are defined as time series with 
## the 'ts' function in package ts. 
## ts.plot function must be available, do library(ts) to ensure this if 
## necessary. 
## In addition the usual 'ts.plot' and 'plot' parameters can be set 
## directly (mar, main, xlab, ylab, lwd) or through gpars as in ts.plot. 
## Also parameter digits is the preferred number of decimal digits on right 
## axis and ticks is the preferred number of tick marks on right axis. 
## Details: The time series for the right vertical axis is scaled with a simple 
## rule of thumb scaling. 
## The ts.plot function is used to plot the series. 
## Value: None. 
## Note: When scaling is not acceptable try switching the series parameters. 
## If a ylabel is to be set it is here only possible for the left axis. 
## See also: 'ts.plot', 'ts', 'legend'. 
## Author and date: Hauksson, Bjorn Arnar. March 2004. 
## Example: 
## First paste this function into the R console or use 'source'. 
#library(ts) 
#data(UKLungDeaths) 
#x - ldeaths 
#y - fdeaths/mdeaths 
#ts.plot.2Axis(x, y) 
#legTxt - c(UK lung deaths, UK female/male deaths (rhs)) 
#legend(1976.5, 3950, legTxt, lty=c(1:2), col=c(1:2), lwd=2, bty=n) 
## 


ts.plot.2Axis - function(xleft, xright, digits=1, ticks=5, 
  mar=(c(4,4,4,4)+0.1), main=, 
  xlab=, ylab=, lwd=2, gpars=list()) { 
# Settings for other parameters than those in the function parameter 
list 
par(mar=mar) # Margins 
  k - ncol(as.matrix(xleft)) # Number of time series on left vertical 
scale 
lty - c(1:(k+1)) # Line types 
col - c(1:(k+1)) # Line colors 


# Scale time series on right vertical axis 
scale - (max(xleft)-min(xleft))/(max(xright)-min(xright)) 
  xright2 - xright*scale 
  meanScale - mean(xleft) - mean(xright2) 
xright2 - xright2 + meanScale 


# Plot the series 
ts.plot(xleft, xright2, lty=lty, col=col, main=main, ylab=ylab, 
xlab=xlab, 
lwd=lwd, gpars=gpars) 


# Add the right vertical axis labels 
lab - seq(round(min(xright), digits), round(max(xright), digits), 
length=ticks) 
labAt - seq(min(xright2), max(xright2), length=ticks) 
axis(side=4, labels=lab, at=labAt) 
} 

are there a better way to plot what i want?

thks.
guillaume.


// Webmail Oreka : http://www.oreka.com


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


Re: [R] how to print a data.frame without row.names

2005-08-02 Thread Martin Maechler

 Heinz == Heinz Tuechler [EMAIL PROTECTED]
 on Tue, 02 Aug 2005 17:46:07 +0200 writes:

  ...

Heinz I tried this, but then the column headers and column
Heinz contents are not aligned.

  

Use the tabulator if you need them aligned :

write.table(USArrests, row.names = FALSE, sep = \t)

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


Re: [R] can we manage memory usage to increase speed?

2005-08-02 Thread Douglas Bates
On 8/2/05, Spencer Graves [EMAIL PROTECTED] wrote:
   And you can identify inefficient code fairly easily taking snapshots
 from proc.time and computing elapsed time for sections of your code.
 
   spencer graves

Using Rprof may be a better choice.  See

?Rprof

 
 Tuszynski, Jaroslaw W. wrote:
 
 
  If you have a code that takes 2 weeks to run, than it might be a case of
  inefficient algorithm design. I was able to go from overnight runs (SELDI
  data analysis) to 20 minute runs by identifying single inefficient function
  that took most of the time, and writing it in C.
 
  Jarek
  \===
 
   Jarek Tuszynski, PhD.   o / \
   Science Applications International Corporation  \__,|
   (703) 676-4192  \
   [EMAIL PROTECTED] `\
 
 
  -Original Message-
  From: [EMAIL PROTECTED]
  [mailto:[EMAIL PROTECTED] On Behalf Of Zhilin Liu
  Sent: Monday, August 01, 2005 8:28 PM
  To: r-help@stat.math.ethz.ch
  Subject: [R] can we manage memory usage to increase speed?
 
  Hi,
 
  Thanks for reading.
 
  I am running  a process in R for microarray data analysis. RedHat Enterprise
  Linux 4, dual AMD CPU, 6G memory. However, the R process use only a total of
  200M memory. And the CPU usage is total to ~110% for two. The program takes
  at least 2 weeks to run at the current speed. Is there some way we can
  increase the usage of CPUs and memories and speed up? Any suggestion is
  appreciated.
 
  Thanks again.
 
  Zhilin
 
[[alternative HTML version deleted]]
 
  __
  R-help@stat.math.ethz.ch mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide!
  http://www.R-project.org/posting-guide.html
 
  __
  R-help@stat.math.ethz.ch mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide! 
  http://www.R-project.org/posting-guide.html
 
 --
 Spencer Graves, PhD
 Senior Development Engineer
 PDF Solutions, Inc.
 333 West San Carlos Street Suite 700
 San Jose, CA 95110, USA
 
 [EMAIL PROTECTED]
 www.pdf.com http://www.pdf.com
 Tel:  408-938-4420
 Fax: 408-280-7915
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


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


Re: [R] multiple scale

2005-08-02 Thread Jeanie (Jie) Na
Hi, 
Search the list, you might be able to find the message but here it is.

Copied From Dr. Brian Ripley's post
 x - 1:10
 y - rnorm(10)
 z - runif(10, 1000, 1)
 par(mar=c(5,4,4,4) + 0.1)  # Leave space for z axis
 plot(x, y)
 par(new=T)
 plot(x, z, type=l, axes=F, bty=n, xlab=, ylab=)
 axis(4, at=pretty(range(z)))
 mtext(z, 4, 3)
change last line to mtext(z, 4, 3).

J.
On Tue, 2005-08-02 at 17:18 +0100, [EMAIL PROTECTED] wrote:
 Hi all
 
 i need to put on one graph 2 functions who's x axis is the same and y not.
 
 I mean on horizontal the time, and on vertical left: pressure, on vertical 
 right: rpm of a motor, is R able to do that?
 
 i've found this that i could adapt maybe (i don't need time series really?) 
 :/ :
 
 (http://tolstoy.newcastle.edu.au/R/help/04/03/1456.html)
 ## 
 ## Description: A simple function which plots two time series on one plot 
 where 
 ## the series can have different value intervals over the same time interval. 
 ## Usage: ts.plot.2Axis(xleft, xright) 
 ## Arguments: xleft is the time series for the left vertical axis and xright 
 ## is for the right axis. xleft and xright are defined as time series with 
 ## the 'ts' function in package ts. 
 ## ts.plot function must be available, do library(ts) to ensure this if 
 ## necessary. 
 ## In addition the usual 'ts.plot' and 'plot' parameters can be set 
 ## directly (mar, main, xlab, ylab, lwd) or through gpars as in ts.plot. 
 ## Also parameter digits is the preferred number of decimal digits on right 
 ## axis and ticks is the preferred number of tick marks on right axis. 
 ## Details: The time series for the right vertical axis is scaled with a 
 simple 
 ## rule of thumb scaling. 
 ## The ts.plot function is used to plot the series. 
 ## Value: None. 
 ## Note: When scaling is not acceptable try switching the series parameters. 
 ## If a ylabel is to be set it is here only possible for the left axis. 
 ## See also: 'ts.plot', 'ts', 'legend'. 
 ## Author and date: Hauksson, Bjorn Arnar. March 2004. 
 ## Example: 
 ## First paste this function into the R console or use 'source'. 
 #library(ts) 
 #data(UKLungDeaths) 
 #x - ldeaths 
 #y - fdeaths/mdeaths 
 #ts.plot.2Axis(x, y) 
 #legTxt - c(UK lung deaths, UK female/male deaths (rhs)) 
 #legend(1976.5, 3950, legTxt, lty=c(1:2), col=c(1:2), lwd=2, bty=n) 
 ## 
 
 
 ts.plot.2Axis - function(xleft, xright, digits=1, ticks=5, 
   mar=(c(4,4,4,4)+0.1), main=, 
   xlab=, ylab=, lwd=2, gpars=list()) { 
 # Settings for other parameters than those in the function parameter 
 list 
 par(mar=mar) # Margins 
   k - ncol(as.matrix(xleft)) # Number of time series on left vertical 
 scale 
 lty - c(1:(k+1)) # Line types 
 col - c(1:(k+1)) # Line colors 
 
 
 # Scale time series on right vertical axis 
 scale - (max(xleft)-min(xleft))/(max(xright)-min(xright)) 
   xright2 - xright*scale 
   meanScale - mean(xleft) - mean(xright2) 
 xright2 - xright2 + meanScale 
 
 
 # Plot the series 
 ts.plot(xleft, xright2, lty=lty, col=col, main=main, ylab=ylab, 
 xlab=xlab, 
 lwd=lwd, gpars=gpars) 
 
 
 # Add the right vertical axis labels 
 lab - seq(round(min(xright), digits), round(max(xright), digits), 
 length=ticks) 
 labAt - seq(min(xright2), max(xright2), length=ticks) 
 axis(side=4, labels=lab, at=labAt) 
 } 
 
 are there a better way to plot what i want?
 
 thks.
 guillaume.
 
 
 // Webmail Oreka : http://www.oreka.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
 
-- 
Jeanie (Jie) Na

Programmer Analyst II   _   _____   _
Department of Quantitative Health Sciences [_]-[_]  / - \  | |_| |  (_(_
Cleveland Clinic Foundation |   |  ( |_| ) )  _  (   _| )
Tel: (216)4451369  [_]-[_]  \_\_\  |_| |_|  (___/

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


Re: [R] how to print a data.frame without row.names

2005-08-02 Thread Peter Dalgaard
Martin Maechler [EMAIL PROTECTED] writes:

  Heinz == Heinz Tuechler [EMAIL PROTECTED]
  on Tue, 02 Aug 2005 17:46:07 +0200 writes:
 
   ...
 
 Heinz I tried this, but then the column headers and column
 Heinz contents are not aligned.
 
   
 
 Use the tabulator if you need them aligned :
 
 write.table(USArrests, row.names = FALSE, sep = \t)

Unless a column or a header is 8 chars or wider (and UrbanPop is!).

This seems to do it:

  x - as.matrix(format(USArrests))
  rownames(x) - rep(, nrow(x))
  print(x, quote=FALSE, right=TRUE)

-- 
   O__   Peter Dalgaard Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
~~ - ([EMAIL PROTECTED])  FAX: (+45) 35327907

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


[R] problem using evaluating a formula

2005-08-02 Thread Gavin Simpson
##data
y1 - matrix(c(3,1,0,1,0,1,1,0,0,0,1,0,0,0,1,1,0,1,1,1),
 nrow = 5, byrow = TRUE)
y2 - matrix(c
(3,0,10,3,3,0,0,1,1,0,0,0,0,0,1,0,1,0,0,2,1,0,1,1,0,2,1,1,4,1),
 nrow = 5, byrow = TRUE)
y1 - as.data.frame(y1)
y2 - as.data.frame(y2)
rownames(y1) - rownames(y2) - paste(site, 1:5, sep = )
colnames(y1) - paste(spp, 1:4, sep = )
colnames(y2) - paste(spp, 1:6, sep = )

##code
coca.formula - function(formula, data, ...)
  {
##cat(\nusing formula method\n)
##browser()
if (missing(data)) {
data - parent.frame()
}
m - match.call(expand.dots = FALSE)
m$... - NULL
m[[1]] - as.name(model.frame)
## the next line fails
m - eval(m, sys.parent())
Terms - attr(m, terms)
Response - model.extract(m, response)
attr(Terms, intercept) - 0
Predictor - model.matrix(Terms, m)
retval - list(m = m, Terms = Terms, Response = Response,
   Predictor = Predictor)
return(retval)
  }

coca(y1 ~ y2, method = symmetric, symmetric= TRUE)

gives:

Error in model.frame(formula, rownames, variables, varnames, extras,
extranames,  : 
invalid variable type

when executing the indicated line

now both y1 and y2 are data.frames - this is the natural way of
specifying the model I have in mind - and I think this is the problem as
it seems to be the rhs of the formula that is causing the error.

Is there an alternative way of handling and evaling formulae if the rhs
is a data.frame (if my assumption is correct of course)? I would like,
eventually, to have the option of specifying the predictors as either a
data.frame or via named variables found in the variable passed to data.

A simple alternative would be to do the following:

predictor - get(as.character(formula[[3]]))
response - get(as.character(formula[[2]]))

Would I be missing something vital that I'm not appreciating if I used
this simple method?

Any other suggestions gratefully received.

Many thanks in advance,

Gav
-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Gavin Simpson [T] +44 (0)20 7679 5522
ENSIS Research Fellow [F] +44 (0)20 7679 7565
ENSIS Ltd.  ECRC [E] gavin.simpsonATNOSPAMucl.ac.uk
UCL Department of Geography   [W] http://www.ucl.ac.uk/~ucfagls/cv/
26 Bedford Way[W] http://www.ucl.ac.uk/~ucfagls/
London.  WC1H 0AP.
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

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


[R] simplifying a lmer model

2005-08-02 Thread sp219
I have been using lmer in lme4() to analyse the effect of dropping a term from 
the model as below 
anova.name-anova(m1,m2)
Where m1 is an original model and m2 has one term removed. I can then create 
my own type III tables for each variable in the model. However with many 
variables this becomes exceedingly time consuming! 
anova.lme in nlme() and Anova() in car dont seem to work for lme objects 
created with lmer? Is there any other way to create type III tables?
Any help much appreciated.
Simon P

Simon Pickett
Centre for Ecology and Conservation Biology
University of Exeter in Cornwall
Tremough Campus
Penryn 
Cornwall
TR10 9EZ UK
Tel: 01326371852

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


Re: [R] simplifying a lmer model

2005-08-02 Thread Peter Dalgaard
sp219 [EMAIL PROTECTED] writes:

 I have been using lmer in lme4() to analyse the effect of dropping a term 
 from 
 the model as below 
 anova.name-anova(m1,m2)
 Where m1 is an original model and m2 has one term removed. I can then create 
 my own type III tables for each variable in the model. However with many 
 variables this becomes exceedingly time consuming! 
 anova.lme in nlme() and Anova() in car dont seem to work for lme objects 
 created with lmer? Is there any other way to create type III tables?
 Any help much appreciated.
 Simon P

I haven't played nearly as much with lme4 as I perhaps should have,
but my first try would be to see whether drop1 works on lmer models.

-- 
   O__   Peter Dalgaard Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
~~ - ([EMAIL PROTECTED])  FAX: (+45) 35327907

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


[R] Help with sas.get

2005-08-02 Thread Jorge Sirgo
I am running R 2.0.1 on Windows trying to import a SAS dataset into R 
using sas.get.

It is a small SAS dataset, but when I write the command, the SAS window 
opens but never appears to complete.  Am I doing something wrong?

Here is an example of my command:

temp - sas.get(J:/blah,name)

Jorge
[[alternative HTML version deleted]]

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


Re: [R] problem using evaluating a formula

2005-08-02 Thread Gavin Simpson
On Tue, 2005-08-02 at 18:27 +0100, Gavin Simpson wrote:
 ##data
snip
 
 coca(y1 ~ y2, method = symmetric, symmetric= TRUE)

sorry, this should have been:

coca.formula(y1 ~ y2, method = symmetric, symmetric= TRUE)

 gives:
 
 Error in model.frame(formula, rownames, variables, varnames, extras,
 extranames,  : 
   invalid variable type
snip

G
-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Gavin Simpson [T] +44 (0)20 7679 5522
ENSIS Research Fellow [F] +44 (0)20 7679 7565
ENSIS Ltd.  ECRC [E] gavin.simpsonATNOSPAMucl.ac.uk
UCL Department of Geography   [W] http://www.ucl.ac.uk/~ucfagls/cv/
26 Bedford Way[W] http://www.ucl.ac.uk/~ucfagls/
London.  WC1H 0AP.
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

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


Re: [R] can we manage memory usage to increase speed?

2005-08-02 Thread Thomas Lumley
On Tue, 2 Aug 2005, Spencer Graves wrote:

 And you can identify inefficient code fairly easily taking snapshots
 from proc.time and computing elapsed time for sections of your code.

Or use the profiler, which makes it much easier. There was a Programmers' 
Niche article about it in one of the first R Newsletters.

-thomas


 spencer graves

 Tuszynski, Jaroslaw W. wrote:


 If you have a code that takes 2 weeks to run, than it might be a case of
 inefficient algorithm design. I was able to go from overnight runs (SELDI
 data analysis) to 20 minute runs by identifying single inefficient function
 that took most of the time, and writing it in C.

 Jarek
 \===

  Jarek Tuszynski, PhD.   o / \
  Science Applications International Corporation  \__,|
  (703) 676-4192  \
  [EMAIL PROTECTED] `\


 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On Behalf Of Zhilin Liu
 Sent: Monday, August 01, 2005 8:28 PM
 To: r-help@stat.math.ethz.ch
 Subject: [R] can we manage memory usage to increase speed?

 Hi,

 Thanks for reading.

 I am running  a process in R for microarray data analysis. RedHat Enterprise
 Linux 4, dual AMD CPU, 6G memory. However, the R process use only a total of
 200M memory. And the CPU usage is total to ~110% for two. The program takes
 at least 2 weeks to run at the current speed. Is there some way we can
 increase the usage of CPUs and memories and speed up? Any suggestion is
 appreciated.

 Thanks again.

 Zhilin

  [[alternative HTML version deleted]]

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

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

 -- 
 Spencer Graves, PhD
 Senior Development Engineer
 PDF Solutions, Inc.
 333 West San Carlos Street Suite 700
 San Jose, CA 95110, USA

 [EMAIL PROTECTED]
 www.pdf.com http://www.pdf.com
 Tel:  408-938-4420
 Fax: 408-280-7915

 __
 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


Thomas Lumley   Assoc. Professor, Biostatistics
[EMAIL PROTECTED]   University of Washington, Seattle

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


[R] reading in and mps file

2005-08-02 Thread Dhiren DSouza
Hi all:

How does one read in an mps file and store it in a matrix as is.  I have 
pasted the format of the file.  I have implemented an mps writer but would 
like to have the capability to read in an mps file as well and store it in a 
matrix with out using the 'linprog' routines in R.  Is there are way to use 
read.table or scan on the file below.  Your help will be greatly 
appreciated.

-Dhiren

NAME test.2005-08-02.Tue
ROWS
N obj
L CPA
E ass1
E ass2
E ass3
COLUMNS
982323.1 obj 7.12279694339023 CPA -0.300433084368706 ass1 1
982323.2 obj -8.41320485916529 CPA 0.603671897647387 ass1 1
982323.41 obj 0 CPA 0 ass1 1
982351.1 obj -21.4471176117659 CPA 1.80909823649563 ass2 1
982351.22 obj -32.9606785054072 CPA 3.23030611400710 ass2 1
982351.41 obj 0 CPA 0 ass2 1
982554.1 obj 1.66536080466821 CPA -0.107303781434894 ass3 1
982554.23 obj -1.07268986390231 CPA 0.100720627703143 ass3 1
982554.41 obj 0 CPA 0 ass3 1
RHS
rhs ass1 1
rhs ass2 1
rhs ass3 1
ENDATA

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


[R] Hmisc / Design question

2005-08-02 Thread Greg Tarpinian
All,

I have been reading Dr. Harrell's excellent 
Regression Modeling Strategies book and trying out
the exercises.  I understand that contrast( ) is used
to obtain contrasts between two variables for given 
levels of other nuisance variables; is there a way
to use contrast( ) to obtain, for example, Scheffe
confidence intervals / hypothesis tests for many
post hoc contrasts at once?

Any help would be much appreciated,

Greg

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


[R] Loop problem

2005-08-02 Thread Hathaikan Chootrakool
Dear everyone

 I am a new user,would like to combine these code together by using a
loop,each function has three value as Tr = 1 - 3,how can i combine
together?


logitTr1 -logit[logit[,Study]logit[,Tr]==1,]
(number of row in each group (1-3) is difference but equal in colume)

fnTr1 - function (p) sum(
n/2*log(2*pi)+log(1/logitTr1$sd)+1/2*(logitTr1$logitp*logitTr1$logitp-2*logitTr1$logitp*p+p^2)
*1/logitTr1$sd*logitTr1$sd )
(maximum likelyhood function)

outTr1- nlm (fnTr1,p=c(10),hessian=TRUE)
minimumTr1 - outTr1$minimum
valueTr1 - outTr1$estimate
(estimate the value)

The problem is the program couldn't work by using logitTr[i],fnTr[i]
outTr[i],minimumTr[i],value[i] in a loop. The function logitTr[i] is the
data matrix which is not equal each group, fnTr[i] is the
maximumlikelyhood function for estimation in next step;
outTr[i],minimumTr[i],valueTr[i].



Has anyone got any idea to help me?,thank you very much.

Hathaikan

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


[R] memory limit

2005-08-02 Thread array chip
Hi, is it possible to increase the memory limit to
infinite so that I don't need to worry about whether
it is enough or not? In S-plus, you can do this by
setting:

options( memory = as.integer( Inf ) )

is it possible to do this in R?

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


[R] parallel computing in R

2005-08-02 Thread Steve Adams
Hi, is there an excellent source of documentation for
installation, configuration of R packages
(Rmpi,snow,rsprng etc.) for parallel computing on
linus system?

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


Re: [R] memory limit

2005-08-02 Thread Uwe Ligges
array chip wrote:

 Hi, is it possible to increase the memory limit to
 infinite so that I don't need to worry about whether
 it is enough or not? In S-plus, you can do this by
 setting:
 
 options( memory = as.integer( Inf ) )
 
 is it possible to do this in R?

You are on Windows, right?

See ?memory.limit

You cannot say Inf, but memory.limit(4000) sets it to 4Gb which you 
won't reach with a 32bit machine anyway.

Say you are on a 32bit machine with 512Mb of RAM, you certainly do not 
want that R accesses much more than 512Mb for itself, in order to 
prevent too much swapping. And that's what R chooses for you.

Uwe Ligges



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

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


Re: [R] Hmisc / Design question

2005-08-02 Thread Frank E Harrell Jr
Greg Tarpinian wrote:
 All,
 
 I have been reading Dr. Harrell's excellent 
 Regression Modeling Strategies book and trying out
 the exercises.  I understand that contrast( ) is used
 to obtain contrasts between two variables for given 
 levels of other nuisance variables; is there a way
 to use contrast( ) to obtain, for example, Scheffe
 confidence intervals / hypothesis tests for many
 post hoc contrasts at once?
 
 Any help would be much appreciated,
 
 Greg

Steven Novick (cc'd) has written some nice code that I regret I haven't 
had time to add into contrast.Design for doing simulation-based 
adjustment for multiple comparisons.  Below is the code he sent me.

## Program: multiple.adjustment.R
## Version: 1
## Author:  Steven Novick
## Date:May 21, 2004
## Purpose: Compute the exact T-critical value for multiple 
comparisons based on the paper
##  Don Edwards and Jack Berry (1987). The Efficiency of 
Simulation-Based Multiple Comparison.
##  Biometrics 43, pp913-928.
multiple.adjustment = function(fit, cont1, cont2, alpha=.05, m=7)
{
 ## fit = object of class ols from library Design
 ## cont1, cont2 = data.frame with elements to be contrasted.  See 
function contrast in Design.
 ## alpha = test significance level
 ## m = number of monte-carlo runs
 V=fit$var/fit$stats[Sigma]^2  ## Var( coef(fit) ) = sigma^2 * V
 C=contrast(fit, cont1, cont2)$X ## Contrast matrix
 df = fit$df## Error degrees of freedom


 r = (m+1)*(1-alpha) # P( W  w[r] ) = alpha
 if ( floor(r) != ceiling(r) )
 stop((m+1)*(1-alpha) must be an integer.)


 ## Create random numbers
 n.contrast=nrow(C)
 n.coef=length(coef(fit))
 G=chol(V)
 U=apply(C, 1, function(ctr){( G%*%ctr 
)/as.vector(sqrt(t(ctr)%*%V%*%ctr)) })
 W = sort(sapply(1:m, function(i){ z=rnorm(n.coef); y=sqrt(rchisq(1, 
df)/df); w=abs(t(U)%*%z)/y; return(max(w)) }))

 w.alpha = W[r]  ## Cut-off value for testing; 95% CI = beta.hat + 
c(-1, 1)*w.alpha* SE(beta.hat)
 alpha.star = 2*(1-pt(w.alpha, df))  ## What is alpha if using 
T-statistic ?

 return(list(w.alpha=w.alpha, alpha.star=alpha.star))
}
-- 
Frank E Harrell Jr   Professor and Chair   School of Medicine
  Department of Biostatistics   Vanderbilt University

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


[R] cut.Date functionality for chron date/time objects

2005-08-02 Thread Sebastian Luque
Hello,

I've encountered the need to cut some chron objects of the form:

R mychron - chron(sort(runif(10, 0, 10)))
R mychron
 [1] (01/01/70 16:36:20) (01/02/70 00:08:46) (01/03/70 16:54:49)
 [4] (01/04/70 06:45:00) (01/07/70 06:21:24) (01/07/70 18:28:44)
 [7] (01/08/70 00:47:05) (01/08/70 05:11:44) (01/10/70 01:07:53)
[10] (01/10/70 17:46:53)

into arbitrary (e.g. a given number of minutes, seconds, etc.) units.
Basically, I'm searching for the functionality of cut.Date, which has a
nice 'breaks' argument:


,-[ *help[R](cut.Date)* (lines: 23 - 30) ]
|   breaks: a vector of cut points _or_ number giving the number of
|   intervals which 'x' is to be cut into _or_ an interval
|   specification, one of 'sec', 'min', 'hour', 'day',
|   'DSTday', 'week', 'month' or 'year', optionally
|   preceded by an integer and a space, or followed by 's'. 
|   For 'Date' objects only 'day', 'week', 'month' and
|   'year' are allowed. 
`-

'cut.dates' (from chron itself) allows for cut'ing into months, years,
etc., but not any fractions or multiples of these.

Converting the chron objects to POSIXct (via 'as.POSIXct') and then using
cut.Date works, but is inconvenient, as it introduces time zone
information. Is there a better way to deal with this?

Thanks in advance,
-- 
Sebastian P. Luque

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


Re: [R] Help with sas.get

2005-08-02 Thread Wensui Liu
Jorge,

My understanding about sas.get is that it actually runs SAS in the
backend, output the SAS data, and then import it into R again.

It might be better to convert SAS to csv format and read it into R.

On 8/2/05, Jorge Sirgo [EMAIL PROTECTED] wrote:
 I am running R 2.0.1 on Windows trying to import a SAS dataset into R
 using sas.get.
 
 It is a small SAS dataset, but when I write the command, the SAS window
 opens but never appears to complete.  Am I doing something wrong?
 
 Here is an example of my command:
 
 temp - sas.get(J:/blah,name)
 
 Jorge
 [[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
 


-- 
WenSui Liu, MS MA
Senior Decision Support Analyst
Division of Health Policy and Clinical Effectiveness
Cincinnati Children Hospital Medical Center

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


[R] breaking command in command line in R for Mac Aqua

2005-08-02 Thread Michael Sohn
I'm using R for Mac Aqua version 2.1.1

If at the command line, I type:
ls(
and then a return, the command line prompt changes to
a plus sign indicating that the command has not been
completed.  How do I break, or kill, the partial
command?  Sometimes, I type a long command but miss a
bracket or parenthesis.  On a unix or linux version of
R, I can type ctrl-c.  On the Mac, ctrl-c,
command-(dot), and escape do not work.

Any solutions?
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


Re: [R] Help with sas.get

2005-08-02 Thread Frank E Harrell Jr
Wensui Liu wrote:
 Jorge,
 
 My understanding about sas.get is that it actually runs SAS in the
 backend, output the SAS data, and then import it into R again.

He has SAS running locally.
 
 It might be better to convert SAS to csv format and read it into R.

For that, the Hmisc package's sasxport.get(..., method='csv'...) can help.

Frank

 
 On 8/2/05, Jorge Sirgo [EMAIL PROTECTED] wrote:
 
I am running R 2.0.1 on Windows trying to import a SAS dataset into R
using sas.get.

It is a small SAS dataset, but when I write the command, the SAS window
opens but never appears to complete.  Am I doing something wrong?

Here is an example of my command:

temp - sas.get(J:/blah,name)

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

 
 
 


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

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


Re: [R] can we manage memory usage to increase speed?

2005-08-02 Thread Zhilin Liu
Hi, 
Thank you all for the kind reply.

I recompiled R as the previous one turned profiling
off. 

I am using package MAANOVA, running the matest
function which is a permutation test. The author did
warn that it takes a long time to run.

Here is one of the test results:
[ Rdata]# ./R CMD Rprof maanovatest.out

Each sample represents 0.02 seconds.
Total run time: 905.95999466 seconds.

Total seconds: time spent in function and callees.
Self seconds: time spent in function alone.

   %   total   %   self
 totalseconds selfsecondsname
100.00905.94  0.00  0.00 matest
 80.18726.40  0.25  2.30 fitmaanova
 79.37719.04  0.19  1.72 mixed
 68.34619.16  1.05  9.50 pinv
 64.33582.78  0.88  7.96 La.svd
 55.51502.90 55.51502.90 .Call
 38.47348.54  1.58 14.28 makeHq
 34.50312.60  0.13  1.18 solveMME
 19.80179.42  0.18  1.60
matest.engine
 10.19 92.30 10.19 92.30 %*%
..

The other part are not pasted as they are almost the
same everytime we check the profiling. Only the parts
above changes. For example, here is another output:
100.00   1411.02  0.00  0.02 matest
 82.88   1169.40  0.24  3.40 fitmaanova
 82.22   1160.18  0.19  2.74 mixed
 68.82971.02  1.06 14.90 pinv
 64.84914.94  0.85 11.98 La.svd
 56.10791.64 56.10791.64 .Call
 39.13552.10  1.55 21.84 makeHq
 36.77518.82  0.13  1.88 solveMME
 31.40443.04  0.00  0.00 matest.perm
 17.10241.32  0.16  2.28
matest.engine
 10.15143.24 10.15143.24 %*%

I run this with a permutation of 2 times and it is
still running. So it is not possible to run 1000
permutations with this kind of speed.

And here is the output of TOP for R:
  PID USER  PR  NI  VIRT  RES  SHR S %CPU %MEM   
TIME+  COMMAND
15250 liuz   0 -20  218m 136m 2556 R 72.3  2.5 
29:05.20 R

Any suggestion to improve the performance is highly
appreciated.

Thanks a lot.

Zhilin



--- Douglas Bates [EMAIL PROTECTED] wrote:

 On 8/2/05, Spencer Graves [EMAIL PROTECTED]
 wrote:
And you can identify inefficient code
 fairly easily taking snapshots
  from proc.time and computing elapsed time for
 sections of your code.
  
spencer graves
 
 Using Rprof may be a better choice.  See
 
 ?Rprof
 
  
  Tuszynski, Jaroslaw W. wrote:
  
  
   If you have a code that takes 2 weeks to run,
 than it might be a case of
   inefficient algorithm design. I was able to go
 from overnight runs (SELDI
   data analysis) to 20 minute runs by identifying
 single inefficient function
   that took most of the time, and writing it in C.
  
   Jarek
  

\===
  
Jarek Tuszynski, PhD.  
 o / \
Science Applications International Corporation 
 \__,|
(703) 676-4192 
 \
[EMAIL PROTECTED]  
   `\
  
  
   -Original Message-
   From: [EMAIL PROTECTED]
   [mailto:[EMAIL PROTECTED] On
 Behalf Of Zhilin Liu
   Sent: Monday, August 01, 2005 8:28 PM
   To: r-help@stat.math.ethz.ch
   Subject: [R] can we manage memory usage to
 increase speed?
  
   Hi,
  
   Thanks for reading.
  
   I am running  a process in R for microarray data
 analysis. RedHat Enterprise
   Linux 4, dual AMD CPU, 6G memory. However, the R
 process use only a total of
   200M memory. And the CPU usage is total to
 ~110% for two. The program takes
   at least 2 weeks to run at the current speed. Is
 there some way we can
   increase the usage of CPUs and memories and
 speed up? Any suggestion is
   appreciated.
  
   Thanks again.
  
   Zhilin
  
 [[alternative HTML version deleted]]
  
   __
   R-help@stat.math.ethz.ch mailing list
   https://stat.ethz.ch/mailman/listinfo/r-help
   PLEASE do read the posting guide!
   http://www.R-project.org/posting-guide.html
  
   __
   R-help@stat.math.ethz.ch mailing list
   https://stat.ethz.ch/mailman/listinfo/r-help
   PLEASE do read the posting guide!
 http://www.R-project.org/posting-guide.html
  
  --
  Spencer Graves, PhD
  Senior Development Engineer
  PDF Solutions, Inc.
  333 West San Carlos Street Suite 700
  San Jose, CA 95110, USA
  
  [EMAIL PROTECTED]
  www.pdf.com http://www.pdf.com
  Tel:  408-938-4420
  Fax: 408-280-7915
  
  __
  R-help@stat.math.ethz.ch mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide!
 http://www.R-project.org/posting-guide.html
 
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting 

Re: [R] parallel computing in R

2005-08-02 Thread Dirk Eddelbuettel
Steve Adams steve_adams_sd at yahoo.com writes:
 Hi, is there an excellent source of documentation for
 installation, configuration of R packages
 (Rmpi,snow,rsprng etc.) for parallel computing on
 linus system?

In case you want it ready-to-run, Rmpi, SNOW, Rsprng, ... work out 
of the box under Quantian, which would give you openMosix to boot
which can make scheduling MPI/PVM easier. For more about Quantian,
see the pages at http://dirk.eddelbuettel.com/quantian 

All three are also part of Debian so you could add them (pre-built, 
no less) to a regular Debian system, and possibly a derived system 
such as Ubuntu. Sprng was a bit tricky to build, the others are 
pretty standard.

I talked about it a little at Usenix last year and intend to revisit 
this for DSC 2005 in a couple of days. 

Hope this helps, Dirk

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


Re: [R] how to print a data.frame without row.names

2005-08-02 Thread Heinz Tuechler
Thanks to all of you for your help.

As far as I see, the solution of Peter Dalgaard works exactly as I want.
All other solutions have limitations.

Heinz

At 19:19 02.08.2005 +0200, Peter Dalgaard wrote:
Martin Maechler [EMAIL PROTECTED] writes:

  Heinz == Heinz Tuechler [EMAIL PROTECTED]
  on Tue, 02 Aug 2005 17:46:07 +0200 writes:
 
   ...
 
 Heinz I tried this, but then the column headers and column
 Heinz contents are not aligned.
 
   
 
 Use the tabulator if you need them aligned :
 
 write.table(USArrests, row.names = FALSE, sep = \t)

Unless a column or a header is 8 chars or wider (and UrbanPop is!).

This seems to do it:

  x - as.matrix(format(USArrests))
  rownames(x) - rep(, nrow(x))
  print(x, quote=FALSE, right=TRUE)

-- 
   O__   Peter Dalgaard Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
~~ - ([EMAIL PROTECTED])  FAX: (+45) 35327907



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


Re: [R] cut.Date functionality for chron date/time objects

2005-08-02 Thread Gabor Grothendieck
Assuming, as in your post:

set.seed(123)
mychron - chron(sort(runif(10, 0, 10)))
breaks - quantile(mychron)

# is one of these adequate?

cut(mychron, breaks)

cut(unclass(mychron), unclass(breaks), lab = FALSE)



On 8/2/05, Sebastian Luque [EMAIL PROTECTED] wrote:
 Hello,
 
 I've encountered the need to cut some chron objects of the form:
 
 R mychron - chron(sort(runif(10, 0, 10)))
 R mychron
  [1] (01/01/70 16:36:20) (01/02/70 00:08:46) (01/03/70 16:54:49)
  [4] (01/04/70 06:45:00) (01/07/70 06:21:24) (01/07/70 18:28:44)
  [7] (01/08/70 00:47:05) (01/08/70 05:11:44) (01/10/70 01:07:53)
 [10] (01/10/70 17:46:53)
 
 into arbitrary (e.g. a given number of minutes, seconds, etc.) units.
 Basically, I'm searching for the functionality of cut.Date, which has a
 nice 'breaks' argument:
 
 
 ,-[ *help[R](cut.Date)* (lines: 23 - 30) ]
 |   breaks: a vector of cut points _or_ number giving the number of
 |   intervals which 'x' is to be cut into _or_ an interval
 |   specification, one of 'sec', 'min', 'hour', 'day',
 |   'DSTday', 'week', 'month' or 'year', optionally
 |   preceded by an integer and a space, or followed by 's'.
 |   For 'Date' objects only 'day', 'week', 'month' and
 |   'year' are allowed.
 `-
 
 'cut.dates' (from chron itself) allows for cut'ing into months, years,
 etc., but not any fractions or multiples of these.
 
 Converting the chron objects to POSIXct (via 'as.POSIXct') and then using
 cut.Date works, but is inconvenient, as it introduces time zone
 information. Is there a better way to deal with this?
 
 Thanks in advance,
 --
 Sebastian P. Luque
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


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


[R] Trouble with SciViews-R 0.7-3, SciViews R 0.8-7, and Tinn-R 1.16.1.5

2005-08-02 Thread Bing Ho
Hello everybody,

I am new to using Windows and R, and have been experimenting with various
packages.

I recently installed R 2.1.1 under Windows XP SP2, and tried installing the
latest versions of SciViews (0.7-6, and R package 0.8-7 found on the
sciviews.org website), and also Tinn-R 1.16.1.5 stable. I have also been
experimenting with R Commander 0.9-14 stable, 1.0-2 stable, and also tried
1.1 unstable (along with dependent packages).

Oddly, although the installer for SciViews says version 0.7-3, the About
dialog box says 0.7.6. I am not certain which is the correct version.

I have confirmed incompatibility with the latest stable and unstable R
Commander and SciViews (recently noted by Grosjean in R-help). R Commander
0.9-14 does work with SciViews 0.7.6 (.3?), but also produces the
previously reported error that R Commander is not installed (answering No
to installing, will allow the correct dialog box to open).

I have noticed the following additional two behaviours which have
consistently been produced.

1. After installing SciViews 0.8-7 package from the SciViews website, the
call-tip functionality is broken in Tinn-R 1.16.1.5 stable. Downgrading, or
installing, the SciViews 0.8-6 from CRAN restores, or enables, this
functionality.

2. The Packages menu in SciViews-R 0.7.3 is hopelessly broken for me (at
least under R 2.1.1). The only menu option that works sometimes, for
reasons I am unable to elucidate, is Load packages (the first option);
however, many times Rconsole crashes altogether. The other menu choices
result in nothing happening. I am able to replicate this behaviour with
multiple fresh installs of R 2.1.1, SciViews 0.7-6 (3?) (and SciViews 0.8.7
package), and tcltk2 0.7-4.

I am not sure that these reports matter since it appears that SciViews will
shortly be updated, but since I found no mention of these issues, I am
hopeful that the next version may fix them.

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


Re: [R] cut.Date functionality for chron date/time objects

2005-08-02 Thread Sebastian Luque
Gabor Grothendieck [EMAIL PROTECTED] wrote:
 Assuming, as in your post:

 set.seed(123)
 mychron - chron(sort(runif(10, 0, 10)))
 breaks - quantile(mychron)

 # is one of these adequate?

 cut(mychron, breaks)

 cut(unclass(mychron), unclass(breaks), lab = FALSE)

Thank you Gabor, that showed me I really needed to be more creative with
the 'breaks' argument. So what I needed was (with mychron as above):

breaks - seq(min(mychron, na.rm = TRUE),
  ceiling(max(mychron, na.rm = TRUE)), by = 1/2)

cut(unclass(mychron), unclass(breaks),
include.lowest = TRUE, labels = FALSE)


in order to cut the chron object into 1/2 day units.


Thanks so much,
-- 
Sebastian P. Luque

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


Re: [R] cut.Date functionality for chron date/time objects

2005-08-02 Thread Spencer Graves
How about the following:

  set.seed(123)
  mychron - chron(sort(runif(10, 0, 10)))
  (breaks - chron(pretty(quantile(mychron
[1] 01/01/70 01/03/70 01/05/70 01/07/70 01/09/70 01/11/70
 
spencer graves

Sebastian Luque wrote:

 Gabor Grothendieck [EMAIL PROTECTED] wrote:
 
Assuming, as in your post:

set.seed(123)
mychron - chron(sort(runif(10, 0, 10)))
breaks - quantile(mychron)

# is one of these adequate?

cut(mychron, breaks)

cut(unclass(mychron), unclass(breaks), lab = FALSE)
 
 
 Thank you Gabor, that showed me I really needed to be more creative with
 the 'breaks' argument. So what I needed was (with mychron as above):
 
 breaks - seq(min(mychron, na.rm = TRUE),
   ceiling(max(mychron, na.rm = TRUE)), by = 1/2)
 
 cut(unclass(mychron), unclass(breaks),
 include.lowest = TRUE, labels = FALSE)
 
 
 in order to cut the chron object into 1/2 day units.
 
 
 Thanks so much,

-- 
Spencer Graves, PhD
Senior Development Engineer
PDF Solutions, Inc.
333 West San Carlos Street Suite 700
San Jose, CA 95110, USA

[EMAIL PROTECTED]
www.pdf.com http://www.pdf.com
Tel:  408-938-4420
Fax: 408-280-7915

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


[R] prcomp eigenvalues

2005-08-02 Thread Rebecca Young
Hello,

Can you get eigenvalues in addition to eigevectors using prcomp?  If so how?
I am unable to use princomp due to small sample sizes.
Thank you in advance for your help!
Rebecca Young

--
Rebecca Young
Graduate Student
Ecology  Evolutionary Biology, Badyaev Lab
University of Arizona
1041 E Lowell
Tucson, AZ 85721-0088
Office: 425BSW
[EMAIL PROTECTED]
(520) 621-4005

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


Re: [R] prcomp eigenvalues

2005-08-02 Thread ronggui
I donn't think you can get it directly from prcomp ,but you can get it though 
svd.In fact,the prcomp use the svd to do the principal components analysis .


=== 2005-08-03 10:06:56 您在来信中写道:===

Hello,

Can you get eigenvalues in addition to eigevectors using prcomp?  If so how?
I am unable to use princomp due to small sample sizes.
Thank you in advance for your help!
Rebecca Young

--
Rebecca Young
Graduate Student
Ecology  Evolutionary Biology, Badyaev Lab
University of Arizona
1041 E Lowell
Tucson, AZ 85721-0088
Office: 425BSW
[EMAIL PROTECTED]
(520) 621-4005

__
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

= = = = = = = = = = = = = = = = = = = =



 

2005-08-03

--
Deparment of Sociology
Fudan University

Blog:http://sociology.yculblog.com

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

Re: [R] prcomp eigenvalues

2005-08-02 Thread Sundar Dorai-Raj


Rebecca Young wrote:
 Hello,
 
 Can you get eigenvalues in addition to eigevectors using prcomp?  If so how?
 I am unable to use princomp due to small sample sizes.
 Thank you in advance for your help!
 Rebecca Young
 


Hi, Rebecca,

 From ?prcomp:

  The calculation is done by a singular value decomposition of the
  (centered and possibly scaled) data matrix, not by using 'eigen'
  on the covariance matrix.  This is generally the preferred method
  for numerical accuracy. ...

So you can get the singular values, but not the eigenvalues. You could 
use ?princomp if you really want the eigenvalues. In either case, you 
read the code to see how this is done.

x - matrix(rnorm(1000), 100, 10)

# eigenvalues
v - cov.wt(x)
ev - eigen(v$cov * (1 - 1/v$n.obs), symmetric = TRUE)$values
ev[ev  0] - 0
princomp(x)$sdev
sqrt(ev)

# singular values
sv - svd(scale(x, center = TRUE, scale = FALSE), nu = 0)
prcomp(x)$sdev
sv$d/sqrt(max(1, nrow(x) - 1))

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


Re: [R] cut.Date functionality for chron date/time objects

2005-08-02 Thread Sebastian Luque
Spencer Graves [EMAIL PROTECTED] wrote:
 How about the following:

 set.seed(123)
 mychron - chron(sort(runif(10, 0, 10)))
 (breaks - chron(pretty(quantile(mychron
 [1] 01/01/70 01/03/70 01/05/70 01/07/70 01/09/70 01/11/70

I was looking for a way to cut it into specified units of time, rather
than quantiles. Anyway, both your suggestions show one can go very far
with the breaks arg.

Thank you!
-- 
Sebastian P. Luque

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


[R] hash code for arbitrary object

2005-08-02 Thread Adrian Baddeley
Can anyone suggest a simple way to calculate a 'hash code'
from an arbitrary R object?

hash(x) should return an integer or string 
with the property that 
 if hash(x) != hash(y) then x and y are not identical
and the time to compute hash(x) should be quite short.

Any suggestions welcome
thanks
Adrian Baddeley

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


Re: [R] hash code for arbitrary object

2005-08-02 Thread Marc Schwartz
On Wed, 2005-08-03 at 12:05 +0800, Adrian Baddeley wrote:
 Can anyone suggest a simple way to calculate a 'hash code'
 from an arbitrary R object?
 
 hash(x) should return an integer or string 
 with the property that 
  if hash(x) != hash(y) then x and y are not identical
 and the time to compute hash(x) should be quite short.
 
 Any suggestions welcome
 thanks
 Adrian Baddeley


Take a look at Dirk Eddelbuettel's digest() function in the package of
the same name on CRAN. Be sure to read the details section for caveats
regarding collisions.

HTH,

Marc Schwartz

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


[R] regexpr and portability issue

2005-08-02 Thread Marco Blanchette
Dear all--

I am still forging my first arms with R and I am fighting with regexpr() as
well as portability between unix and windoz. I need to extract barcodes from
filenames (which are located between a double and single underscore) as well
as the directory where the filename is residing. Here is the solution I came
to:

aFileName - 
/Users/marco/Desktop/diagnosticAnalysis/test/MA__251329410021_S01_A01.txt
t - regexpr(__\\d*_,aFileName, perl=T)
t.dir - regexpr(^.*/, aFileName, perl=T)
base.name - substr(aFileName, t+2, t-2 + attr(t,match.length))
base.dir - substr(aFileName, t.dir, attr(t.dir,match.length))

My questions are:
1) Is there a more elegant way to deal with regular expressions (read here:
more easier, more like perl style).
2) I have a portability problem when I extract the base.dir Windoz is using
'\' instead of '/' to separate directories.

Any suggestions/comments

Many Tx

Marco Blanchette, Ph.D.

[EMAIL PROTECTED]

Donald C. Rio's lab
Department of Molecular and Cell Biology
16 Barker Hall
University of California
Berkeley, CA 94720-3204

Tel: (510) 642-1084
Cell: (510) 847-0996
Fax: (510) 642-6062

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


[R] how to test this

2005-08-02 Thread Jin.Li
Dear there,

I am wondering how to test whether a simple linear regression model
(e.g. y=1.05x) is significantly different from a 1 to 1 line (i.e. y=x).
Thanks.

Regards,

Jin


[[alternative HTML version deleted]]

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


Re: [R] regexpr and portability issue

2005-08-02 Thread Gabor Grothendieck
Try this.  The regular expression says to match 
- anything 
- followed by a double underscore 
- followed by one or more digits
- followed by an underscore 
- followed by anything.  
The digits have been parenthesized so that they can be referred to in
the backreference \\1.Also use the R function dirname
rather than regular expressions.

base.name - sub(.*__([[:digit:]]+)_.*, \\1, aFileName, ext = TRUE)
base.dir - dirname(aFileName)


On 8/3/05, Marco Blanchette [EMAIL PROTECTED] wrote:
 Dear all--
 
 I am still forging my first arms with R and I am fighting with regexpr() as
 well as portability between unix and windoz. I need to extract barcodes from
 filenames (which are located between a double and single underscore) as well
 as the directory where the filename is residing. Here is the solution I came
 to:
 
 aFileName -
 /Users/marco/Desktop/diagnosticAnalysis/test/MA__251329410021_S01_A01.txt
 t - regexpr(__\\d*_,aFileName, perl=T)
 t.dir - regexpr(^.*/, aFileName, perl=T)
 base.name - substr(aFileName, t+2, t-2 + attr(t,match.length))
 base.dir - substr(aFileName, t.dir, attr(t.dir,match.length))
 
 My questions are:
 1) Is there a more elegant way to deal with regular expressions (read here:
 more easier, more like perl style).
 2) I have a portability problem when I extract the base.dir Windoz is using
 '\' instead of '/' to separate directories.
 
 Any suggestions/comments
 
 Many Tx
 
 Marco Blanchette, Ph.D.
 
 [EMAIL PROTECTED]
 
 Donald C. Rio's lab
 Department of Molecular and Cell Biology
 16 Barker Hall
 University of California
 Berkeley, CA 94720-3204
 
 Tel: (510) 642-1084
 Cell: (510) 847-0996
 Fax: (510) 642-6062
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


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


[R] Multilevel logistic regression using lmer vs glmmPQL vs. gllamm in Stata

2005-08-02 Thread Bernd Weiss
Dear all,

I am trying to replicate some multilevel models with binary outcomes 
using R's lmer and glmmPQL and Stata's gllmm, respectively. 

The data can be found at http://www.uni-koeln.de/~ahf34/xerop.dta. 

The relevant Stata output can be found at  http://www.uni-
koeln.de/~ahf34/stataoutput.txt. First, you will find the 
unconditional model, i.e. no level1- or 2-predictor variables. The 
second model contains some level 1-predictor variables

My R file can be found at http://www.uni-koeln.de/~ahf34/xerop.R.

Beside the fact that there is a difference between the estimates of 
the intercept (unconditional model: R: -2.76459 and Stata: -2.698923) 
I am especially interested in the level 2 variance. 

In Stata the level 2 variance is about 1.03, while in R it is  4.68. 

Using glmmPQL from package MASS again gives different results for the 
level 2 variance component. What is meant by Residual? I thought 
the level 1 variance is fixed to (pi^2)/3.  

I am a beginner in multilevel modeling so I assume I made some 
mistake either in interpreting the output or specifying the models. 

I would appreciate any help.

Bernd

__
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