[R] MASS package and lda

2003-12-30 Thread Sean Davis
I'm sorry if I am missing something, but I am looking for the lda function and can't 
find it (used to be in MASS).  I know there is reorganization going on for R-1.9 and 
expected to find lda in stats, but I didn't.  Do I need to go back to R-1.8.1 or is 
there an lda function lurking that I haven't found yet for R-1.9.0?  In any case, are 
there other significant functions that currently are not included in R-devel (R-1.9.0) 
of which us users should be aware?

Thanks,
Sean

[[alternative HTML version deleted]]

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


Re: [R] regexp problem on R 1.7.0

2003-12-30 Thread Gabor Grothendieck


Just as an elaboration, this might help further clarify it.
Spit displays each character in x -- one per line.

> spit <- function(x) for(i in 1:nchar(x)) cat(i,substring(x,i,i),"\n")
> spit("e\+06") # note that the resulting string does not contain \
1 e 
2 + 
3 0 
4 6 
> spit("e\\+06") # this time its there
1 e 
2 \ 
3 + 
4 0 
5 6 
 
Date: Tue, 30 Dec 2003 21:50:27 + (GMT) 
From: Prof Brian Ripley <[EMAIL PROTECTED]>
To: Itay Furman <[EMAIL PROTECTED]> 
Cc: <[EMAIL PROTECTED]> 
Subject: Re: [R] regexp problem on R 1.7.0 

 
 
In R (and C) \ must be escaped in a character string.
This is mentioned on the help page.

On Tue, 30 Dec 2003, Itay Furman wrote:

> 
> Hi,
> 
> Am I missing something in using regexps in R?
> Below, 'egrep' means invokation of the command from the shell 
> prompt.
> 
> # I have
> > as.character(block.dist.vals)
> [1] "1e+06" "2e+06" "5e+06"
> # that I wish to convert to: "1" "2" "5"
> 
> # OK (R and egrep)
> > sub( "e.+06", "", as.character(block.dist.vals) )
> [1] "1" "2" "5"
> # OK (R), egrep will *not* match pattern
> > sub( "e\\+06", "", as.character(block.dist.vals) )
> [1] "1" "2" "5"
> 
> # egrep will match pattern; R will not.
> > sub( "e\+06", "", as.character(block.dist.vals) )
> [1] "1e+06" "2e+06" "5e+06"
> 
> As-far-as I can tell the last attempt should have worked, too.
> Could someone explain to me why it doesn't?
> 
> I have R 1.7.0 on RedHat 9.
> 
> Thanks in advance,
>  Itay Furman
> 
> =
>Fred Hutchinson Cancer Research Center
> email: [EMAIL PROTECTED]  1100 Fairview Avenue N., Mailstop D4-100
> phone: +1 (206) 667 5921 P.O. Box 19024
> fax: +1 (206) 667 2917 Seattle, WA 98109-1024
> 
> __
> [EMAIL PROTECTED] mailing list
> https://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, UK Fax: +44 1865 272595

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

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


Re: [R] floor of n observations in number generators

2003-12-30 Thread Peter Dalgaard
"Marcus Davy" <[EMAIL PROTECTED]> writes:

> I couldnt find a previous posting on this in the archives, maybe it has
> already been mentioned.
> 
> If you use a calculation to generate n observations in random number
> generators and you don't round to the nearest integer you may be
> generating n-1 numbers not n numbers as you thought depending on the
> storage precision of the calculation. 
> 
> e.g.
> > m <- 1000
> > pi0 <- 0.9
> > length(rnorm(m * (1-pi0)))
> [1] 99  # Should be 100
> > options(digits=16)
> > m * (1-pi0)
> [1] 99.97
> > identical(m*(1-pi0), 100)
> [1] FALSE
> 
> Random number generation generates the floor of n observations, this
> feature occurs on R-1.8.1 on linux Redhat8, and winXP (also on Unix
> SPlus 3.4) 
> for probably all of the random number generators.

