Re: [Rd] density() fails if x contains Inf or -Inf (PR#8033)

2005-07-26 Thread Prof Brian Ripley
The underlying problem here BTW is that sum is promoting logical to double 
not integer, unlike the rest of its Summary group.  This is an 
unintentional side effect of a bug fix a while back, and I have now 
corrected it.

On Mon, 25 Jul 2005 [EMAIL PROTECTED] wrote:

> Full_Name: Michael Beer
> Version: 2.1.0 and 2.1.1
> OS: linux-gnu and mingw32
> Submission from: (NULL) (134.21.49.141)
>
>
> The command "density(c(0.5,0.6,Inf,0.7))" fails saying "Wrong type for 
> argument
> 2 in call to massdist". This problem can be resolved by replacing "nx = nx" by
> "nx = as.integer(nx)" in the call to massdist. When there are infinite values,
> the value of sum(x.finite) is attributed to nx before. Thus nx is changed to
> class "numeric" instead of "integer".

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

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] beginner finds a bug - crash induced. (PR#8035)

2005-07-26 Thread maechler
Well,
you say yourself it wasn't reproducible.  So it could have been
anything that "crashed" you R , cosmic radiation, a bolt of
lightning reversing a bit in your computer memory ,...  :-)
many things rather than a bug in R.

But before dropping this report completely,
can you try

for(i in 1:1000) {
state <- c("tas", "sa",  "qld", "nsw", "nsw", "nt",  "wa",  "wa",
   "qld", "vic", "nsw", "vic", "qld", "qld", "sa",  "tas",
   "sa",  "nt",  "wa",  "vic", "qld", "nsw", "nsw", "wa",
   "sa",  "act", "nsw", "vic", "vic", "act")
print(factor(state))
print(table(state))
barplot(table(state))
}

which does what you did, but 1000 times --- "of course" completely
flawlessly for me..

Martin Maechler, ETH Zurich

> "sholland" == sholland  <[EMAIL PROTECTED]>
> on Tue, 26 Jul 2005 04:29:23 +0200 (CEST) writes:

sholland> Full_Name: Stephen Holland M.D.  
sholland> Version: 2.1.1
sholland> OS: Mac OS X

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] docu buglets for ar and friends

2005-07-26 Thread Kjetil Brinchmann Halvorsen
This is R2.1.1

The documantation opened by
?ar, section for returned value, does not document all the components of 
the returned
list. In addition to the 13 components documented, it also contains the 
component
$frequency
This also applies to the help page opened by
?ar.ols

-- 

Kjetil Halvorsen.

Peace is the most effective weapon of mass construction.
   --  Mahdi Elmandjra





-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] docu buglets for ar and friends

2005-07-26 Thread Prof Brian Ripley
On Mon, 25 Jul 2005, Kjetil Brinchmann Halvorsen wrote:

> This is R2.1.1
>
> The documantation opened by
> ?ar, section for returned value, does not document all the components of
> the returned
> list. In addition to the 13 components documented, it also contains the
> component
> $frequency
> This also applies to the help page opened by
> ?ar.ols

