Re: [R] Embed R in other applications

2003-03-03 Thread Deepayan Sarkar

See http://www.math.montana.edu/Rweb/

On Monday 03 March 2003 11:00 pm, Bai Yan wrote:
> Hello all,
>
> I want to create webpages which can display the R results. The first step
> is essentially getting input from client, generating graphics and
> returning a page containing those images.
>
> What should I do for this? Are there some sources on the web? Any hints
> will be very helpful.
>
> Thanks very much :)
>
> Yan
>
> __
> [EMAIL PROTECTED] mailing list
> http://www.stat.math.ethz.ch/mailman/listinfo/r-help

__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help


RE: [R] log axis assignment

2003-03-03 Thread Marc Schwartz
>-Original Message-
>From: [EMAIL PROTECTED] 
>[mailto:[EMAIL PROTECTED] On Behalf Of Jeremy Z Butler
>Sent: Monday, March 03, 2003 10:57 PM
>To: [EMAIL PROTECTED]
>Subject: [R] log axis assignment
>
>
>Hi again,
>another problem:
>
>This (below) isn't working and as far as I can see it damn 
>well should. What 
>I'm trying to acomplish is to run several data sets through the same 
>graphing procedure, but for the pH data use a log y axis. 
>using this code 
>all graphs are drawn with a linear axis. Surely I should be 
>able to set the 
>ylog option to T using another object (logaxis).
>
>for (n in colnames(raw))
>{
>if(n=="pH"){logaxis<-"T"} else {logaxis<-"F"}
>plot(full.age,raw[,n],type="n",ylog=logaxis)
>...
>}
>
>Any ideas what I'm doing wrong? I assume its something to do 
>with the ylog 
>(and xlog) options being read-only but I'm not sure what that means.
J


You cannot set the log scaling in the fashion in which you are trying
by setting par(ylog) as an argument to plot().  Presumably you are
getting the following error message:

"parameter "ylog" couldn't be set in high-level plot() function"


Try this instead using the proper 'log' argument to plot:

for (n in colnames(raw))
{
  if(n == "pH")
plot(full.age, raw[,n], type = "n",  log = "y")
  else
plot(full.age, raw[,n], type = "n")
...
}

See ?plot.default for more information.

Also, "T" and "F" as quoted characters are not the same as TRUE and
FALSE as logical boolean values.

HTH,

Marc Schwartz

__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help


[R] Embed R in other applications

2003-03-03 Thread Bai Yan
Hello all,

I want to create webpages which can display the R results. The first step
is essentially getting input from client, generating graphics and
returning a page containing those images.

What should I do for this? Are there some sources on the web? Any hints
will be very helpful.

Thanks very much :)

Yan

__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help


[R] log axis assignment

2003-03-03 Thread Jeremy Z Butler
Hi again,
another problem:
This (below) isn't working and as far as I can see it damn well should. What 
I'm trying to acomplish is to run several data sets through the same 
graphing procedure, but for the pH data use a log y axis. using this code 
all graphs are drawn with a linear axis. Surely I should be able to set the 
ylog option to T using another object (logaxis).

for (n in colnames(raw))
{
if(n=="pH"){logaxis<-"T"} else {logaxis<-"F"}
plot(full.age,raw[,n],type="n",ylog=logaxis)
...
}
Any ideas what I'm doing wrong? I assume its something to do with the ylog 
(and xlog) options being read-only but I'm not sure what that means.
J

__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help


[R] How to estimate or approximate a 3-D surface

2003-03-03 Thread Feng Zhang
Hey, R-listers

Now I am going to estimate or approximate a surface in
3-D space given a large enough number of (x,y,z) data sets.

So for these 3-D data points, is it possible to get a surface
function, like z=f(x,y) to represent this underlying surface?

Thanks for your time and point.

Fred

__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help


RE: [R] samin and vmmin

2003-03-03 Thread FMGCFMGC
Hello!

Take a look at:

http://lib.stat.cmu.edu/S/minfun

The relevant file is: minfun.in (line 110 approx.)

It also points to page 210 of New S book

Hope it helps!
Fran

--- Original message: ---
I am writing code in C and would like to call R's functions samin and
vmmin (optimization routines: simulated annealing and BFGS)

I do not understand how to create and pass in the function (as well as 
the extra arguments it needs) I am optimizing.

I have read the R Extensions manual but it is still unclear to me.

Could you give me some pointers and/or direct me to some example code
which calls one of the optimizer functions and includes the definition 
of
the function to be optimized?

Thank you
Susan

__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] for loop problem

2003-03-03 Thread Douglas Bates
"Jeremy Z Butler" <[EMAIL PROTECTED]> writes:

> Hi,
> I'm just coming to grips with "for" looping etc. and have a bit of a
> problem:
> 
> 
> I want to generate a sequence which goes
> 1 2 3 4 5 6 7 8 14 15 16 17 18 19 20 21 26 27 ...
> i.e. 8 consecutive numbers then 5 missed then the next 8 numbers etc.
> I was going to do this using the seq() function but couldn't figure
> out how so I thought I'd try a loop:
> 
> 
> for (x in seq(1,650,13))
> { num.set.1 <- x:x+8
> }
> but now what I need to do is write code such that each time it goes
> through the loop it assigns the output to a different object
> e.g. num.set.1 on the first loop then num.set.2 on the next etc. so
> that they can be concatenated. Is there any way to do this??
> 
> 
> I may be doing this an extremely complicated way but with my zero
> programming experience its the best I can think of. Can anyone help?

I suggest using a matrix.

> mseq = as.vector(matrix(1:650, nrow = 13)[1:8,])
> length(mseq)
[1] 400
> mseq[1:20]
 [1]  1  2  3  4  5  6  7  8 14 15 16 17 18 19 20 21 27 28 29 30

__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help


RE: [R] writing several command line in R console

2003-03-03 Thread Vincent Stoliaroff


Thanks to all

1) OK for the "+" sign and the problem of syntactelly unbreaking when you 
open a { or a (
2) Thanks for the advise to use another editor for the functions. And then 
the source() function. I tried it succesfully

Long life to R!


From: "Henrik Bengtsson" <[EMAIL PROTECTED]>
To: "'Vincent Stoliaroff'" <[EMAIL PROTECTED]>, 
<[EMAIL PROTECTED]>
Subject: RE: [R] writing several command line in R console
Date: Tue, 4 Mar 2003 14:04:13 +1100

The R prompt should be though of as a one line editor or rather one
expression editor. You can not "step" between lines etc while editing an
expression. The "+" in front of each row placed there by R indicating
that even if you have typed ENTER the expression is not finished and
that R expect you to close it (normally by closing brackets, parentesis
etc). The "+" is just an indicator and will not be included in your
expression.
What you really want to do when you create functions etc is to write the
up in an external text editor, save them with the extension *.R, e.g.
"twosam.R", and the use source to read the function in to R, i.e.
  > source("twosam.R")

Make sure to save your twosam.R file as *text*. If you're using Windows
you can use Notepad to do this. Also, you have to save the file in the
working directory of R. You can find the current working directory of R
by
  > getwd()

Alternatively, you'll have to specify the full path to the file when
using source
  > source("C:/My Documents/hb/twosam.R")

Hope this helps!

Henrik Bengtsson

> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Vincent
> Stoliaroff
> Sent: den 4 mars 2003 13:36
> To: [EMAIL PROTECTED]
> Subject: [R] writing several command line in R console
>
>
>
> Hi R lovers
>
> I would like to know how to step to the next line in the R
> console editor
> without breaking the continuity of my code
> more clearly : if for example I write a function, so far i
> have to write the
> all code inside on the same line wich may become obscure as
> the function is
> more and more complex.
> I would like to do like in the example of the manuels:
>
> >twosam <- function(y1, y2) {
> n1  <- length(y1); n2  <- length(y2)
> yb1 <- mean(y1);   yb2 <- mean(y2)s1  <- var(y1);
> s2  <- var(y2)
> s <- ((n1-1)*s1 + (n2-1)*s2)/(n1+n2-2)
> tst <- (yb1 - yb2)/sqrt(s2*(1/n1 + 1/n2))tst  }
>
>
> all I can do is something like that:
>
> >twosam <- function(y1, y2) {n1  <- length(y1); n2  <- length(y2)
>
> +yb1 <- mean(y1);   yb2 <- mean(y2)s1  <- var(y1);
> s2  <- var(y2)
> +s <- ((n1-1)*s1 + (n2-1)*s2)/(n1+n2-2)
> +   tst <- (yb1 - yb2)/sqrt(s2*(1/n1 + 1/n2))tst  }
>
> with the sign "+" in front of each line
> What does this sign mean? and how could I solve my problems Thanks
>
> __
> [EMAIL PROTECTED] mailing list
> http://www.stat.math.ethz.ch/mailman/listinfo/> r-help
>
>
__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help


RE: [R] for loop problem

2003-03-03 Thread Henrik Bengtsson
Your sequence is 1:a + k*(a+b) where a=8, b=5 and k=0,1,...,K. You can
make use of the fact that R loops of vectors if two vectors are not the
same;

  a <- 8
  b <- 5
  K <- 49
  x <- rep((0:K)*(a+b), each=a) + 1:a

Cheers

Henrik Bengtsson

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of Jeremy Z Butler
> Sent: den 4 mars 2003 14:14
> To: [EMAIL PROTECTED]
> Subject: [R] for loop problem
> 
> 
> Hi,
> I'm just coming to grips with "for" looping etc. and have a bit of a 
> problem:
> 
> I want to generate a sequence which goes
> 1 2 3 4 5 6 7 8 14 15 16 17 18 19 20 21 26 27 ...
> i.e. 8 consecutive numbers then 5 missed then the next 8 
> numbers etc. I was going to do this using the seq() function 
> but couldn't figure out how 
> so I thought I'd try a loop:
> 
> for (x in seq(1,650,13))
> { num.set.1 <- x:x+8
> }
> but now what I need to do is write code such that each time 
> it goes through 
> the loop it assigns the output to a different object e.g. 
> num.set.1 on the 
> first loop then num.set.2 on the next etc. so that they can 
> be concatenated. 
> Is there any way to do this??
> 
> I may be doing this an extremely complicated way but with my zero 
> programming experience its the best I can think of. Can anyone help?
> 
> J
> 
> __
> [EMAIL PROTECTED] mailing list 
> http://www.stat.math.ethz.ch/mailman/listinfo/> r-help
> 
>

__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help


[R] for loop problem

2003-03-03 Thread Jeremy Z Butler
Hi,
I'm just coming to grips with "for" looping etc. and have a bit of a 
problem:

I want to generate a sequence which goes
1 2 3 4 5 6 7 8 14 15 16 17 18 19 20 21 26 27 ...
i.e. 8 consecutive numbers then 5 missed then the next 8 numbers etc.
I was going to do this using the seq() function but couldn't figure out how 
so I thought I'd try a loop:

for (x in seq(1,650,13))
{ num.set.1 <- x:x+8
}
but now what I need to do is write code such that each time it goes through 
the loop it assigns the output to a different object e.g. num.set.1 on the 
first loop then num.set.2 on the next etc. so that they can be concatenated. 
Is there any way to do this??

I may be doing this an extremely complicated way but with my zero 
programming experience its the best I can think of. Can anyone help?

J

__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help


RE: [R] writing several command line in R console

2003-03-03 Thread Henrik Bengtsson
The R prompt should be though of as a one line editor or rather one
expression editor. You can not "step" between lines etc while editing an
expression. The "+" in front of each row placed there by R indicating
that even if you have typed ENTER the expression is not finished and
that R expect you to close it (normally by closing brackets, parentesis
etc). The "+" is just an indicator and will not be included in your
expression.

What you really want to do when you create functions etc is to write the
up in an external text editor, save them with the extension *.R, e.g.
"twosam.R", and the use source to read the function in to R, i.e. 

  > source("twosam.R")

Make sure to save your twosam.R file as *text*. If you're using Windows
you can use Notepad to do this. Also, you have to save the file in the
working directory of R. You can find the current working directory of R
by

  > getwd()

Alternatively, you'll have to specify the full path to the file when
using source

  > source("C:/My Documents/hb/twosam.R")

Hope this helps! 

Henrik Bengtsson

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of Vincent 
> Stoliaroff
> Sent: den 4 mars 2003 13:36
> To: [EMAIL PROTECTED]
> Subject: [R] writing several command line in R console
> 
> 
> 
> Hi R lovers
> 
> I would like to know how to step to the next line in the R 
> console editor 
> without breaking the continuity of my code
> more clearly : if for example I write a function, so far i 
> have to write the 
> all code inside on the same line wich may become obscure as 
> the function is 
> more and more complex.
> I would like to do like in the example of the manuels:
> 
> >twosam <- function(y1, y2) {
> n1  <- length(y1); n2  <- length(y2)
> yb1 <- mean(y1);   yb2 <- mean(y2)s1  <- var(y1);
> s2  <- var(y2)
> s <- ((n1-1)*s1 + (n2-1)*s2)/(n1+n2-2)
> tst <- (yb1 - yb2)/sqrt(s2*(1/n1 + 1/n2))tst  }
> 
> 
> all I can do is something like that:
> 
> >twosam <- function(y1, y2) {n1  <- length(y1); n2  <- length(y2)
> 
> +yb1 <- mean(y1);   yb2 <- mean(y2)s1  <- var(y1);
> s2  <- var(y2)
> +s <- ((n1-1)*s1 + (n2-1)*s2)/(n1+n2-2)
> +   tst <- (yb1 - yb2)/sqrt(s2*(1/n1 + 1/n2))tst  }
> 
> with the sign "+" in front of each line
> What does this sign mean? and how could I solve my problems Thanks
> 
> __
> [EMAIL PROTECTED] mailing list 
> http://www.stat.math.ethz.ch/mailman/listinfo/> r-help
> 
>

__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] writing several command line in R console

2003-03-03 Thread Spencer Graves
You can start the first line with "(".  Then everything you write will 
NOT be syntactically complelte until you issue the closing ")".  I 
learned this from Venables and Ripley, Modern Applied Statistics with S.

The "+" sign in front of each line is NOT something you should enter:  R 
changes its prompt to tell you that the previous line was not 
syntactically complete.

I prefer to keep my code someplace else and then transfer a complete 
function into R at one time.  See 
"http://socserv.socsci.mcmaster.ca/jfox/Books/Companion/ESS/index.html";

Does this answer your questions?
Best Wishes,
Spencer Graves
Vincent Stoliaroff wrote:
Hi R lovers

I would like to know how to step to the next line in the R console 
editor without breaking the continuity of my code
more clearly : if for example I write a function, so far i have to write 
the all code inside on the same line wich may become obscure as the 
function is more and more complex.
I would like to do like in the example of the manuels:

twosam <- function(y1, y2) {
   n1  <- length(y1); n2  <- length(y2)
   yb1 <- mean(y1);   yb2 <- mean(y2)s1  <- var(y1);s2  <- var(y2)
   s <- ((n1-1)*s1 + (n2-1)*s2)/(n1+n2-2)
   tst <- (yb1 - yb2)/sqrt(s2*(1/n1 + 1/n2))tst  }
all I can do is something like that:

twosam <- function(y1, y2) {n1  <- length(y1); n2  <- length(y2)


+yb1 <- mean(y1);   yb2 <- mean(y2)s1  <- var(y1);s2  <- 
var(y2)
+s <- ((n1-1)*s1 + (n2-1)*s2)/(n1+n2-2)
+   tst <- (yb1 - yb2)/sqrt(s2*(1/n1 + 1/n2))tst  }

with the sign "+" in front of each line
What does this sign mean? and how could I solve my problems
Thanks
__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help
__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] Dynamically changing point's symbol in grid.points...

2003-03-03 Thread Paul Murrell
Hi

M.Kondrin wrote:
...does not work. Do 
k<-grid.points(c(0.1,0.2,0.3),c(0.1,0.2,0.3),pch=3,vp=viewport()) 
(symbol - +). Try to change it grid.edit(k, pch=1) (symbol - open 
circle). Get filled squares. pch from 0 to 25 produces the same output. 
pch="x" - works OK. Device - x11(), gtk() (from GtkDevice). R -1.6.1


The problem is that the pch gets interpreted as an integer.

I think the right fix for this is for grid to do the coercion in C code; 
 I'll try to put this in the next grid release.

In the meantime, a workaround is to do something like ...

grid.edit(k, pch=as.integer(1))

Paul
--
Dr Paul Murrell
Department of Statistics
The University of Auckland
Private Bag 92019
Auckland
New Zealand
64 9 3737599 x85392
[EMAIL PROTECTED]
__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help


[R] writing several command line in R console

2003-03-03 Thread Vincent Stoliaroff
Hi R lovers

I would like to know how to step to the next line in the R console editor 
without breaking the continuity of my code
more clearly : if for example I write a function, so far i have to write the 
all code inside on the same line wich may become obscure as the function is 
more and more complex.
I would like to do like in the example of the manuels:

twosam <- function(y1, y2) {
   n1  <- length(y1); n2  <- length(y2)
   yb1 <- mean(y1);   yb2 <- mean(y2)s1  <- var(y1);s2  <- var(y2)
   s <- ((n1-1)*s1 + (n2-1)*s2)/(n1+n2-2)
   tst <- (yb1 - yb2)/sqrt(s2*(1/n1 + 1/n2))tst  }
all I can do is something like that:

twosam <- function(y1, y2) {n1  <- length(y1); n2  <- length(y2)
+yb1 <- mean(y1);   yb2 <- mean(y2)s1  <- var(y1);s2  <- var(y2)
+s <- ((n1-1)*s1 + (n2-1)*s2)/(n1+n2-2)
+   tst <- (yb1 - yb2)/sqrt(s2*(1/n1 + 1/n2))tst  }
with the sign "+" in front of each line
What does this sign mean? and how could I solve my problems
Thanks
__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help


RE: [R] (no subject)

2003-03-03 Thread Henrik Bengtsson
It might depend what package you are using, but in general you can save
data in data frames and matrices to file by using write.table(). It is
common to save it as a tab-delimited file so if your data is stored in a
data frame called 'df' you want to do something like

 write.table(df, file="myresults.dat", sep="\t", quote=FALSE)

The file myresults.dat can then be read by Excel and friends. For more
information see help(write.table). 

Also, please use a subject when writing to r-help. 

Hope this helps!

Henrik Bengtsson

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of Steve Moore
> Sent: den 3 mars 2003 23:12
> To: [EMAIL PROTECTED]
> Subject: [R] (no subject)
> 
> 
> Dear Everyone,
> 
> I am a novel user of the R package (less than a week).  I am 
> using the 
> package to analyse some microarray data.  I have successfully 
> imported the 
> data, and manipulated it, resulting in additional columns of 
> data.  However, 
> I now want to extract all this new information from R for use 
> outside the 
> package.  Can anyone tell me of any commands that would allow me to 
> accomplish this?
> 
> Many thanks in advance
> 
> Stephen Moore.
> 
> 
> 
> 
> 
> _
> Chat online in real time with MSN Messenger http://messenger.msn.co.uk
> 
> __
> [EMAIL PROTECTED] mailing list 
> http://www.stat.math.ethz.ch/mailman/listinfo/> r-help
> 
>

__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help


[R] Finally get SJava work

2003-03-03 Thread Bai Yan

Yeah!! I finally get SJava examples run on linux. The problems is that
there's an old version installed on the machine, with static library.
Unfortunately, the path of the old version is set before the new version,
thus every time when R command is conducted, the old version is invoked
(but I didn't know), and since the libR.so is not exist in that version, I
always got linkage errors :(
After reset the PATH variable, the java file ran!

I was stuck for several days, and really happy to see the problem got
solved. Many thanks for your helps:)

Yan

On Mon, 3 Mar 2003, Robert Gentleman wrote:

> You might check your path -- you probably have an old version that
> comes before the new one that you just built.
>
> On Mon, Mar 03, 2003 at 02:44:51PM -0800, Bai Yan wrote:
> >
> > Download R-1.6.2 source code package from http://cran.r-project.org and
> > compiled successfully.
> > When run library(grid), get error message as the R version is 1.5.1, and
> > cannot support grid package. The weird thing is that R.Version() returned
> > as this R is actualy 1.5.1
> >
> > Did anybody get the same problem? or I made something wrong? Thanks.
> >
> > 
> > > library(grid)
> > Error: This is R 1.5.1, package grid needs >= 1.6.0
> > > R.Version()
> > $platform
> > [1] "i686-pc-linux-gnu"
> >
> > $arch
> > [1] "i686"
> >
> > $os
> > [1] "linux-gnu"
> >
> > $system
> > [1] "i686, linux-gnu"
> >
> > $status
> > [1] ""
> >
> > $major
> > [1] "1"
> >
> > $minor
> > [1] "5.1"
> >
> > $year
> > [1] "2002"
> >
> > $month
> > [1] "06"
> >
> > $day
> > [1] "17"
> >
> > $language
> > [1] "R"
> >
> > __
> > [EMAIL PROTECTED] mailing list
> > http://www.stat.math.ethz.ch/mailman/listinfo/r-help
>
> --
> +---+
> | Robert Gentleman phone : (617) 632-5250   |
> | Associate Professor  fax:   (617)  632-2444   |
> | Department of Biostatistics  office: M1B20|
> | Harvard School of Public Health  email: [EMAIL PROTECTED]   |
> +---+
>

__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] R version conflict.

2003-03-03 Thread Bai Yan

My mistake :(
Seems that there's another R installed by root. So when I use .libPaths()
there're two of them:

> .libPaths()
[1] "/disk/hopper/projects/class/cse514/R/library"
[2] "/usr/lib/R/library"

How could the second path be enabled then? The R_LIBS have already been
set to as the [1] only.

Thanks,

yan

On Mon, 3 Mar 2003, Robert Gentleman wrote:

> You might check your path -- you probably have an old version that
> comes before the new one that you just built.
>
> On Mon, Mar 03, 2003 at 02:44:51PM -0800, Bai Yan wrote:
> >
> > Download R-1.6.2 source code package from http://cran.r-project.org and
> > compiled successfully.
> > When run library(grid), get error message as the R version is 1.5.1, and
> > cannot support grid package. The weird thing is that R.Version() returned
> > as this R is actualy 1.5.1
> >
> > Did anybody get the same problem? or I made something wrong? Thanks.
> >
> > 
> > > library(grid)
> > Error: This is R 1.5.1, package grid needs >= 1.6.0
> > > R.Version()
> > $platform
> > [1] "i686-pc-linux-gnu"
> >
> > $arch
> > [1] "i686"
> >
> > $os
> > [1] "linux-gnu"
> >
> > $system
> > [1] "i686, linux-gnu"
> >
> > $status
> > [1] ""
> >
> > $major
> > [1] "1"
> >
> > $minor
> > [1] "5.1"
> >
> > $year
> > [1] "2002"
> >
> > $month
> > [1] "06"
> >
> > $day
> > [1] "17"
> >
> > $language
> > [1] "R"
> >
> > __
> > [EMAIL PROTECTED] mailing list
> > http://www.stat.math.ethz.ch/mailman/listinfo/r-help
>
> --
> +---+
> | Robert Gentleman phone : (617) 632-5250   |
> | Associate Professor  fax:   (617)  632-2444   |
> | Department of Biostatistics  office: M1B20|
> | Harvard School of Public Health  email: [EMAIL PROTECTED]   |
> +---+
>

__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] transition matrix problem

2003-03-03 Thread Thomas W Blackwell
Nick  -

Ask yourself what happens in  min(as.integer(names(cump[rand<(cump*100)])))
when the random number happens to be larger than the first entry in the
relevant column of p.trans.  How many elements in the comparison are true ?

In that case, I think you are taking the minimum of zero elements, and the
error message is quite correct.

-  tom blackwell  -  u michigan medical school  -  ann arbor  -


On Tue, 4 Mar 2003, Nick Bond wrote:

> I'm having trouble using some fairly simple code to change the entries
> in a vector (x - the numbers 0-5) according to a simple transition
> matrix that I've called p.dry.
>
> the error message I get is  "no finite arguments to min; returning Inf"
>
> The code is
>
> p.trans<-matrix(c(1,0,0,0,0,0,0.7,0.3,0,0,0,0,0,0.6,0.4,0,0,0,0,0,0.5,0.5,0,0,0,0,0,0.4,0.6,0,0,0,0,0,0.3,0.7),6,6)
>
> x<-ceiling(runif(100,0,5))
>
> trans<-function(x) {
> x.new<-vector(,length(x))
> for (i in 1:length(x)) {
> if (x[i]==0) x.new[i]<-0
> else
> cump<-(cumsum(p.trans[,(x[i]+1)])) # +1 b.c p.trans[,1] relates to
> min(x)==0
> names(cump)<-c("0","1","2","3","4","5")
> rand<-ceiling(runif(1,0,100))
> x.new[i]<-min(as.integer(names(cump[rand<(cump*100)])))
> }
> return(x,x.new)
> }
>
> 
> Dr Nick Bond
> Department of Biological Sciences
> Monash University (Clayton Campus)
> Victoria, Australia, 3800
> Ph: +61 3 9905 5606   Fax: +61 3 9905 5613
> Email:   [EMAIL PROTECTED]
> 

__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help


[R] R version conflict.

2003-03-03 Thread Bai Yan

Download R-1.6.2 source code package from http://cran.r-project.org and
compiled successfully.
When run library(grid), get error message as the R version is 1.5.1, and
cannot support grid package. The weird thing is that R.Version() returned
as this R is actualy 1.5.1

Did anybody get the same problem? or I made something wrong? Thanks.


> library(grid)
Error: This is R 1.5.1, package grid needs >= 1.6.0
> R.Version()
$platform
[1] "i686-pc-linux-gnu"

$arch
[1] "i686"

$os
[1] "linux-gnu"

$system
[1] "i686, linux-gnu"

$status
[1] ""

$major
[1] "1"

$minor
[1] "5.1"

$year
[1] "2002"

$month
[1] "06"

$day
[1] "17"

$language
[1] "R"

__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help


[R] transition matrix problem

2003-03-03 Thread Nick Bond
I'm having trouble using some fairly simple code to change the entries
in a vector (x - the numbers 0-5) according to a simple transition
matrix that I've called p.dry.  


the error message I get is 
"no finite arguments to min; returning Inf"

Any suggestions as to where I'm going wrong greatly appreciated. Sorry
the message is lengthy!

cheers
Nick


The code is 

p.trans<-matrix(c(1,0,0,0,0,0,0.7,0.3,0,0,0,0,0,0.6,0.4,0,0,0,0,0,0.5,0.5,0,0,0,0,0,0.4,0.6,0,0,0,0,0,0.3,0.7),6,6)

x<-ceiling(runif(100,0,5))

trans<-function(x) {
x.new<-vector(,length(x))
for (i in 1:length(x)) {
if (x[i]==0) x.new[i]<-0
else
cump<-(cumsum(p.trans[,(x[i]+1)])) # +1 b.c p.trans[,1] relates to
min(x)==0
names(cump)<-c("0","1","2","3","4","5")
rand<-ceiling(runif(1,0,100))
x.new[i]<-min(as.integer(names(cump[rand<(cump*100)])))
}
return(x,x.new)
}