Nothing to do with random number generation, everything to do with
coercion of floats to integers. Hence, e.g.

> as.integer(100*(1-0.9))
[1] 9
> numeric(100*(1-0.9))
[1] 0 0 0 0 0 0 0 0 0

There are a couple of places where we do have hidden fuzz factors
because people were getting bitten by imprecision effects a bit too
easily, like in

> 1:(100*(1-0.9))
 [1]  1  2  3  4  5  6  7  8  9 10

but in general we use the standard C rules and simply truncate. 

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

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


[R] floor of n observations in number generators

2003-12-30 Thread Marcus Davy
I couldnt find a previous posting on this in the archives, maybe it has
already been mentioned.

If you use a calculation to generate n observations in random number
generators and you don't round to the nearest integer you may be
generating n-1 numbers not n numbers as you thought depending on the
storage precision of the calculation. 

e.g.
> m <- 1000
> pi0 <- 0.9
> length(rnorm(m * (1-pi0)))
[1] 99  # Should be 100
> options(digits=16)
> m * (1-pi0)
[1] 99.97
> identical(m*(1-pi0), 100)
[1] FALSE

Random number generation generates the floor of n observations, this
feature occurs on R-1.8.1 on linux Redhat8, and winXP (also on Unix
SPlus 3.4) 
for probably all of the random number generators.

e.g. 
> length(rnorm(m*(1-pi0),mean=0,sd=1))
[1] 99
> length(rpois(m*(1-pi0),lambda=1))
[1] 99
> length(rbeta(m*(1-pi0),shape=1, shape2=2))
[1] 99
> length(rbinom(m*(1-pi0),size=1, prob=0.5))
[1] 99
> length(runif(m*(1-pi0),min=0, max=1))
[1] 99


marcus

Marcus Davy
Bioinformatics


__
The contents of this e-mail are privileged and/or confidenti...{{dropped}}

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


Re: [R] regexp problem on R 1.7.0

2003-12-30 Thread Prof Brian Ripley
In R (and C) \ must be escaped in a character string.
This is mentioned on the help page.

On Tue, 30 Dec 2003, Itay Furman wrote:

> 
> Hi,
> 
> Am I missing something in using regexps in R?
> Below, 'egrep' means invokation of the command from the shell 
> prompt.
> 
> # I have
> > as.character(block.dist.vals)
> [1] "1e+06" "2e+06" "5e+06"
> # that I wish to convert to:  "1" "2" "5"
> 
> # OK (R and egrep)
> > sub( "e.+06", "", as.character(block.dist.vals) )
> [1] "1" "2" "5"
> # OK (R), egrep will *not* match pattern
> > sub( "e\\+06", "", as.character(block.dist.vals) )
> [1] "1" "2" "5"
> 
> # egrep will match pattern; R will not.
> > sub( "e\+06", "", as.character(block.dist.vals) )
> [1] "1e+06" "2e+06" "5e+06"
> 
> As-far-as I can tell the last attempt should have worked, too.
> Could someone explain to me why it doesn't?
> 
> I have R 1.7.0 on RedHat 9.
> 
> Thanks in advance,
>   Itay Furman
> 
> =
>   Fred Hutchinson Cancer Research Center
> email: [EMAIL PROTECTED]  1100 Fairview Avenue N., Mailstop D4-100
> phone: +1 (206) 667 5921  P.O. Box 19024
> fax:   +1 (206) 667 2917  Seattle, WA  98109-1024
> 
> __
> [EMAIL PROTECTED] mailing list
> https://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
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


[R] regexp problem on R 1.7.0

2003-12-30 Thread Itay Furman

Hi,

Am I missing something in using regexps in R?
Below, 'egrep' means invokation of the command from the shell 
prompt.

# I have
> as.character(block.dist.vals)
[1] "1e+06" "2e+06" "5e+06"
# that I wish to convert to:  "1" "2" "5"

# OK (R and egrep)
> sub( "e.+06", "", as.character(block.dist.vals) )
[1] "1" "2" "5"
# OK (R), egrep will *not* match pattern
> sub( "e\\+06", "", as.character(block.dist.vals) )
[1] "1" "2" "5"

# egrep will match pattern; R will not.
> sub( "e\+06", "", as.character(block.dist.vals) )
[1] "1e+06" "2e+06" "5e+06"

As-far-as I can tell the last attempt should have worked, too.
Could someone explain to me why it doesn't?

I have R 1.7.0 on RedHat 9.

Thanks in advance,
Itay Furman

=
Fred Hutchinson Cancer Research Center
email: [EMAIL PROTECTED]1100 Fairview Avenue N., Mailstop D4-100
phone: +1 (206) 667 5921P.O. Box 19024
fax:   +1 (206) 667 2917Seattle, WA  98109-1024

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


[R] Rmpi and PBS

2003-12-30 Thread Shengqiao Li

Hello:

Anybody knows how to run Rmpi through PBS (Portable Batch System) on a
cluster computer. I'm using a supercomputer which require to submit jobs
to PBS queue for dispatching. I tried use mpirun in my PBS script. But all
my Rslaves are spawned to the same node. This is not desired.

Any suggestions are welcome!

Thanks in advance.


Shengqiao Li

Research Associate
The Department of Statistics
PO Box 6330
West Virginia University
Morgantown, WV 26506-6330

Phone: (304) 285-5960

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


Re: [R] odd results from polr vs wilcoxon test

2003-12-30 Thread Thomas Lumley
On Tue, 30 Dec 2003, Jonathan Williams wrote:

> > summary(fit1)
>
> Call:
> polr(formula = ordered(dat) ~ grp, control = c(maxiter = 1,
> trace = 0))
>
> Coefficients:
> Value Std. Errort value
> grp -15.82468   169.3329 -0.0934531
>
> Intercepts:
>   ValueStd. Error t value
> 2|3   -18.0223 169.3342-0.1064
> 3|4   -16.0254 169.3329-0.0946
> 4|5   -15.4192 169.3327-0.0911
> 5|6   -13.6274 169.3314-0.0805
> 6|7-1.3866   0.5591-2.4803
> 7|8-0.2011   0.4495-0.4474
> 8|9 0.6187   0.4688 1.3198
> 9|102.1965   0.7453 2.9472
> 10|12   2.9441   1.0259 2.8698
>
> Residual Deviance: 124.4085
>
> As far as I can see, there is no error message from polr. Could someone let
> me know
> what I am doing wrong?
>

At least five of your parameters have no finite MLE (-13 on a log scale is
very very very small).  This means that the Wald tests are probably
completely useless.  I would look at a likelihood ratio test or a score
test.

It might be nice for polr() [and glm() and coxph() and ...] to diagnose
this phenomenon, but it's a little tricky and hasn't been a high priority.


-thomas

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


Re: [R] Assignments in loops

2003-12-30 Thread Thomas Lumley
On Tue, 30 Dec 2003, Murray Jorgensen wrote:

> Thanks to Andy, Peter and Roger for drawing my attention to assign(), which
> is just what I needed and works fine.

I will just add the usual note that when you find yourself using assign()
it is a good idea to think very carefully about why you can't use a list
with named components instead of separate variables.


=thomas


>
> Murray
>
> At 14:11 30/12/2003 +1300, Murray Jorgensen wrote:
> >Greetings all. Any help with the following would be appreciated.
> >
> >I want to create a data frame for each file in a directory. The following
> >code does not work but it may show what I am trying to do:
> >
> >carmakes <- c('BMW','Chrysler','Citroen','Fiat','Ford','Holden','Honda',
> >'Mercedes','MG','Mitsubishi','Nissan','Peugeot','Renault','Subaru','Toyota',
> >'VW')
> >for (brand in carmakes) {
> >   fyle <- paste("c:/data/cars03/",brand,".txt",sep="")
> >   brand <- read.table(fyle, header = TRUE, sep = "\t",na.strings =
> >c("-","POA"), colClasses=c("character",rep("numeric",7)),
> > comment.char = "#")
> >}
> >
> >I need something like an unquote() function that will allow the "brand" on
> >the LHS of the assignment to be treated as an object name instead of a
> >character string.
> >
> >Murray
> >
> >
> >
> >
> >
> >
> >Dr Murray Jorgensen  http://www.stats.waikato.ac.nz/Staff/maj.html
> >Department of Statistics, University of Waikato, Hamilton, New Zealand
> >Email: [EMAIL PROTECTED]Fax 7 838 4155
> >Phone  +64 7 838 4773 wk+64 7 849 6486 homeMobile 021 1395 862
> >
> >__
> >[EMAIL PROTECTED] mailing list
> >https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> >
> Dr Murray Jorgensen  http://www.stats.waikato.ac.nz/Staff/maj.html
> Department of Statistics, University of Waikato, Hamilton, New Zealand
> Email: [EMAIL PROTECTED]Fax 7 838 4155
> Phone  +64 7 838 4773 wk+64 7 849 6486 homeMobile 021 1395 862
>
> __
> [EMAIL PROTECTED] mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
>

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

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


[R] odd results from polr vs wilcoxon test

2003-12-30 Thread Jonathan Williams
Dear R helpers,
I would like to ask why polr occasionally generates results that look very
odd.

I have been trying to compare the power of proportional odds logistic
regression with
the Wilcoxon test. I generated random samples, applied both tests and
extracted and
compared the p-values, thus:-

library(MASS)
c1=rep(NA,100); c2=c1
for (run in 1:100)
{
dat=c(rbinom(20,12,0.65),rbinom(20,12,0.35))
grp=c(rep(0,20),rep(1,20))

fit1=polr(ordered(dat)~grp, control=c(maxiter=1, trace=0))
fit2=wilcox.test(dat~grp)
#extract t-value from fit1 and find associated p-value
c1[run]=pt(as.numeric(unlist(summary(fit1))[((nlevels(ordered(dat)))*2)+1]),
fit1$df.residual)
c2[run]=fit2$p.value
if (c1[run]>0.2 & c2[run]<0.01)
{print(rbind(c1,c2)); print(rbind(grp,dat)); print(fit2);
print(summary(fit1)); stop()}
} # end for run

The p-values from polr are mostly comparable with those from Wilcoxon test.
But, sometimes,
polr gives a very small t-value, when the groups are obviously different.
For example:-

> rbind(c1,c2)
   [,1] [,2][,3] [,4] [,5]
[,6]
c1 5.593865e-05 2.442332e-04 0.001733831 1.606033e-04 2.412809e-04
6.636155e-05
c2 3.091763e-06 7.549811e-05 0.001548798 4.279157e-05 8.251237e-05
1.947336e-07
   [,7] [,8] [,9][,10] [,11] [,12] [,13]
[,14]
c1 5.622105e-05 9.373143e-05 3.422841e-05 4.630825e-01NANANA
NA
c2 1.522268e-06 1.319416e-05 4.393431e-07 9.619527e-08NANANA
NA

> rbind(grp,dat)
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
[,14]
grp000000000 0 0 0 0
0
dat876996   1087 8 6 9 7
9
[,15] [,16] [,17] [,18] [,19] [,20] [,21] [,22] [,23] [,24] [,25] [,26]
[,27]
grp 0 0 0 0 0 0 1 1 1 1 1 1
1
dat 9 7 6 712 8 3 6 6 3 5 3
3
[,28] [,29] [,30] [,31] [,32] [,33] [,34] [,35] [,36] [,37] [,38] [,39]
[,40]
grp 1 1 1 1 1 1 1 1 1 1 1 1
1
dat 3 4 5 5 3 5 5 2 4 5 2 4
3

> fit2

Wilcoxon rank sum test with continuity correction

data:  dat by grp
W = 396, p-value = 9.62e-08
alternative hypothesis: true mu is not equal to 0

Re-fitting to get Hessian

> summary(fit1)

Call:
polr(formula = ordered(dat) ~ grp, control = c(maxiter = 1,
trace = 0))

Coefficients:
Value Std. Errort value
grp -15.82468   169.3329 -0.0934531

Intercepts:
  ValueStd. Error t value
2|3   -18.0223 169.3342-0.1064
3|4   -16.0254 169.3329-0.0946
4|5   -15.4192 169.3327-0.0911
5|6   -13.6274 169.3314-0.0805
6|7-1.3866   0.5591-2.4803
7|8-0.2011   0.4495-0.4474
8|9 0.6187   0.4688 1.3198
9|102.1965   0.7453 2.9472
10|12   2.9441   1.0259 2.8698

Residual Deviance: 124.4085

As far as I can see, there is no error message from polr. Could someone let
me know
what I am doing wrong?

Thanks, in advance,

Jonathan Williams
OPTIMA
Radcliffe Infirmary
Woodstock Road
OXFORD OX2 6HE
Tel +1865 (2)24356


Jonathan Williams
OPTIMA
Radcliffe Infirmary
Woodstock Road
OXFORD OX2 6HE
Tel +1865 (2)24356

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


[R] dyn.unload? library.dyn.unload?

2003-12-30 Thread wolski
Hi!

The writing R extension states.
"The shared object/DLL is loaded by dyn.load and unloaded by dyn.unload. Unloading
is not normally necessary, but it is needed to allow the DLL to be re-built on some 
platforms,
including Windows."

I am working on Windows.
 
I load the dll as described in R-exts with 
.First.lib <- function(lib, pkg) library.dynam("mscalibD",pkg,lib)
in the zzz.R file.

After starting R and loading the package with
library(mscalibD)

>library.dynam()
[1] "ts"   "nls"  "modreg"   "mva"  "ctest""methods"  "mscalibD"

> dyn.unload("D:/prog/R/rw1081/library/mscalibD/libs/mscalibD.dll")
Error in dyn.unload(x) : dynamic/shared library 
"D:/prog/R/rw1081/library/mscalibD/libs/mscalibD.dll" was not loaded

But
> dyn.load("D:/prog/R/rw1081/library/mscalibD/libs/mscalibD.dll")
> dyn.unload("D:/prog/R/rw1081/library/mscalibD/libs/mscalibD.dll")
works.

So i guess that dyn.unload isn't supposed to work together with library.dynam. Is this 
right?

I guess also that I should use instead
.Last.lib<-funciton(libpath) library.dynam.unload("mscalibD", libpath)

Is this right? If so where I have to place this function? In the zzz.R?

And how to call it from within R? Is it called by detach()?

> detach(package:mva)
> is.loaded(symbol.For("hcass2"))
[1] TRUE

I gues no. Because as dyn.load {base} example section states
is.loaded(symbol.For("hcass2")) #-> probably TRUE, as mva is loaded.


The help is mind boggling. Please help!

Eryk

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


RE: [R] Writing data frames

2003-12-30 Thread Simon Fear
Another way in this particular case is to transpose m:

write.table(t(m), file="", row.names=FALSE,quote=FALSE)

This transposition creates a 1x2 matrix, for which there is
a method (as.data.frame.matrix). (Don't just use as.matrix(m),
that will be a 2x1 matrix.)

Note that there is a missing dimension spec in the structure of 
the array object m - contrast str(m) with str(t(m)). Arrays exist to 
be ragged - so there's no default coercion method to the 
non-ragged data.frame class.

You could also skip all of the above and work with sink() instead
of write.table().