There is also $call.  Such lists are not always comprehensive since there 
may be `private' components too.  So I would not consider undocumented 
components to be bugs unless they are things end users might need and are 
not otherwise available.

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

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] evaluating variance functions in nlme

2005-07-26 Thread Nicholas Lewin-Koh
Hi,
I guess this is a final plea, and maybe this should go to R-help but
here goes.
I am writing a set of functions for calibration and prediction, and to
calculate standard 
errors and intervals I need the variance function to be evaluated at new
prediction points.
So for instance

fit<-gnls(Y~SSlogis(foo,Asym,xmid,scal),weights=varPower())
fit2<-gnls(Y~SSlogis(foo,Asym,xmid,scal),weights=varPower(form=~foo))

Now using fit or fit2 I would like to get the variance function
evaluated at new points. 
I have played with getCovariateFormula, and looked at Initialize.gnls,
summary etc.
but it is not clear to me how to evaluate the form component, especially
in the case of fit
above where form=~fitted(.), in any safe way.

I can grep for "fitted" in the formula eg.
grep("fitted",deparse(getCovariateFormula(fit$modelStruct$varFunc)))
and try to calculate predicted values from the model for the new points
but how to substitute back in the new terms?

I don't need this problem solved on a platter, I just need to unedrstand
an approach,
because my stabs are failing.

Thanks

Nicholas

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] Error registering finalizer

2005-07-26 Thread Paul Roebuck
What exactly is a reference object? I'm getting this error
message attempting to register a finalizer:

can only weakly reference/finalize reference objects

I don't see any problem with the code... Here's what appears
to be the relevant portions.


setClass("PDNNObject",
 representation(handle = "externalptr",
id = "character",
"VIRTUAL"),
 prototype=list(handle = NULL))
setClass("ProbesetGE",
 representation("PDNNObject"))



static void ProbesetGE_finalizer(SEXP vntData)
{
Rprintf("In ProbesetGE_finalizer()\n");
/* Deallocate memory of structure fields */
}

static SEXP AllocateProbesetGEPtr(unsigned count)
{
return R_AllocatePtr(count,
 sizeof(ProbesetGE_t),
 ProbesetGETypeTag));
}

SEXP R_PDNN_newProbesetGE(unsigned count)
{
SEXP vntObj;
SEXP vntClassDef;
SEXP vntData;
SEXP vntAttr;
SEXP vntHandle;
unsigned n = 0;

PROTECT(vntClassDef = MAKE_CLASS(PROBESET_GE_CLASS_NAME)); n++;
PROTECT(vntObj  = NEW_OBJECT(vntClassDef)); n++;
PROTECT(vntHandle   = AllocateProbesetGEPtr(count)); n++;
SET_SLOT(vntObj, HandleSlotSymbol, vntHandle);

PROTECT(vntData = R_ExternalPtrProtected(vntHandle)); n++;
PROTECT(vntAttr = NEW_INTEGER(1)); n++;
INTEGER(vntAttr)[0] = count;
SET_COUNT(vntData, vntAttr);

> Problem comes here <<
R_RegisterCFinalizer(vntData, (R_CFinalizer_t)ProbesetGE_finalizer);

UNPROTECT(n);

return vntObj;
}


Thanks for any pointers...

--
SIGSIG -- signature too long (core dumped)

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Error registering finalizer

2005-07-26 Thread Paul Roebuck
On Tue, 26 Jul 2005, Paul Roebuck wrote:

> What exactly is a reference object? I'm getting this error
> message attempting to register a finalizer:
>
> can only weakly reference/finalize reference objects

Still don't have an explanation for the above but the code
now works with the following mods.

-static void ProbesetGE_finalizer(SEXP vntData)
+static void ProbesetGE_finalizer(SEXP vntHandle)

-R_RegisterCFinalizer(vntData, (R_CFinalizer_t)ProbesetGE_finalizer);
+R_RegisterCFinalizer(vntHandle, (R_CFinalizer_t)ProbesetGE_finalizer);

Original thought was that a finalizer was a routine that
ran prior to an object's destruction (like a destructor).
Apparently, only certain objects can have finalizers.

--
SIGSIG -- signature too long (core dumped)

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] R 2.1.1: read.table processes C-style escapes (PR#8037)

2005-07-26 Thread smyth
In R 2.1.1, the default behaviour of scan() was changed to process all 
C-style escapes, even when a delimiter was specified using the 'sep' 
argument. A new argument 'allowEscapes' was introduced to turn this 
processing off.

Because read.table() calls scan(), read.table() inherits the new default 
behaviour of scan() but without a way to turn it off. For example, reading 
a file testdata.txt' containing

X
A
\0
C

produces

 > read.delim("testdata.txt")
[1] X
<0 rows> (or 0-length row.names)

It seems that all the occurances of scan() within read.table() need to have 
'allowEscapes=FALSE' added to the argument string.

Gordon

 > version
  _
platform i386-pc-mingw32
arch i386
os   mingw32
system   i386, mingw32
status   Patched
major2
minor1.1
year 2005
month07
day  22
language R
---
Dr Gordon K Smyth, Senior Research Scientist, Bioinformatics,
Walter and Eliza Hall Institute of Medical Research,
1G Royal Parade, Parkville, Vic 3050, Australia
Tel: (03) 9345 2326, Fax (03) 9347 0852,
Email: [EMAIL PROTECTED], www: http://www.statsci.org

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] R 2.1.1: read.table processes C-style escapes (PR#8037)

2005-07-26 Thread Gordon Smyth

>To: [EMAIL PROTECTED]
>From: Gordon Smyth <[EMAIL PROTECTED]>
>Subject: R 2.1.1: read.table processes C-style escapes
>Date: Wed, 27 Jul 2005 12:51:45 +1000
>
>In R 2.1.1, the default behaviour of scan() was changed to process all 
>C-style escapes, even when a delimiter was specified using the 'sep' 
>argument. A new argument 'allowEscapes' was introduced to turn this 
>processing off.
>
>Because read.table() calls scan(), read.table() inherits the new default 
>behaviour of scan() but without a way to turn it off. For example, reading 
>a file testdata.txt' containing
>
>X
>A
>\0
>C
>
>produces
>
> > read.delim("testdata.txt")
>[1] X
><0 rows> (or 0-length row.names)
>
>It seems that all the occurances of scan() within read.table() need to 
>have 'allowEscapes=FALSE' added to the argument string.

Or, alternatively and perhaps better, scan() could regain some of its 
earlier behaviour, to process C-style escapes by default only when 'sep' is 
NULL or empty. It seems, to me at least, that C-style escape sequences make 
sense only in some sort of source code, and delimited text can't be source 
code.

Gordon

>Gordon
>
> > version
>  _
>platform i386-pc-mingw32
>arch i386
>os   mingw32
>system   i386, mingw32
>status   Patched
>major2
>minor1.1
>year 2005
>month07
>day  22
>language R

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel