Re: [Rd] (PR#11484) On WinXP, R CMD config needs sh (and breaks

2008-05-19 Thread ripley
Where is the bug here?  It also does on a Unix-alike.

Anything involving R CMD potentially needs the Rtools set in the path.  R 
CMD config is primarily intended to be used in configure scripts in 
packages.


On Sun, 18 May 2008, [EMAIL PROTECTED] wrote:

 Full_Name: Laurent Gautier
 Version: R-2.7.0patched (r45712)
 OS: WinXP
 Submission from: (NULL) (90.15.141.247)



 On a WinXP box (that does not has sh in the %Path%,
 R CMD config appears to break:

 C:\R CMD config
 'sh' is not recognized as an internal or external command,
 operable program or batch file.

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


-- 
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] predict.prcomp: wrong check for matrix dimensions (PR#11482)

2008-05-19 Thread gabraham
Full_Name: Gad Abraham
Version: 2.7.0
OS: Ubuntu Linux
Submission from: (NULL) (59.167.148.182)


Description:


 x1 - matrix(rnorm(100), 5, 20)
 x2 - matrix(rnorm(100), 5, 20)
 p - prcomp(x1)
 predict(p, x2)
Error in predict.prcomp(p, x2) :
  'newdata' does not have the correct number of columns
 dim(x2)
[1]  5 20
 dim(p$rotation)
[1] 20  5

All predict.prcomp really does is x2 %*% p$rotation, which is a perfectly 
legal operation that should yield a 5x5 matrix:

 dim(x2 %*% p$rotation)
[1] 5 5

Solution:
=

Change
   p - NCOL(object$rotation)
to
   p - NROW(object$rotation)

This bug is still present in R-patched_2008-05-16.

 sessionInfo()
R version 2.7.0 (2008-04-22) 
x86_64-unknown-linux-gnu 

locale:
LC_CTYPE=en_AU.UTF-8;LC_NUMERIC=C;LC_TIME=en_AU.UTF-8;LC_COLLATE=en_AU.UTF-8;LC_MONETARY=C;LC_MESSAGES=en_AU.UTF-8;LC_PAPER=en_AU.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_AU.UTF-8;LC_IDENTIFICATION=C

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

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


Re: [Rd] (PR#11484) On WinXP, R CMD config needs sh (and breaks without it)

2008-05-19 Thread lgautier
2008/5/19 Prof Brian Ripley [EMAIL PROTECTED]:
 Where is the bug here?  It also does on a Unix-alike.

Then R CMD config --help could at least spit out an error stating
what should be installed
(rather than die with an execution error straight from the DOS).

Setting an sh in the %Path% (sh coming from cygwin) does not seem to
lead to something working
under winXP (various error messages).


 Anything involving R CMD potentially needs the Rtools set in the path.

I guess that I have been lucky with the potential aspect of the
requirements so far.
Is there a documentation of what is needed by the respective R CMD flavors ?


 R CMD config is primarily intended to be used in configure scripts in
 packages.

 On Sun, 18 May 2008, [EMAIL PROTECTED] wrote:

 Full_Name: Laurent Gautier
 Version: R-2.7.0patched (r45712)
 OS: WinXP
 Submission from: (NULL) (90.15.141.247)



 On a WinXP box (that does not has sh in the %Path%,
 R CMD config appears to break:

 C:\R CMD config
 'sh' is not recognized as an internal or external command,
 operable program or batch file.

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


 --
 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] (PR#11484) On WinXP, R CMD config needs sh (and breaks without it)

2008-05-19 Thread Gabor Grothendieck
Note that if you place Rcmd.bat andor R.bat from
  http://batchfiles.googlecode.com
anywhere in your path and install the latest rtools from
  http://www.murdoch-sutherland.com/Rtools/
then you don't have to change your PATH.

On Mon, May 19, 2008 at 5:40 AM,  [EMAIL PROTECTED] wrote:
 2008/5/19 Prof Brian Ripley [EMAIL PROTECTED]:
 Where is the bug here?  It also does on a Unix-alike.

 Then R CMD config --help could at least spit out an error stating
 what should be installed
 (rather than die with an execution error straight from the DOS).

 Setting an sh in the %Path% (sh coming from cygwin) does not seem to
 lead to something working
 under winXP (various error messages).


 Anything involving R CMD potentially needs the Rtools set in the path.

 I guess that I have been lucky with the potential aspect of the
 requirements so far.
 Is there a documentation of what is needed by the respective R CMD flavors ?


 R CMD config is primarily intended to be used in configure scripts in
 packages.

 On Sun, 18 May 2008, [EMAIL PROTECTED] wrote:

 Full_Name: Laurent Gautier
 Version: R-2.7.0patched (r45712)
 OS: WinXP
 Submission from: (NULL) (90.15.141.247)



 On a WinXP box (that does not has sh in the %Path%,
 R CMD config appears to break:

 C:\R CMD config
 'sh' is not recognized as an internal or external command,
 operable program or batch file.

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


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


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


Re: [Rd] k means

2008-05-19 Thread friedrich . leisch
 On Sat, 17 May 2008 00:54:55 +0200,
 cgenolin  (c) wrote:

   Hi the list
   I try the flexclust, but I do not manage to see what is wrong in my
   (very simple) code...
   Will you have few minutes to check it?

   Thanks for your help.

   Christophe
   --- 8 
   data  - rbind(c(1,2 ,NA,4 ),
  c(1,1 ,NA,1 ),
  c(2,3 ,4 ,5 ),
  c(2,2 ,2 ,2 ),
  c(3,NA,NA,6 ),
  c(3,NA,NA,3 ),
  c(2,4 ,4 ,NA),
  c(2,3 ,2 ,NA))

   distTest - rbind(c(0,0,0,0),
 c(1,1,1,1))

   distNA - function(x,centers){
   z - matrix(0,nrow=nrow(x),ncol=nrow(centers))
   for(k in 1:nrow(centers)){
   z[,k]- apply(x,1,function(x){dist(rbind(x,centers[k,]))})
   }
   z
   }

   distNA(data,distTest)

   km - kccaFamily(dist=distNA,cent=colMeans)
   kcca(x=data,k=2,family=km)
   kcca(x=data,k=3,family=km)

I don't think this is really appropriate for r-devel, you should
either ask the package author (me), or r-help.

Anyway, colMeans will not remove the missing values by default, so you
need also a special function for centroid computation:

R centNA - function(x) colMeans(x, na.rm=TRUE)
R km - kccaFamily(dist=distNA,cent=centNA)
R kcca(x=data,k=2,family=km)
kcca object of family ??distNA?? 

call:
kcca(x = data, k = 2, family = km)

cluster sizes:

1 2 
5 3 


Hope this helps,
Fritz

-- 
---
Prof. Dr. Friedrich Leisch 

Institut für Statistik  Tel: (+49 89) 2180 3165
Ludwig-Maximilians-Universität  Fax: (+49 89) 2180 5308
Ludwigstraße 33
D-80539 München http://www.statistik.lmu.de/~leisch
---
   Journal Computational Statistics --- http://www.springer.com/180 
  Münchner R Kurse --- http://www.statistik.lmu.de/R

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


[Rd] as.POSIX{ct,lt} fail on class AsIs

2008-05-19 Thread Don MacQueen
(I think this is probably appropriate for r-devel -- if my diagnosis 
is correct, that is)


I have a script that I run infrequently (i.e., quarterly) that has 
been working for several years. I re-ran it this morning for the 
first time since updating R from 2.6.2 to 2.7.0, and encountered an 
error.


I found a simple example that shows the problem:


 as.POSIXct( I( '2008-01-01' ) )

Error in as.POSIXlt.default(x, tz, ...) :
  do not know how to convert 'x' to class POSIXlt


 traceback()

6: stop(gettextf(do not know how to convert '%s' to class \POSIXlt\,
   deparse(substitute(x
5: as.POSIXlt.default(x, tz, ...)
4: as.POSIXlt(x, tz, ...)
3: as.POSIXct(as.POSIXlt(x, tz, ...), tz, ...)
2: as.POSIXct.default(I(2008-01-01))
1: as.POSIXct(I(2008-01-01))


 class( I('2008-01-01') )

[1] AsIs

 is.character( I('2008-01-01') )

[1] TRUE

It looks to me as though as.POSIXlt() does not recognize the object 
as being also a character object

because it calls as.POSIXlt.default() instead of as.POSIXlt.character().



 sessionInfo()

R version 2.7.0 (2008-04-22)
powerpc-apple-darwin8.10.1

locale:
C

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


I have done some searching in r-help, r-devel, and NEWS through 2.8 
Series News and not found anything that I recognized as either a fix 
or an indication this is intended behavior.  (Doesn't mean it isn't 
there, of course...)


By way of background, I sometimes use the class AsIs for the reason 
described in?AsIs, i.e.,
 Protecting an object by enclosing it in 'I()' in a call to 
'data.frame' inhibits the conversion of character vectors to 
factors...

and that's what led to this discovery.

Thanks
-Don
--
--
Don MacQueen
Environmental Protection Department
Lawrence Livermore National Laboratory
Livermore, CA, USA
925-423-1062

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


[Rd] Error in building library - R CMD build mypkg.

2008-05-19 Thread Ajay DAS

- Forwarded by Ajay DAS/US/BMNA01 on 05/19/2008 03:11 PM -

 
  Ajay DAS  
 
   To:   [EMAIL PROTECTED]  
  
  05/19/2008 01:00 cc:  
 
  PM   Subject:  Error in building 
library - R CMD build mypkg.  

 

 



Hi,

I am getting an error when I am trying to build a library in R for windows
. I am using R 2.7.0 in windows. I am following the instructions listed in
the R Help for package creation.

require(stats)
## two functions and two data sets :
f - function(x,y) x+y
g - function(x,y) x-y
d - data.frame(a=1, b=2)
e - rnorm(1000)

package.skeleton(list=c(f,g,d,e), name=mypkg)


Then in the command prompt I executed the following command:

  R CMD build mypkg

I am getting the following error :

* checking for file 'mypkg/DESCRIPTION' ... OK
* preparing 'mypkg':
* checking DESCRIPTION meta-information ... ERROR
During startup - Warning messages:
1: In library(package, lib.loc = lib.loc, character.only = TRUE,
logical.return
= TRUE,  :
' there is no package called 'NULL
 in options(defaultPackages) was not found

What is it that I am not doing right ?

Thanks,
Ajay.





-
AVIS : Ce courrier et ses pieces jointes sont destines a leur seul destinataire 
et peuvent contenir des informations confidentielles appartenant a bioMerieux. 
Si vous n'etes pas destinataire, vous etes informe que toute lecture, 
divulgation, ou reproduction de ce message et des pieces jointes est 
strictement interdite. Si vous avez recu ce message par erreur merci d'en 
prevenir l'expediteur et de le detruire, ainsi que ses pieces jointes.

NOTICE: This message and attachments are intended only for the use of their 
addressee and may contain confidential information belonging to bioMerieux. If 
you are not the intended recipient, you are hereby notified that any reading, 
dissemination, distribution, or copying of this message, or any attachment, is 
strictly prohibited. If you have received this message in error, please notify 
the original sender immediately and delete this message, along with any 
attachments.

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


Re: [Rd] Error in building library - R CMD build mypkg.

2008-05-19 Thread Gabor Grothendieck
What does your DESCRIPTION file look like?  Have you edited it
to specify the required information?  Read the Writing R Extensions
manual.

On Mon, May 19, 2008 at 4:11 PM, Ajay DAS [EMAIL PROTECTED] wrote:

 - Forwarded by Ajay DAS/US/BMNA01 on 05/19/2008 03:11 PM -

  Ajay DAS
   To:   [EMAIL PROTECTED]
  05/19/2008 01:00 cc:
  PM   Subject:  Error in building 
 library - R CMD build mypkg.





 Hi,

 I am getting an error when I am trying to build a library in R for windows
 . I am using R 2.7.0 in windows. I am following the instructions listed in
 the R Help for package creation.

 require(stats)
 ## two functions and two data sets :
 f - function(x,y) x+y
 g - function(x,y) x-y
 d - data.frame(a=1, b=2)
 e - rnorm(1000)

 package.skeleton(list=c(f,g,d,e), name=mypkg)


 Then in the command prompt I executed the following command:

  R CMD build mypkg

 I am getting the following error :

 * checking for file 'mypkg/DESCRIPTION' ... OK
 * preparing 'mypkg':
 * checking DESCRIPTION meta-information ... ERROR
 During startup - Warning messages:
 1: In library(package, lib.loc = lib.loc, character.only = TRUE,
 logical.return
 = TRUE,  :
 ' there is no package called 'NULL
  in options(defaultPackages) was not found

 What is it that I am not doing right ?

 Thanks,
 Ajay.





 -
 AVIS : Ce courrier et ses pieces jointes sont destines a leur seul 
 destinataire et peuvent contenir des informations confidentielles appartenant 
 a bioMerieux. Si vous n'etes pas destinataire, vous etes informe que toute 
 lecture, divulgation, ou reproduction de ce message et des pieces jointes est 
 strictement interdite. Si vous avez recu ce message par erreur merci d'en 
 prevenir l'expediteur et de le detruire, ainsi que ses pieces jointes.

 NOTICE: This message and attachments are intended only for the use of their 
 addressee and may contain confidential information belonging to bioMerieux. 
 If you are not the intended recipient, you are hereby notified that any 
 reading, dissemination, distribution, or copying of this message, or any 
 attachment, is strictly prohibited. If you have received this message in 
 error, please notify the original sender immediately and delete this message, 
 along with any attachments.

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


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


[Rd] schoolmath (PR#11488)

2008-05-19 Thread w . gray
Full_Name: Will Gray
Version: 2.7.0
OS: GNU/Linux (Debian)
Submission from: (NULL) (160.129.18.69)


The schoolmath package has several inaccuracies in it.  Here is just a sample of
some ways to get prime numbers between 1,000,000 and 1,000,100.  Each method
returns a different set and each result contains non-primes.

data(primlist)
(a - primlist[primlist  100  primlist  1000100])
(b - is.prim(a))
which(!b)
(c - primes(100,1000100))
(d - is.prim(c))
which(!d)

Even the example for the function 'primes' gives some bad results.

example(primes) - x
(y - is.prim(x$value))
which(!y)

I've tried contacting the maintainer(s) to let them know, but have not received
a reply.  In the meantime, I suggest this package be removed from CRAN.

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