> -Original Message-
> From: Andy Bunn [mailto:[EMAIL PROTECTED]
> Sent: 30 December 2003 00:44
> To: 'Ton van Daelen'; [EMAIL PROTECTED]
> Subject: RE: [R] Writing data frames
> 
> 
> Security Warning: 
> If you are not sure an attachment is safe to open please contact  
> Andy on x234. There are 0 attachments with this message. 
>  
>  
> The key is in the error message:
> "...can't coerce array into a data.frame"
> 
> Even if as.data.frame.default is unhappy you can coerce m into a
> data.frame.
> 
> write.table(data.frame(m1 = m[1], m2 = m[2]), file="C:\\R\\tst.txt",
> col.names=T, row.names=F, quote=F, append = FALSE)
> 
> There's probably a nicer way to do the coercion but this works.
> 
> HTH, Andy
> 
> __
> [EMAIL PROTECTED] mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
>  
 
Simon Fear 
Senior Statistician 
Syne qua non Ltd 
Tel: +44 (0) 1379 69 
Fax: +44 (0) 1379 65 
email: [EMAIL PROTECTED] 
web: http://www.synequanon.com 
  
Number of attachments included with this message: 0 
  
This message (and any associated files) is confidential and\...{{dropped}}

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


Re: [R] Mistake with contour...

2003-12-30 Thread Prof Brian Ripley
On Tue, 30 Dec 2003, [EMAIL PROTECTED] wrote:

> I'm reading Ripley-Venables "Modern Applied Statistics with S - Fourth edition" , at 
> the same time trying  the examples proposed in the book using R 1.8.1 under linux.
> 
> Now  I'm trying the following  code from the book (example code of spatial 
> statistics at page 76) with R :
> 
> | data(topo) library("spatial") topo.loess<-loess(z ~ x * y, topo,
> | degree= 2,span=0.25)
> | topo.mar<-list(x=seq(0,6.5,0.2),y=seq(0,6.5,0.2))
> | topo.lo=predict(topo.loess,expand.grid(topo.mar)) 

It does not say that!

> | par(pty="s")
> | 
> contour(topo.mar$x,topo.mar$y,topo.lo,xlab="",ylab="",levels=seq(700,1000,25),cex=0.7)
> 
> and at the "contour" command the following error pops up:
> 
> Error in contour.default(topo.mar$x, topo.mar$y, topo.lo, xlab = "",
> ylab = "",  :
> ~no proper `z' matrix specified
> 
> Being an R newbye I don't know what to do next to fix the problem.

Look in the R scripts provided to see the R version of the code.
.../library/MASS/scripts/ch04.R contains

topo.loess <- loess(z ~ x * y, topo, degree = 2, span = 0.25)
topo.mar <- list(x = seq(0, 6.5, 0.2), y=seq(0, 6.5, 0.2))
topo.lo <- predict(topo.loess, expand.grid(topo.mar))
topo.lo <- matrix(topo.lo, length(topo.mar$x),length(topo.mar$y))
par(pty = "s")   # square plot
contour(topo.mar$x, topo.mar$y, topo.lo, xlab = "", ylab = "",
  levels = seq(700,1000,25), cex = 0.7)

R's contour is not quite the same as the S original.

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

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


[R] Mistake with contour...

2003-12-30 Thread [EMAIL PROTECTED]
I'm reading Ripley-Venables "Modern Applied Statistics with S - Fourth edition" , at 
the same time trying  the examples proposed in the book using R 1.8.1 under linux.

Now  I'm trying the following  code from the book (example code of spatial statistics 
at page 76) with R :

| data(topo) library("spatial") topo.loess<-loess(z ~ x * y, topo,
| degree= 2,span=0.25)
| topo.mar<-list(x=seq(0,6.5,0.2),y=seq(0,6.5,0.2))
| topo.lo=predict(topo.loess,expand.grid(topo.mar)) 
| par(pty="s")
| 
contour(topo.mar$x,topo.mar$y,topo.lo,xlab="",ylab="",levels=seq(700,1000,25),cex=0.7)

and at the "contour" command the following error pops up:

Error in contour.default(topo.mar$x, topo.mar$y, topo.lo, xlab = "",
ylab = "",  :
~no proper `z' matrix specified

Being an R newbye I don't know what to do next to fix the problem.

Regards

Vittorio from Rome

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