Basically, in the transition matrix, the columns represent the current
cell entry in the vector (e.g. column 1 represents 0 (in the vector),
and the rows in the matrix are the possible transition states.  Hence,
cell entries in the transition matrix are the probabilities associated
with each transition.

The code works on the cumulative distribution of the relevant column of
the transition matrix, which is determined by the current cell value in
x.

-- 

Dr Nick Bond 
Department of Biological Sciences
Monash University (Clayton Campus)
Victoria, Australia, 3800
Ph: +61 3 9905 5606 Fax: +61 3 9905 5613
Email:   [EMAIL PROTECTED]


__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help


[R] lm, gee and lme

2003-03-03 Thread Bliese, Paul D MAJ WRAIR-Wash DC
Behavioral science data is often collected from nested structures (students
in schools, in districts, etc.). This can produce nonindependence among
responses from individuals in the same groups.  Consequently, researchers
are advised to model the nested nature of the data to avoid biases in SE
estimates.

Failing to account for nonindependence can lead to SE estimates that are too
large or too small depending ones model.  In the literature on linear mixed
effect models (lme) it is well documented that ignoring nonindependence
leads to SE values that are too small when the predictor varies only across
groups (is a level-2 predictor).  So, for instance, using linear regression
(lm) to regress individual performance (level-1 outcome) on group size
(level-2 predictor) using data where a lot of individuals come from the same
groups will lead to an SE value that is too small.  Using lme in this case
leads to a larger (and generally agreed upon as being less biased) SE
estimate.

What is trickier is what happens when both the predictor and outcome vary
among individuals in the same group.  An example of this type of model would
be one where individual performance is regressed upon individual age, but
where individual peformance is partially influenced by group membership.  My
understanding here is that ignoring nonindependence (i.e., using lm)
actually results in SE estimates that are too large, while modeling the
nonindependence reduces SE and increases power.

Here is an example:
# lme model
> mod.lme<-lme(GWB.ADD4~HOR,random=~1|GRP,data=TBH)
> VarCorr(mod.lme)
GRP = pdLogChol(1) 
Variance  StdDev   
(Intercept) 0.3160445 0.5621783
Residual0.7449425 0.8631005
> 0.3160445/(0.3160445+0.7449425)
[1] 0.2978778  #Note the large ICC (high nonindependence)

> summary(mod.lme)$tTable
Value  Std.Error   DF  t-value   p-value
(Intercept) 1.9846214 0.06819493 7282 29.10219 3.041808e-176
HOR 0.2493643 0.01189157 7282 20.96984  7.533401e-95

#lm model
> summary(mod.lm)$coef
 Estimate Std. Error  t value Pr(>|t|)
(Intercept) 1.9404202 0.04437889 43.72395 0.00e+00
HOR 0.2537195 0.01391557 18.23278 1.098509e-72

Notice the SE of .012 (lme) versus .014 (lm) and the higher t-value in lme.

These results make sense to me in that lme basically "sets aside" the
level-2 variance (tau) which is substantial in my example (see the high ICC
value).  As a result, the level-1 variable (HOR) only has to "explain"
level-1 variance (sigma-squared).  This means results in an increase in
power.

Now my questionwhy don't I see the same power increase if I use gee?
Notice below that the gee model SE values are basically identical to the lm
model values:

#gee model

>
mod.gee<-geese(GWB.ADD4~HOR,id=GRP,family="gaussian",corstr="exch",data=TBH)
> summary(mod.gee)
 Coefficients:
 estimate san.se wald p
(Intercept) 1.9847217 0.06992705 805.5802 0
HOR 0.2493582 0.01379557 326.7142 0

 Estimated Correlation Parameters:
   estimate san.se waldp
alpha 0.3176938 0.04224159 56.56357 5.440093e-14

The SE value in the gee model (0.0138) is virtually identical to the SE
value in the lm model ignoring the nonindependence (0.0139).  Note that the
alpha estimate of .32 in gee is close to the ICC estimate in the lme model
(are these basically the same?).

I would have expected lme and gee to provide more similar answers.  Any
thoughts on why gee and lme are not more similar would be appreciated as
would any clarification about when ignoring nonindepedence leads to too
small versus too large SE values

Paul

MAJ Paul Bliese, Ph.D.
Walter Reed Army Institute of Research
Phone: (301) 319-9873
Fax: (301) 319-9484
[EMAIL PROTECTED]

__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [despammed] RE: [R] multidimensional function fitting

2003-03-03 Thread Simon Wood

> 
> 8-) > 2) It is very memory hungry, esp. when using the s() function: I have 
> 8-) > 192Mb with 256Mb swap (not a lot, but reasonable I'd say), and I've
> 8-) > never had to kill R as often as when trying gam()...
> 8-) > 
> 8-) - do you have a very large number of data? The way mgcv works it first
> 8-) finds an "optimal" basis for smoothing and this will involve formation of
> 
>   Some 1 (x,y,z). For R, that doesn't strike me as particularly much.
- The point here is that the method being used by default requires storage
of a 1 by 1 matrix - it's not really an issue of whether 1 is
particularly much "for R". There is a cut and paste-able example for
getting around this at the end of the help file for gam()... gam will be
*much* faster and *much* less memory intensive if you use it. 

cheers,
Simon

__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help


RE: [R] multidimensional function fitting

2003-03-03 Thread Jim_Garrett


Have you considered fitting a neural net using the nnet package?  Since
nets are determined by a functional form that is straightforward
(recursive, but straightforward) and a set of coefficients (weights),
they're fairly easy to program from scratch.  There are no "exotic" (to
some) basis functions to deal with.  You can find descriptions sufficient
to guide coding in Venables and Ripley's _Modern Applied Statistics with
S-Plus_, Ripley's _Pattern Recognition and Neural Networks_, and also _The
Elements of Statistical Learning_ by Hastie, Tibshirani, and Friedman.
I've found each of these to be a good general reference, by the way--if
you're going to be dealing with "curve fitting" on more than this one
occasion, one or all of these would be good to have.  Ripley's pattern
recognition book naturally focuses on classification rather than general
curve-fitting, though many ideas are common to both.

Fitting a net will put more of a burden on you to optimize the model than
mgcv will.  I would suggest  the following guidelines (most of which I
learned from Ripley's pattern recognition book):
   Any net "fitting" should actually consist of multiple fits from random
   starting points--take the fit that minimizes the fitting criterion.
   Scale predictors if necessary to ensure that predictors are on similar
   scales.
   For curve fitting, use the options "linout = T" and "skip = T" (the
   latter is optional but recommended).
   You must optimize some criterion that keeps you from overfitting.  Two
   different techniques I have used successfully are
   (a)  choose the number of hidden units and weight decay parameter to
   optimize cross-validation performance, and
   (b)  choose the number of hidden units to optimize the Bayesian
   Information Criterion (BIC) (setting weight decay to zero).
   The former should give you better performance, but the latter is less
   work and usually works pretty well.  BIC penalizes the number of
   parameters, and here the "number of parameters" is taken to be the
   number of weights.  I could send you R code that automates this.
   Using weight decay > 0 generally improves predictive performance.  Once
   you have enough hidden units, you will not overfit if you use a suitable
   weight-decay parameter.  In fact, a reasonable strategy would be to use
   BIC to select the number of hidden units, then add (say) 2 hidden units
   and find weight-decay that optimizes cross-validation performance.

In short, mgcv makes model optimization convenient but has a price in
implementation, while neural nets make implementation convenient but have a
price in optimization.  I sometimes fit a model which is then implemented
by our Software Engineering group in C, and in that situation I prefer to
pay the price that falls only on me and which I can afford to pay.  Hence I
have used neural nets.  In fact early on I specified for our software group
a "neural net evaluator" C routine that takes some net architectural
parameters (number of inputs, hidden nodes, etc.) and weights in the order
that the nnet package displays them.  Now I can essentially fit a net with
package nnet, send someone the parameters, and they'll have it running in C
in short order.

Of course, GAM's also offer much in the way of model interpretation, and if
the phenomenon at hand obeys additivity, a GAM will outperform a neural
net.  I should add that I use the mgcv package frequently, and like it very
much.

Regarding computational resources, with some datasets I've fitted complex
GAM's, neural nets, and projection pursuit (ppr in package modreg), and
didn't notice much difference in a very rough, qualitative sense.  With
enough data, they all take a while.  I didn't investigate memory usage.  Of
course, gam and ppr are doing more work--gam is optimizing smoothness, and
ppr is fitting a range of models.  If you have so much data that none of
these are feasible,  you could do worse than fitting to a random subset.
How much precision do you need anyway?  And how complex a model do you
anticipate?  1000 cases or fewer is probably more than enough for most
regression problems.  Set aside the rest, and you have a large validation
set!  In fact you might fit multiple models, each to a random subset,
implement all the models, and average their responses.

Further along these lines, you could fit quite a few regression trees using
rpart because it's very fast.  You could even do thorough cross-validation
without great demands in time or memory.  A tree won't offer a smooth
response function, but if you average enough of them, the granularity of
response should be small.  Trees, like nets, are easy to code from scratch.
This just about describes bagging, except that the multiple subsets in
bagging are generated by bootstrap sampling, so are not mutually exclusive,
can contain cases more than once, and are of the same size as the original
data.

Good luck,

Jim Garrett
Becton Dickinson Diagnostic Systems
Baltimore, Mary

Re: [R] saving a plot to a file

2003-03-03 Thread Ko-Kang Kevin Wang
Hi,

- Original Message -
From: "Rajarshi Guha" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, March 04, 2003 6:03 AM
Subject: [R] saving a plot to a file


> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> Hi,
>   I'm a new user of R and have managed to make a plot of a histogram. Is
there
> any way I set the title and axes labels and then save the plot as an image
> (png/gif)?


To set the title/axis labels, one of the options is to use the main, xlab,
ylab parameters in hist().

For example:
> hist(1:10, main = "A Histogram", xlab = "FOO", ylab = "Fred")

As for save the plot, take a look at:
> ?png

Cheers,

Kevin


Ko-Kang Kevin Wang
Master of Science (MSc) Student
Department of Statistics
University of Auckland
New Zealand
www.stat.auckland.ac.nz/~kwan022

__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] optimization tools

2003-03-03 Thread Spencer Graves
Have you looked at optim?

Spencer Graves

Fan Zhang wrote:


Hi there,

Does R have solvers for linear, nonlinear and integer programming? Thanks,

-Fan

__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help
__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] saving a plot to a file

2003-03-03 Thread Uwe Ligges


Rajarshi Guha wrote:
> 
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
> 
> Hi,
>   I'm a new user of R and have managed to make a plot of a histogram. Is there
> any way I set the title and axes labels and then save the plot as an image
> (png/gif)?

This is a joke, isn't it?

What about
a) reading the manual "An Introduction to R" (in particular its Section
12: Graphical Procedures), 
b) reading the help pages for functions you are using,
c) using the help facilities to find functions you want to use,
d) looking for previous relevant messages in the R help archives,
e) looking into any other documentation or good book related to R.

Each one of the above mentioned methods helps!
Or for short: RTFM!

An annoyed voluntary help provider,
Uwe Ligges

 
> Thanks
> - --
> - ---
> Rajarshi Guha  <[EMAIL PROTECTED]> 
> GPG Fingerprint: 0CCA 8EE2 2EEB 25E2 AB04  06F7 1BB9 E634 9B87 56EE
> - ---

__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] ESS+R not closing gracefully

2003-03-03 Thread Damon Wischik

On Mon, 3 Mar 2003 [EMAIL PROTECTED] wrote:
> I think it is a Windows/Emacs issue.  That example works perfectly with
> Rterm --ess in a shell.  Some debugging shows that Rterm calls
> exit(status) and then fails to shut down.  So it is hanging in the C
> shutdown routines.  My guess is that as Emacs still has the file handles
> open it is using to communicate with Rterm, it is fighting with Windows to
> stop them being closed.
> 
> Not an R-help issue.

In case anyone (who doesn't read the ESS mailing list) is interested:  I
contacted the ESS mailing list, and was given the following disheartening
information.

Damon.

-
Date: Mon, 03 Mar 2003 06:25:11 -0800
From: "A.J. Rossini" <[EMAIL PROTECTED]>

It's an Emacs/Windows thing, that either R can fix or Emacs can fix.

1. The R folks don't have time right now,
2. we could talk to the Emacs folks,
3. it's not an ESS problem per say, but an ESS issue, since we
   leverage both R and Emacs.

conclusion -- it probably won't get fixed anytime soon, until someone
does some gory debugging of Emacs and R under Windows to understand
why/how file refs are staying open.  Sorry.

best,
-tony

__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] Tabulating

2003-03-03 Thread kjetil brinchmann halvorsen
On 3 Mar 2003 at 7:58, Anne York wrote:

> It seems that you are trying to obtain a tabulations of runs on length 2 in
> your vector. 
> 

If that is the case, rle (run length encoding) in base will do.
Try
?rle

Kjetil Halvorsen

> So for 
> 
>  data<-c(10,10,11,10,12,11,10,12,11,11,10,11)
> 
> #define data2 as:
> 
> data2 <- c(data[-1],NA)
> 
> # Then, on way to obain the runs is to use table on data and data2:
> 
>  table(data,data2)
> 
> 
> data2
> data 10 11 12
>   10  1  2  2
>   11  3  1  0
>   12  0  2  0
> 
> 
> I believe there is also a package written especially to do analyses of runs
> in data, but offhand, I don't recall the name of it.
> 
> Anne
> 
> ~~~
> Anne E. York
> National Marine Mammal Laboratory
> Seattle WA 98115-0070  USA
> e-mail: [EMAIL PROTECTED]
> Voice: +1 206-526-4039
> Fax: +1 206-526-6615
> ~~~
> 
> From: "Patrik Waldmann" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Date: Fri, 28 Feb 2003 12:09:38 +0100
> Subject: [R] Tabulating
> 
> Hello,
> 
> I wonder if someone could send me suggestions on how to solve the following
> problem:
> 
> I have a vector of an arbitrary size (ex.
> data<-c(10,10,11,10,12,11,10,12,11,11,10,11))
> and use the table function, which gives the following result
> 10  11  12
> 55 2
> 
> that's fine, but what I would like to do now is: 
> 
> construct new classes based on the number of classes from table, 10 10, 11
> 11, 12 12, 10
> 11, 10 12, 11 12. After that I would like to do tabulation on the pairs in
> data, and
> positions in pairs should be unimportant: 10 11 should be treated as the
> same class as 11
> 10.
> So the following result should be obtained:
> 10 10, 11 11, 12 12, 10 11, 10 12, 11 12
> 1 , 1 , 0 , 2 , 1 , 2
> 
> Remeber that it should be possible to do for an arbitrary number of
> classes.
> 
> Best regards,
> 
> [EMAIL PROTECTED]
> 
> __
> [EMAIL PROTECTED] mailing list
> http://www.stat.math.ethz.ch/mailman/listinfo/r-help

__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] Tabulating

2003-03-03 Thread Anne York
It seems that you are trying to obtain a tabulations of runs on length 2 in
your vector. 

So for 

 data<-c(10,10,11,10,12,11,10,12,11,11,10,11)

#define data2 as:

data2 <- c(data[-1],NA)

# Then, on way to obain the runs is to use table on data and data2:

 table(data,data2)


data2
data 10 11 12
  10  1  2  2
  11  3  1  0
  12  0  2  0


I believe there is also a package written especially to do analyses of runs
in data, but offhand, I don't recall the name of it.

Anne

~~~
Anne E. York
National Marine Mammal Laboratory
Seattle WA 98115-0070  USA
e-mail: [EMAIL PROTECTED]
Voice: +1 206-526-4039
Fax: +1 206-526-6615
~~~

From: "Patrik Waldmann" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Date: Fri, 28 Feb 2003 12:09:38 +0100
Subject: [R] Tabulating

Hello,

I wonder if someone could send me suggestions on how to solve the following
problem:

I have a vector of an arbitrary size (ex.
data<-c(10,10,11,10,12,11,10,12,11,11,10,11))
and use the table function, which gives the following result
10  11  12
55 2

that's fine, but what I would like to do now is: 

construct new classes based on the number of classes from table, 10 10, 11
11, 12 12, 10
11, 10 12, 11 12. After that I would like to do tabulation on the pairs in
data, and
positions in pairs should be unimportant: 10 11 should be treated as the
same class as 11
10.
So the following result should be obtained:
10 10, 11 11, 12 12, 10 11, 10 12, 11 12
1 , 1 , 0 , 2 , 1 , 2

Remeber that it should be possible to do for an arbitrary number of
classes.

Best regards,

[EMAIL PROTECTED]

__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] 'methods' and "[<-"

2003-03-03 Thread John Chambers
Laurent Gautier wrote:
> 
> Dear List,
> 
> I am trying to override the replace method "[<-" for
> objects of class "matrix"... with little success...
> 
> Would anyone know where I am wrong ?

Not wrong at all.  The problem is that "matrix" (and "array") are
implicit classes in R--there is no explicit class attribute, just as
there is not for the basic vector types,  "character", etc.

The effect is that methods for these data types are fixed for primitive
functions.  The internal code that dispatches methods will jump out
right away for these objects.  The argument in favor of not allowing
redefinition is partly efficiency and partly (perhaps the more important
part) that users should really be able to take the definition of
subsetting, arithmetic, and other basic operations as known and fixed
for the basic data types.

The "matrix" and "array" data types are slightly less basic, but in R
they are special and sort of built in.

Anyway,this is either a feature (in which case we'll modify the
setMethod code to throw an error) or something that might be changed.

It's no consolation, but I don't believe you can define S3-style methods
for the same combination of function and data type either.

> 
> > library(methods)
> > setReplaceMethod("[", "matrix", function(x, i, j, ..., value) {cat("I'm here.\n")})
> [1] "[<-"
> > m <- new("matrix", 0, 5, 2)
> > m[1,1] <- 2
> >
> # ..did not use my new method it seems
> 
> Thanks,
> 
> L/
> 
> PS: I am using R-1.6.2
> 
> __
> [EMAIL PROTECTED] mailing list
> http://www.stat.math.ethz.ch/mailman/listinfo/r-help

-- 
John M. Chambers  [EMAIL PROTECTED]
Bell Labs, Lucent Technologiesoffice: (908)582-2681
700 Mountain Avenue, Room 2C-282  fax:(908)582-3340
Murray Hill, NJ  07974web: http://www.cs.bell-labs.com/~jmc

__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] tcltk makes R crash?

2003-03-03 Thread Dirk Eddelbuettel
On Mon, Mar 03, 2003 at 01:14:04PM +0100, Kurt Sys wrote:
> I got a problem using the tcltk-package. It makes 'R crash':
> I can use R and different packages without any problem. However, when I start the 
> tcltk-package, the terminal I'm running R in (no matter what this 'terminal' is), 
> will not recieve any input anymore once I set at statement which cannot be 
> evaluated. The most easy example:
> > library(tcltk)
> > blabla
> Error: Object "blabla" not found
> > 
> 
> So, when I give these two commands, the only thing I can do (with the terminal I run 
> R in), is 'kill client' (which is the terminal).
[...] 
> I'm using Debian woody, R 1.6.2.

That sounds really odd.  

How did you get 1.6.2 onto Debian 3.0 ("woody")? One thing you could try is
to install the (older) Debian R package from the same Debian 3.0 release,
which should execute the sequence above cleanly.  You could then proceed 
in increments:  a) rebuild that R version locally on your woody machine
to demonstrate that it still works given your libraries, and then b) grab
the 1.6.2 source and build the Debian package locally against the same
setup as in a). That is bound to work "almost surely".

Let me know (off the list) if I can help with a) or b).

Dirk

-- 
Prediction is very difficult, especially about the future. 
 -- Niels Bohr

__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] Turning a string into an expression

2003-03-03 Thread Stephen C. Upton
Soren,

try
eval(parse(text=aaa))

HTH
steve

Søren Højsgaard wrote:

> Dear all,
> I have e.g.
> aaa <- "list(1,2,3,4)"
> and would like to get a hold on the list
> list(1,2,3,4)
> from aaa. Can anyone help with that?
> Best regards
> Søren Højsgaard
>
> __
> [EMAIL PROTECTED] mailing list
> http://www.stat.math.ethz.ch/mailman/listinfo/r-help

__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] Turning a string into an expression

2003-03-03 Thread Uwe Ligges
Søren Højsgaard wrote:
Dear all,
I have e.g. 
	aaa <- "list(1,2,3,4)" 
and would like to get a hold on the list 
	list(1,2,3,4)
from aaa. Can anyone help with that?
Best regards 
Søren Højsgaard
Try
 parse(text=aaa)
for the expression and
 eval(parse(text=aaa))
to evaluate it.
Uwe Ligges

__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] Turning a string into an expression

2003-03-03 Thread ripley
> aaa <- "list(1,2,3,4)"
> parse(text=aaa)
expression(list(1, 2, 3, 4))

On Mon, 3 Mar 2003, Søren Højsgaard wrote:

> Dear all,
> I have e.g. 
>   aaa <- "list(1,2,3,4)" 
> and would like to get a hold on the list 
>   list(1,2,3,4)
> from aaa. Can anyone help with that?

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help


[R] Turning a string into an expression

2003-03-03 Thread Søren Højsgaard
Dear all,
I have e.g. 
aaa <- "list(1,2,3,4)" 
and would like to get a hold on the list 
list(1,2,3,4)
from aaa. Can anyone help with that?
Best regards 
Søren Højsgaard

__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] extract R information

2003-03-03 Thread Martin Maechler
Note: Please always set a "Subject" in e-mails, particularly to
   mailing lists!

> "SteveM" == Steve Moore <[EMAIL PROTECTED]>
> on Mon, 03 Mar 2003 12:12:16 + writes:

SteveM> Dear Everyone,

SteveM> I am a novel user of the R package (less than a
SteveM> week).  I am using the package to analyse some
SteveM> microarray data.  I have successfully imported the
SteveM> data, and manipulated it, resulting in additional
SteveM> columns of data.  However, I now want to extract all
SteveM> this new information from R for use outside the
SteveM> package.  Can anyone tell me of any commands that
SteveM> would allow me to accomplish this?

>From what you tell us,  write.table() might come handy; see also
write() and the whole "R Data Import/Export" Manual -- available
e.g. from the R home page, or also via help.start().

Martin Maechler <[EMAIL PROTECTED]> http://stat.ethz.ch/~maechler/
Seminar fuer Statistik, ETH-Zentrum  LEO C16Leonhardstr. 27
ETH (Federal Inst. Technology)  8092 Zurich SWITZERLAND
phone: x-41-1-632-3408  fax: ...-1228   <><

__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help


[R] tcltk makes R crash?

2003-03-03 Thread Kurt Sys
Hello all,

I got a problem using the tcltk-package. It makes 'R crash':
I can use R and different packages without any problem. However, when I start the 
tcltk-package, the terminal I'm running R in (no matter what this 'terminal' is), will 
not recieve any input anymore once I set at statement which cannot be evaluated. The 
most easy example:
> library(tcltk)
> blabla
Error: Object "blabla" not found
> 

So, when I give these two commands, the only thing I can do (with the terminal I run R 
in), is 'kill client' (which is the terminal).

Sometimes (I didn't find any logic yet), I cannot see the commands I'm writing, but 
they are evaluated anyway (so I can quit etc, using the command 'q()', but what I 
write is not shown on the screen and when I'm out of R, this behaviour doesn't change 
for the terminal I ran R in).

I'm using Debian woody, R 1.6.2.

Anyone any idea?

thanks in advance,
Kurt

__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help


[R] (no subject)

2003-03-03 Thread Steve Moore
Dear Everyone,

I am a novel user of the R package (less than a week).  I am using the 
package to analyse some microarray data.  I have successfully imported the 
data, and manipulated it, resulting in additional columns of data.  However, 
I now want to extract all this new information from R for use outside the 
package.  Can anyone tell me of any commands that would allow me to 
accomplish this?

Many thanks in advance

Stephen Moore.





_
Chat online in real time with MSN Messenger http://messenger.msn.co.uk
__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] density(): obtaining p-values

2003-03-03 Thread Frank E Harrell Jr
On Mon, 3 Mar 2003 12:40:37 +0100
"Pfaff, Bernhard" <[EMAIL PROTECTED]> wrote:

> Dear R-List-Member,
> 
> is there a more elegant way to obtain p-values of a vector x, whose
> empirical density has been estimated with density(), than summing up the
> rectangles as an approximation of the area beneath the empirical
> distribution function and interpolating the values of x by using approx()?
> 
> pval.emp <- function(x)
>   {
>df <- density(x,from=min(x),to=max(x),kernel="gaussian")
>width <- df$x[2]-df$x[1]
>rect <- df$y*width
>cdf.emp <- cumsum(rect)
>approx(df$x,cdf.emp,x)$y
>   }
> 
> Many thks in advance,
> Bernhard
> 
>

You may want to refer to this just as "probability" and not "p-values".  It may not be 
fruitful to fit a density if what you want is cumulative probabilities.   Just compute 
the empirical cumulative distribution function of the original x:

library(stepfun)
ecdf(x)

-- 
Frank E Harrell Jr  Prof. of Biostatistics & Statistics
Div. of Biostatistics & Epidem. Dept. of Health Evaluation Sciences
U. Virginia School of Medicine  http://hesweb1.med.virginia.edu/biostat

__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help


[R] density(): obtaining p-values

2003-03-03 Thread Pfaff, Bernhard
Dear R-List-Member,

is there a more elegant way to obtain p-values of a vector x, whose
empirical density has been estimated with density(), than summing up the
rectangles as an approximation of the area beneath the empirical
distribution function and interpolating the values of x by using approx()?

pval.emp <- function(x)
  {
   df <- density(x,from=min(x),to=max(x),kernel="gaussian")
   width <- df$x[2]-df$x[1]
   rect <- df$y*width
   cdf.emp <- cumsum(rect)
   approx(df$x,cdf.emp,x)$y
  }

Many thks in advance,
Bernhard




--
If you have received this e-mail in error or wish to read our e-mail 
disclaimer statement and monitoring policy, please refer to 
http://www.drkw.com/disc/email/ or contact the sender.
--

__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] qda plots

2003-03-03 Thread Christian Hennig
Hi,

there are some dimension reduction methods (somewhat analogous to linear
discriminants) which show groups as separated not only in means, but also
in covariance matrices. This might correspond well to a qda problem.
References are

Young, Marco and Odell, Journal of Statistical Planning and Inference, 17
(1987), 307-319
Fukunaga, Introduction to Statistical Pattern Recognition (2nd ed, p. 455
ff.), Academic Press, 1990.

As I am working recently on more flexible discriminant plots, you may also
consider my technical report on
ftp://ftp.stat.math.ethz.ch/Research-Reports/108.html
where the above mentioned methods are explained as well.
My package fpc on 
http://www.math.uni-hamburg.de/home/hennig/fixreg/fixreg.html
includes an R implementation of the method of Fukunaga 
("Bhattacharyya coordinates"). I have also R code for the method of Young
et al., but it is not yet "packaged", so you would have to contact me directly
if you would be interested in a (poorly documented) version.

Best,
Christian

On Thu, 27 Feb 2003, Power, Anne Marie wrote:

> Hi,
> 
> I have been using some of the functions in r for classification purposes,
> chiefly lda, qda, knn and nnet.
> My problem is that the only one I can figure out how to represenent
> graphically is lda (using plot.lda).  I have tried 'fooling' this function
> into accepting qda input for plotting but to no avail.  I wonder if you have
> any suggestions?
> 
> Thanks alot,
> 
> Anne Marie Power
> 
> Marine lab.
> Dept. Zooogy & Animal Ecology,
> University College Cork
> Ireland
> 
> __
> [EMAIL PROTECTED] mailing list
> http://www.stat.math.ethz.ch/mailman/listinfo/r-help
> 

-- 
***
Christian Hennig
Seminar fuer Statistik, ETH-Zentrum (LEO), CH-8092 Zuerich (currently)
and Fachbereich Mathematik-SPST/ZMS, Universitaet Hamburg
[EMAIL PROTECTED], http://stat.ethz.ch/~hennig/
[EMAIL PROTECTED], http://www.math.uni-hamburg.de/home/hennig/
###
ich empfehle www.boag.de

__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help


RE: [R] multidimensional function fitting

2003-03-03 Thread Simon Wood

> On Thu, 27 Feb 2003 13:52:50 -0500, "Wiener, Matthew" <[EMAIL PROTECTED]> wrote 
> regarding
> "[despammed] RE: [R] multidimensional function fitting"
> 
> 8-) Take a look at package mgcv.  Hope this helps.  --Matt
> 8-) 
> 
> Thank you, I just did. It may indeed be what I'm looking for (I haven't 
>quite understood everything about it...), but:
> 
> 1) The best fits I obtain with a formula like z~s(x,y) ; but this I cannot 
> possibly transport into the C programme where I need it! Maybe I wasn't
> clear on this aspect?
- Yes, this won't be entirely straightforward, but note that the
underlying code in mgcv is written in C, so it would be possible...

> 
> 2) It is very memory hungry, esp. when using the s() function: I have 
> 192Mb with 256Mb swap (not a lot, but reasonable I'd say), and I've
> never had to kill R as often as when trying gam()...
> 
- do you have a very large number of data? The way mgcv works it first
finds an "optimal" basis for smoothing and this will involve formation of
a matrix of size n^2 where n is your number of data The last couple of
examples in the ?gam help file show how to avoid this using the "knots"
argument to gam: basically you find a "near optimal" basis for a random
subset of your data, and then use this basis to do the smoothing on the
whole data set. (Can you let me know if this solves the problem/isn't the 
issue). 

best,
Simon

_
> Simon Wood [EMAIL PROTECTED]www.stats.gla.ac.uk/~simon/
>>  Department of Statistics, University of Glasgow, Glasgow, G12 8QQ
>>>   Direct telephone: (0)141 330 4530  Fax: (0)141 330 4814

__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] ESS+R not closing gracefully

2003-03-03 Thread ripley
I think it is a Windows/Emacs issue.  That example works perfectly with
Rterm --ess in a shell.  Some debugging shows that Rterm calls
exit(status) and then fails to shut down.  So it is hanging in the C
shutdown routines.  My guess is that as Emacs still has the file handles
open it is using to communicate with Rterm, it is fighting with Windows to
stop them being closed.

Not an R-help issue.

On Sun, 2 Mar 2003, John Fox wrote:

> Dear Tony and Damon,
> 
> I, too, have seen this problem (and other similar problems) occasionally. I 
> don't really understand the source of the problem, but I think that it 
> involves synchronization issues, and I find that inserting delays between 
> operations seems to help. Take a look, for example, at the configuration 
> files I've posted at 
> , in particular 
> the menu items for exiting. Finally, I find that problems are less common 
> with Windows 2000 than with Windows 9x, but I gather this isn't your 
> experience.
> 
> I hope that this helps,
>   John
> 
> At 10:49 AM 3/2/2003 -0800, A.J. Rossini wrote:
> >Damon Wischik <[EMAIL PROTECTED]> writes:
> >
> >
> > > I am having trouble with ESS+R. I don't know if it is an ESS
> > > problem or an R problem, so I'm posting to this mailing list in
> > > the first instance.
> >
> >Actually, it might be an Emacs problem -- or an R problem.  The fact
> >that R/ESS works under windows is simply amazing.
> >
> >Unfortunately, while I've seen it, I'm not sure how to solve it; it
> >isn't your configuration.

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: AW: Re: [R] Q: Best-Practice for Swing-GUI calling R-code onWindows?

2003-03-03 Thread ripley
Looks like a bug in your Java example.  Not that R-help is the 
right list for SJava questions, let alone Java programming ones.

I would

1) check out the SJava/examples/tdist.R example.
2) recompile from sources if 1) fails.

We really cannot debug your Windows setup remotely: all I can say is that
SJava.zip has run hundreds of examples in the last week on three different 
Windows XP machines.

On Mon, 3 Mar 2003, Till Baumgaertel wrote:

> Thank you for the new SJava-binary!
> 
> But I am sorry, it won't work on my environment (Win XP pro, R 1.6.2., all
> Jars in the CLASSPATH, SJava.dll in the PATH, R.DLL in the PATH). This time
> the error looks totally different, but I don't have a clue what's wrong.
> Could you give me a hint again?

You could check the setup instructions in my ReadMe, as that is not what 
it says to do.

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help


RE: [R] model.frame.default problem in function definition

2003-03-03 Thread Darryl Greig
Thanks, the new stepAIC does the job.

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of
[EMAIL PROTECTED]
Sent: Sunday, March 02, 2003 6:14 PM
To: Darryl Greig
Cc: [EMAIL PROTECTED]
Subject: Re: [R] model.frame.default problem in function definition


This works in R-devel, for which NEWS says

o   step(), add1.default() and drop1.default() now work somewhat
better if called from a function.

It's mainly a scoping problem, related to changes made way back in 1.2.x.

However, it is also an bad example, as z is really excluded in the fit.
stepAIC in the latest MASS (VR_7.0-11) will work, but warns about this.
I hope that this is just an over-simplification of the real problem.

On Sun, 2 Mar 2003, Darryl Greig wrote:

> Could someone point me in the right direction for the following issue:
> 
> A function is defined as follows:
> 
>   tfun <- function(dat)
> {
>   fmla <- as.formula("y~x+z")
>   dat2 <- dat
>   mdl <- lm(fmla,dat2)
>   mdl <- step(mdl)
> }
> 
> Then the following code
> 
>   dat <- data.frame(x=1:10,z=1:10,y=(1:10)^2+10*(1:10))
>   tfun(dat)
> 
> generates the output
> 
>   Start:  AIC= 43.67
>y ~ x + z
> 
>   Error in model.frame.default(formula = y ~ z, data = dat2,
> drop.unused.levels = TRUE) :
>   Object "dat2" not found
> 
> Any help or pointers gratefully accepted.
> 
> Thanks,
> Darryl Greig ([EMAIL PROTECTED])
> 
> __
> [EMAIL PROTECTED] mailing list
> http://www.stat.math.ethz.ch/mailman/listinfo/r-help
> 

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help

__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help


AW: Re: [R] Q: Best-Practice for Swing-GUI calling R-code on Windows?

2003-03-03 Thread Till Baumgaertel
Thank you for the new SJava-binary!

But I am sorry, it won't work on my environment (Win XP pro, R 1.6.2., all
Jars in the CLASSPATH, SJava.dll in the PATH, R.DLL in the PATH). This time
the error looks totally different, but I don't have a clue what's wrong.
Could you give me a hint again?

thanks,
till

The error:

An unexpected exception has been detected in native code outside the VM.
Unexpected Signal : EXCEPTION_ACCESS_VIOLATION occurred at PC=0xAED86D0
Function=R_SetMaxNSize+0xD0
Library=C:\Programme\R\rw1062\bin\R.dll

Current Java thread:
at org.omegahat.R.Java.REvaluator.eval(Native Method)
at org.omegahat.R.Java.REvaluator.eval(REvaluator.java:86)
at org.omegahat.R.Java.REvaluator.eval(REvaluator.java:36)
at SJavaTest.Main.main(Main.java:20)

Dynamic libraries:
0x0040 - 0x00406000 C:\Programme\Java\j2re1.4.1_01\bin\java.exe
0x77F4 - 0x77FF C:\WINDOWS\System32\ntdll.dll
0x77E4 - 0x77F37000 C:\WINDOWS\system32\kernel32.dll
0x77DA - 0x77E3A000 C:\WINDOWS\system32\ADVAPI32.dll
0x77C9 - 0x77D05000 C:\WINDOWS\system32\RPCRT4.dll
0x77BE - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll
0x6D33 - 0x6D45A000 C:\Programme\Java\j2re1.4.1_01\bin\client\jvm.dl
l
0x77D1 - 0x77D96000 C:\WINDOWS\system32\USER32.dll
0x77C4 - 0x77C8 C:\WINDOWS\system32\GDI32.dll
0x76AF - 0x76B1D000 C:\WINDOWS\system32\WINMM.dll
0x1000 - 0x1000D000 C:\WINDOWS\System32\hplun.dll
0x6D1D - 0x6D1D7000 C:\Programme\Java\j2re1.4.1_01\bin\hpi.dll
0x6D30 - 0x6D30D000 C:\Programme\Java\j2re1.4.1_01\bin\verify.dll
0x6D21 - 0x6D229000 C:\Programme\Java\j2re1.4.1_01\bin\java.dll
0x6D32 - 0x6D32D000 C:\Programme\Java\j2re1.4.1_01\bin\zip.dll
0x0AE2 - 0x0AE37000 C:\Programme\R\rw1062\library\SJava\libs\SJava.d
ll
0x0AE4 - 0x0B02E000 C:\Programme\R\rw1062\bin\R.dll
0x0B03 - 0x0B051000 C:\Programme\R\rw1062\bin\Rblas.dll
0x7731 - 0x7739B000 C:\WINDOWS\system32\COMCTL32.DLL
0x7635 - 0x76396000 C:\WINDOWS\system32\COMDLG32.DLL
0x772A - 0x77303000 C:\WINDOWS\system32\SHLWAPI.dll
0x6980 - 0x69FF8000 C:\WINDOWS\system32\SHELL32.dll
0x77BD - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll
0x7195 - 0x71A34000 C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-C
ontrols_6595b64144ccf1df_6.0.0.0_x-ww_1382d70a\comctl32.dll
0x76C5 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll
0x6DA0 - 0x6DA7C000 C:\WINDOWS\system32\DBGHELP.dll
0x76BB - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL

Local Time = Mon Mar 03 10:38:21 2003
Elapsed Time = 1
#
# The exception above was detected in native code outside the VM
#
# Java VM: Java HotSpot(TM) Client VM (1.4.1_01-b01 mixed mode)
#
# An error report file has been saved as hs_err_pid2508.log.
# Please refer to the file for further information.
#

__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] using data() in an example

2003-03-03 Thread ripley
I agree, and BTW the sort order is the same in locale en_GB on Linux and
Solaris, so this is a common trap.  I could understand CcRr as a sort 
order (it's dictionary order), but cCrR is hard to accept.

I think that RedHat 7.x/8.0 sets up locale en_GB as the default in the
UK: I keep on having to remember to change it on our boxes.

I had made a note to look into data().

Meanwhile the best fix is to save the object and use bailey.rda (and 
nothing else).

On 3 Mar 2003, Peter Dalgaard BSA wrote:

> [EMAIL PROTECTED] writes:
> 
> > ?data says
> > 
> > 4.  files ending `.csv' are read using `read.table(..., header
> >= TRUE, sep = ";")', and also result in a data frame.
> > 
> > That may well be found first, so you need to rename bailey.csv.
> > 
> > You don't tell us your OS, but it looks like Windows where sorts often 
> > have c before R in the default locale:
> 
> Yikes! Thanks for pointing this out, Brian. 
> 
> I think we should consider it a bug(-let) and change data() to ensure
> that .R files are found before any other extensions, exactly because
> of this sort of application.
> 
> 

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] using data() in an example

2003-03-03 Thread Peter Dalgaard BSA
[EMAIL PROTECTED] writes:

> ?data says
> 
> 4.  files ending `.csv' are read using `read.table(..., header
>= TRUE, sep = ";")', and also result in a data frame.
> 
> That may well be found first, so you need to rename bailey.csv.
> 
> You don't tell us your OS, but it looks like Windows where sorts often 
> have c before R in the default locale:

Yikes! Thanks for pointing this out, Brian. 

I think we should consider it a bug(-let) and change data() to ensure
that .R files are found before any other extensions, exactly because
of this sort of application.

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

__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] using data() in an example

2003-03-03 Thread ripley
?data says

4.  files ending `.csv' are read using `read.table(..., header
   = TRUE, sep = ";")', and also result in a data frame.

That may well be found first, so you need to rename bailey.csv.

You don't tell us your OS, but it looks like Windows where sorts often 
have c before R in the default locale:
> sort(c(letters, LETTERS))
 [1] "a" "A" "b" "B" "c" "C" "d" "D" "e" "E" "f" "F" "g" "G" "h" "H" "i" "I" "j"
[20] "J" "k" "K" "l" "L" "m" "M" "n" "N" "o" "O" "p" "P" "q" "Q" "r" "R" "s" "S"
[39] "t" "T" "u" "U" "v" "V" "w" "W" "x" "X" "y" "Y" "z" "Z"


On Sun, 2 Mar 2003, Christopher Adolph wrote:

> 
> Hi all,
> 
> I'm trying to put together examples in an R package, and am having trouble
> reading data from the package's data directory.  The data are in
> comma-separated variable files, so to read a file like gw.csv, I include
> in the data directory both bailey.csv and a file bailey.R which contains:
> 
> bailey <- read.csv("bailey.csv",na.strings=".");
> 
> so that typing
> 
> data(bailey)
> 
> should load the data from bailey.csv.
> 
> The problem is that the data is being read in "wrong", as a single column,
> rather than a data frame with four columns.  I get:
> 
>data.p1.p2.model
> 10.57,2,1,1
> 20.54,4,1,1
> 30.54,6,1,1
> 40.52,8,1,1
> 5   0.54,10,1,1
> 6   0.53,50,1,1
> 70.93,2,1,2
> 80.61,4,1,2
> 90.53,6,1,2
> 10   0.49,8,1,2
> 11  0.43,10,1,2
> 12  0.11,50,1,2
> 13   0.89,2,1,3
> 14   0.72,4,1,3
> 15   0.62,6,1,3
> 16   0.58,8,1,3
> 17  0.49,10,1,3
> 18  0.12,50,1,3
> 19   0.51,2,1,4
> 20   0.43,4,1,4
> 21   0.41,6,1,4
> 22   0.37,8,1,4
> 23  0.37,10,1,4
> 24  0.31,50,1,4
> 
> Which is wrong.  But if I use the very same command as above, but from the
> command line (without the data() wrapper), it comes in right:
> 
> > read.csv("c:/progra~1/R/library/seemc/data/bailey.csv",na.strings=".")
>data p1 p2 model
> 1  0.57  2  1 1
> 2  0.54  4  1 1
> 3  0.54  6  1 1
> 4  0.52  8  1 1
> 5  0.54 10  1 1
> 6  0.53 50  1 1
> 7  0.93  2  1 2
> 8  0.61  4  1 2
> 9  0.53  6  1 2
> 10 0.49  8  1 2
> 11 0.43 10  1 2
> 12 0.11 50  1 2
> 13 0.89  2  1 3
> 14 0.72  4  1 3
> 15 0.62  6  1 3
> 16 0.58  8  1 3
> 17 0.49 10  1 3
> 18 0.12 50  1 3
> 19 0.51  2  1 4
> 20 0.43  4  1 4
> 21 0.41  6  1 4
> 22 0.37  8  1 4
> 23 0.37 10  1 4
> 24 0.31 50  1 4
> >
> 
> What could be causing this?  I just want to get the example working; in
> practice one wouldn't need to use the data() command for this package, but
> it seems to be the only reliable way to get stuff out of the data
> directory for running examples.  Any ideas?

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] Use Rterm in rxvt for Cygwin?

2003-03-03 Thread ripley
Rterm is a Windows application.  It works fine in Windows tcsh and in 
Cygwin bash on Windows XP (and last time I looked, Windows 98 too).

I find that rxvt.exe does not work at all well on Windows XP. You should
send bug reports on it to Cygwin, not R.

There is an R console  Rgui, and the principal function of Rterm is to 
provide a batch use of R.  If you insist on using a long-obselete and 
primitive version of Windows, please use RGui.

On Sun, 2 Mar 2003, Paul Y. Peng wrote:

> Dear R users,
> 
> Does anyone notice that Rterm.exe does not work well with rxvt.exe,
> an xterm emulator for Cygwin? It produces an error message window
> with the following message:
> 
> This program has performed an illegal operation
> and will be shut down.
> If the problem persists, contact the program vendor

That's rxvt, not Rterm.

> It also prints "Signal 127" in rxvt window.
> 
> Rterm --ess, however, works. But its command line editing is awful
> because it is for Emacs, not for a shell window.

No, there is no command-line editing at all and it is dangerous to use 
modes like that other than for their documented purpose.

> Rterm.exe works well in a MS-DOS window. Because of limitations
> of the MS-DOS window, I would like to use Rterm.exe in an rxvt
> window. I am using R-1.6.2 and rxvt-2.7.2 on Win98se. Thanks for
> any comments.

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] samin and vmmin

2003-03-03 Thread ripley
nnet in bundle VR.

On Sun, 2 Mar 2003, Susan Shortreed wrote:

> I am writing code in C and would like to call R's functions samin and
> vmmin (optimization routines: simulated annealing and BFGS)
> 
> I do not understand how to create and pass in the function (as well as the
> extra arguments it needs) I am optimizing.
> I have read the R Extensions manual but it is still unclear to me.
> 
> Could you give me some pointers and/or direct me to some example code
> which calls one of the optimizer functions and includes the definition of
> the function to be optimized?

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help