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


[Rd] using zlib in a package: problems in windows

2008-05-19 Thread Ramon Diaz-Uriarte
Dear All,

I am having trouble getting an R package to build and install
correctly under Windows. In this package, which builds and checks OK
under Linux, I use zlib (among other functions, gzprintf).

As mentioned by Prof. Ripley a while back, the file "CHANGES" under
src/gnuwin32 says explains that to, to use zlib, one has to set
$(ZLIB_LIBS) in PKG_LIBS. I have a Makefile.win with just that.

I have also downloaded the Windows toolset (Rtools.exe) which I have
used to successfully build R-patched. However, I still cannot get the
package to compile.

>From the log, it seems that in fact the build is trying to use zlib,
but the gzprintf symbol is not found. However, gzprintf is in the
zlib.h header.  00install.out follows below.

What am I doing wrong?

Thanks,

R.

P.D. I am using Windows 2000 (under vmware).




-- Making package RJaCGH 

   **
   WARNING: this package has a configure script
 It probably needs manual configuration
   **

  adding build stamp to DESCRIPTION
  installing NAMESPACE file and metadata
  making DLL ...
making nnhl.d from nnhl.c
gcc  -std=gnu99  -Ic:/R/R-patc~1/include -O3 -Wall  -c nnhl.c -o nnhl.o
windres --preprocessor="gcc -E -xc -DRC_INVOKED" -I
c:/R/R-patc~1/include  -i RJaCGH_res.rc -o RJaCGH_res.o
gcc  -std=gnu99  -shared -s  -o RJaCGH.dll RJaCGH.def nnhl.o
RJaCGH_res.o  -Lc:/R/R-patc~1/bin -lRzlib   -lR
nnhl.o:nnhl.c:(.text+0x138f): undefined reference to `gzprintf'
nnhl.o:nnhl.c:(.text+0x13ae): undefined reference to `gzprintf'
nnhl.o:nnhl.c:(.text+0x13d2): undefined reference to `gzprintf'
nnhl.o:nnhl.c:(.text+0x13f6): undefined reference to `gzprintf'
nnhl.o:nnhl.c:(.text+0x1415): undefined reference to `gzprintf'
nnhl.o:nnhl.c:(.text+0x1451): more undefined references to `gzprintf' follow
collect2: ld returned 1 exit status
make[3]: *** [RJaCGH.dll] Error 1
make[2]: *** [srcDynlib] Error 2
make[1]: *** [all] Error 2
make: *** [pkg-RJaCGH] Error 2
*** Installation of RJaCGH failed ***




-- 
Ramon Diaz-Uriarte
Statistical Computing Team
Structural Biology and Biocomputing Programme
Spanish National Cancer Centre (CNIO)
http://ligarto.org/rdiaz

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


Re: [Rd] using zlib in a package: problems in windows

2008-05-19 Thread Prof Brian Ripley

gzprintf is not in Rzlib.dll.  It has been commented out in the R build.
So you will need to use you own copy of zlib.

On Tue, 20 May 2008, Ramon Diaz-Uriarte wrote:


Dear All,

I am having trouble getting an R package to build and install
correctly under Windows. In this package, which builds and checks OK
under Linux, I use zlib (among other functions, gzprintf).

As mentioned by Prof. Ripley a while back, the file "CHANGES" under
src/gnuwin32 says explains that to, to use zlib, one has to set
$(ZLIB_LIBS) in PKG_LIBS. I have a Makefile.win with just that.

I have also downloaded the Windows toolset (Rtools.exe) which I have
used to successfully build R-patched. However, I still cannot get the
package to compile.


From the log, it seems that in fact the build is trying to use zlib,

but the gzprintf symbol is not found. However, gzprintf is in the
zlib.h header.  00install.out follows below.

What am I doing wrong?

Thanks,

R.

P.D. I am using Windows 2000 (under vmware).




-- Making package RJaCGH 

  **
  WARNING: this package has a configure script
It probably needs manual configuration
  **

 adding build stamp to DESCRIPTION
 installing NAMESPACE file and metadata
 making DLL ...
making nnhl.d from nnhl.c
gcc  -std=gnu99  -Ic:/R/R-patc~1/include -O3 -Wall  -c nnhl.c -o nnhl.o
windres --preprocessor="gcc -E -xc -DRC_INVOKED" -I
c:/R/R-patc~1/include  -i RJaCGH_res.rc -o RJaCGH_res.o
gcc  -std=gnu99  -shared -s  -o RJaCGH.dll RJaCGH.def nnhl.o
RJaCGH_res.o  -Lc:/R/R-patc~1/bin -lRzlib   -lR
nnhl.o:nnhl.c:(.text+0x138f): undefined reference to `gzprintf'
nnhl.o:nnhl.c:(.text+0x13ae): undefined reference to `gzprintf'
nnhl.o:nnhl.c:(.text+0x13d2): undefined reference to `gzprintf'
nnhl.o:nnhl.c:(.text+0x13f6): undefined reference to `gzprintf'
nnhl.o:nnhl.c:(.text+0x1415): undefined reference to `gzprintf'
nnhl.o:nnhl.c:(.text+0x1451): more undefined references to `gzprintf' follow
collect2: ld returned 1 exit status
make[3]: *** [RJaCGH.dll] Error 1
make[2]: *** [srcDynlib] Error 2
make[1]: *** [all] Error 2
make: *** [pkg-RJaCGH] Error 2
*** Installation of RJaCGH failed ***




--
Ramon Diaz-Uriarte
Statistical Computing Team
Structural Biology and Biocomputing Programme
Spanish National Cancer Centre (CNIO)
http://ligarto.org/rdiaz

__
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