[Rd] Error "Warning in read_symbols_from_dll(so, rarch): this requires 'objdump.exe' to be on the PATH

2017-03-19 Thread Christophe Genolini

Hi all,

I try to compile my package kml and I get the message

Warning in read_symbols_from_dll(so,rarch):
this requires 'objdump.exe' to be on the PATH

I check 'Writing R Extensions' but I did not find any reference to this error. Does someone know how 
to fix that?


Thank you very much for your help.
Christophe

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


[Rd] Memcheck: Invalid read of size 4

2014-03-19 Thread Christophe Genolini

Hi the list,

One of my package has a memory issue that I do not manage to understand. The 
Memtest notes is here:
<http://www.stats.ox.ac.uk/pub/bdr/memtests/valgrind/kml-Ex.Rout>

Here is the message that I get from Memtest

--- 8< 
 ~ Fast KmL ~
==27283== Invalid read of size 4
==27283==at 0x10C5DF28: kml1 (kml.c:183)
...
==27283==by 0x10C5DE4F: kml1 (kml.c:151)
...
==27283==at 0x10C5DF90: kml1 (kml.c:198)
--- 8< 


Here is the function kml1 from the file kml.c (I add some comments to tag the 
lines 151, 183 and 198)

--- 8< 
void kml1(double *traj, int *nbInd, int *nbTime, int *nbClusters, int *maxIt, 
int *clusterAffectation1, int *convergenceTime){

int i=0,iter=0;
int *clusterAffectation2=malloc(*nbInd * sizeof(int));  
// lines 151
double *trajMean=malloc(*nbClusters * *nbTime * sizeof(double));

for(i = 0; i < *nbClusters * *nbTime; i++){trajMean[i] = 0.0;};
for(i = 0; i < *nbInd; i++){clusterAffectation2[i] = 0;};

for(iter = 0; iter < *maxIt; iter+=2){
calculMean(traj,nbInd,nbTime,clusterAffectation1,nbClusters,trajMean);
affecteIndiv(traj,nbInd,nbTime,trajMean,nbClusters,clusterAffectation2);

i = 0;
while(clusterAffectation1[i]==clusterAffectation2[i] && i 
<*nbInd){i++;}; // lines 183
if(i == *nbInd){
*convergenceTime = iter + 1;
break;
}else{};

calculMean(traj,nbInd,nbTime,clusterAffectation2,nbClusters,trajMean);
affecteIndiv(traj,nbInd,nbTime,trajMean,nbClusters,clusterAffectation1);

i = 0;
while(clusterAffectation1[i]==clusterAffectation2[i] && 
i<*nbInd){i++;}; // lines 198
if(i == *nbInd){
*convergenceTime = iter + 2;
break;
}else{};
}
}
--- 8< 

Do you know what is wrong in my C code?
Thanks

Christophe

--
Christophe Genolini
Maître de conférences en bio-statistique
Université Paris Ouest Nanterre La Défense
INSERM UMR 1027

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


Re: [Rd] Memcheck: Invalid read of size 4

2014-03-20 Thread Christophe Genolini

Thanks a lot. Your correction works just fine.

Any idea of what goes wrong for the line 151, which is

   int *clusterAffectation2=malloc(*nbInd * sizeof(int));  
// lines 151






On 19 Mar 2014, at 22:58 , Christophe Genolini  wrote:


Hi the list,

One of my package has a memory issue that I do not manage to understand. The 
Memtest notes is here:
<http://www.stats.ox.ac.uk/pub/bdr/memtests/valgrind/kml-Ex.Rout>

Here is the message that I get from Memtest

--- 8< 
~ Fast KmL ~
==27283== Invalid read of size 4
==27283==at 0x10C5DF28: kml1 (kml.c:183)
...
==27283==by 0x10C5DE4F: kml1 (kml.c:151)
...
==27283==at 0x10C5DF90: kml1 (kml.c:198)
--- 8< 


Here is the function kml1 from the file kml.c (I add some comments to tag the 
lines 151, 183 and 198)

--- 8< 
void kml1(double *traj, int *nbInd, int *nbTime, int *nbClusters, int *maxIt, 
int *clusterAffectation1, int *convergenceTime){

int i=0,iter=0;
int *clusterAffectation2=malloc(*nbInd * sizeof(int));  
// lines 151
double *trajMean=malloc(*nbClusters * *nbTime * sizeof(double));

for(i = 0; i < *nbClusters * *nbTime; i++){trajMean[i] = 0.0;};
for(i = 0; i < *nbInd; i++){clusterAffectation2[i] = 0;};

for(iter = 0; iter < *maxIt; iter+=2){
calculMean(traj,nbInd,nbTime,clusterAffectation1,nbClusters,trajMean);
affecteIndiv(traj,nbInd,nbTime,trajMean,nbClusters,clusterAffectation2);

i = 0;
while(clusterAffectation1[i]==clusterAffectation2[i] && i 
<*nbInd){i++;}; // lines 183
if(i == *nbInd){
*convergenceTime = iter + 1;
break;
}else{};

calculMean(traj,nbInd,nbTime,clusterAffectation2,nbClusters,trajMean);
affecteIndiv(traj,nbInd,nbTime,trajMean,nbClusters,clusterAffectation1);

i = 0;
while(clusterAffectation1[i]==clusterAffectation2[i] && 
i<*nbInd){i++;}; // lines 198
if(i == *nbInd){
*convergenceTime = iter + 2;
break;
}else{};
}
}
--- 8< 

Do you know what is wrong in my C code?

Yes. You need to reverse operands of &&. Otherwise you'll be indexing with 
i==*nbind before finding that (i < *nbind) is false.


Thanks

Christophe

--
Christophe Genolini
Maître de conférences en bio-statistique
Université Paris Ouest Nanterre La Défense
INSERM UMR 1027

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



--
Christophe Genolini
Maître de conférences en bio-statistique
Université Paris Ouest Nanterre La Défense
INSERM UMR 1027

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


[Rd] Memcheck: error in a switch using getGraphicsEvent

2014-03-20 Thread Christophe Genolini

Hi the list,

One of my package has an (other) error detected by memtest that I do not manage 
to understand.
Here is the message that I get from Memtest

--- 8< 
> try(choice(cld1))
Error in switch(EXPR = choix, Up = { : EXPR must be a length 1 vector
--- 8< 

The choice function does call the choiceChangeParam function, which is:

--- 8< 
choiceChangeParam <- function(paramChoice){

texte <- paste(" ~ Choice : menu~\n",sep="")

choix <- getGraphicsEvent(texte,onKeybd=function(key){return(key)})
switch(EXPR=choix,
   "Up"= {
   if(xy[1]>1){
   paramChoice['toDo'] <- "xy"
   xy[2]<-1
   xy[1]<-xy[1]-1
   paramChoice['xy']<-xy
   }else{paramChoice['toDo'] <- ""}
   },
   "Down"  = {
   if(xy[1]https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Memcheck: error in a switch using getGraphicsEvent

2014-03-21 Thread Christophe Genolini

Le 21/03/2014 01:45, Duncan Murdoch a écrit :

On 2014-03-20, 8:02 PM, Christophe Genolini wrote:

Hi the list,

One of my package has an (other) error detected by memtest that I do not manage 
to understand.
Here is the message that I get from Memtest

--- 8< 
  > try(choice(cld1))
Error in switch(EXPR = choix, Up = { : EXPR must be a length 1 vector
--- 8< 

The choice function does call the choiceChangeParam function, which is:

--- 8< 
choiceChangeParam <- function(paramChoice){

  texte <- paste(" ~ Choice : menu~\n",sep="")

  choix <- getGraphicsEvent(texte,onKeybd=function(key){return(key)})
  switch(EXPR=choix,
 "Up"= {
 if(xy[1]>1){
 paramChoice['toDo'] <- "xy"
 xy[2]<-1
 xy[1]<-xy[1]-1
 paramChoice['xy']<-xy
 }else{paramChoice['toDo'] <- ""}
 },
 "Down"  = {
 if(xy[1]

It can also return NULL, but to be sure, why not print the value?

Duncan Murdoch



Thanks for your answer. According to your suggestion, I add the line "cat" 
between the two other lines:
--- 8< -

choix <- getGraphicsEvent(texte,onKeybd=function(key){return(key)})
cat("Choix : ",choix," class :",class(choix)," length :",length(choix),"\n")
switch(EXPR=choix,

--- 8< -

I then make several attempts. In all the cases, the length of choix is 1:

--- 8< --
~ Choice : menu ~
Choix :  Down  class : character  length : 1
 ~ Choice : menu ~
Choix :  Up  class : character  length : 1
 ~ Choice : menu ~
Choix :  e  class : character  length : 1
 ~ Choice : menu ~
Choix :  ,  class : character  length : 1
 ~ Choice : menu ~
Choix : class : character  length : 1
 ~ Choice : menu ~
Choix :  9  class : character  length : 1
 ~ Choice : menu ~
Choix :  ctrl-I  class : character  length : 1
 ~ Choice : menu ~
Choix :  ²  class : character  length : 1
 ~ Choice : menu ~
Choix :  ctrl-J  class : character  length : 1
--- 8< -

--
Christophe Genolini
Maître de conférences en bio-statistique
Université Paris Ouest Nanterre La Défense
INSERM UMR 1027

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


[Rd] Defining Constant variable in a package

2015-05-15 Thread Christophe Genolini

Hi all,

In my package, I define some constant. In the previous version of R, I just define then in 
"/data/constants.R" but it seems that it is no longer possible. Instead, I am asked to "define them 
in the namespace". I am not sure to understand what it means. Shall I define them in the NAMESPACE 
file?


Christophe

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


Re: [Rd] Defining Constant variable in a package

2015-05-15 Thread Christophe Genolini
Hi Michael,

It works perfectly, thanks a lot!

Christophe

> I'm guessing you just need to define them in /R/constants.R and then export() 
> them from the NAMESPACE.
>
> On Fri, May 15, 2015 at 2:32 AM, Christophe Genolini  <mailto:cgeno...@u-paris10.fr>> wrote:
>
> Hi all,
>
> In my package, I define some constant. In the previous version of R, I 
> just define then in
> "/data/constants.R" but it seems that it is no longer possible. Instead, 
> I am asked to "define
> them in the namespace". I am not sure to understand what it means. Shall 
> I define them in the
> NAMESPACE file?
>
> Christophe
>
> __
> R-devel@r-project.org <mailto:R-devel@r-project.org> mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>
>


[[alternative HTML version deleted]]

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


[Rd] Depends/Imports/Suggest/Enhence

2012-11-06 Thread Christophe Genolini
Hi the list

In the DESCRIPTION file of my package foo0, I have:

Depends: foo1
Imports: foo2
Suggest: foo3
Enhence: foo4

If I understand correctly, to install foo0 on my computer, I need to already 
have foo1, foo2, foo3. 
foo4 is not necessary.

I my R sesssion, when I will write: library(foo0), then the package foo1 will 
be attach. foo2, foo3 
and foo4 will not. Is that correct?

But what is the difference between Import and Suggest?

Christophe

-- 
Christophe Genolini
Maître de conférences en bio-statistique
Vice président Communication interne et animation du campus
Université Paris Ouest Nanterre La Défense


[[alternative HTML version deleted]]

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


Re: [Rd] Depends/Imports/Suggest/Enhence

2012-11-06 Thread Christophe Genolini

 Thanks a lot for your answer.


(it is really "Suggests" and "Enhances" - the above are typos I presume and 
thus won't be recognized)

Yes, it was typo. Sorry

No, you only need foo1 and foo2. The other two are optional.

I get:

* checking package dependencies ... ERROR
Package suggested but not available: 'foo3'

"Imports" means that symbols are imported form the namespace, so they are mandatory for the 
package to operate. "Suggests" means that symbols from the package are not required, but they are 
used in examples or vignettes, so the listed package(s) will be needed for a full check. They are 
not needed for the operation of the package, though.

That's very clear, thanks a lot.
So I will use


 - 'Depends:foo1' if there is a function in foo1 that my package use often
 - 'Imports:foo2' if there is a function in foo2 that my package might use 
rarely
 - 'Suggest:foo3' if an example .Rd in foo0 needs a function in foo3

Right?


Cheers, Simon

Christophe

--
Christophe Genolini
Maître de conférences en bio-statistique
Vice président Communication interne et animation du campus
Université Paris Ouest Nanterre La Défense


[[alternative HTML version deleted]]

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





--
Christophe Genolini
Maître de conférences en bio-statistique
Vice président Communication interne et animation du campus
Université Paris Ouest Nanterre La Défense

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


[Rd] LazyData: no / yes

2012-11-06 Thread Christophe Genolini

Hi the list

I have package foo0 with a big dataset 'myData'.
In DESCRIPTION, if I use 'LazyData: no', then I get:

 - when I open a R session : memory used=20 908
 - when I attach 'library(foo0)' : memory used=24364
 - then I load the set 'data(myData)' : memory used=39 668

If I use LazyData: yes', then I get
 - when I open a R session : memory used=20 908
- when I attach 'library(foo0)' : memory used=52 760.

In this second example, after 'library(foo0)', I was expecting the memory to rize up to 39 668, not 
to 52 760... Where does the difference come from?


Thanks
Christophe


--
Christophe Genolini
Maître de conférences en bio-statistique
Vice président Communication interne et animation du campus
Université Paris Ouest Nanterre La Défense

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


Re: [Rd] LazyData: no / yes

2012-11-06 Thread Christophe Genolini

I get it from windows tack manager (under Window 7). I guess it is in K 
something.
My point was not about "how big is my dataset" (anyway, it is a fake dataset, so it can be as big as 
I want) but more about "where on hell are lost the 52 760 - 39 668 K ?"

:-)
Christophe

  
On Nov 6, 2012, at 1:03 PM, Christophe Genolini wrote:



Hi the list

I have package foo0 with a big dataset 'myData'.
In DESCRIPTION, if I use 'LazyData: no', then I get:

- when I open a R session : memory used=20 908
- when I attach 'library(foo0)' : memory used=24364
- then I load the set 'data(myData)' : memory used=39 668

If I use LazyData: yes', then I get
- when I open a R session : memory used=20 908
- when I attach 'library(foo0)' : memory used=52 760.

In this second example, after 'library(foo0)', I was expecting the memory to 
rize up to 39 668, not to 52 760... Where does the difference come from?


What do you mean by "memory used" - i.e. where do you get that from? After GC?
This certainly doesn't look like a "big dataset" by the numbers - I would 
classify that as tiny :)

Cheers,
Simon



Thanks
Christophe


--
Christophe Genolini
Maître de conférences en bio-statistique
Vice président Communication interne et animation du campus
Université Paris Ouest Nanterre La Défense

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







--
Christophe Genolini
Maître de conférences en bio-statistique
Vice président Communication interne et animation du campus
Université Paris Ouest Nanterre La Défense

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


Re: [Rd] LazyData: no / yes

2012-11-06 Thread Christophe Genolini
My real point was to explore the LazyData mechanism. So I try with LazyData: no and with LazyData: 
yes to see the difference, to see if I understand correctly the "WRE". The difference of the memory 
allocation pointed by the task manager alarm me, but you are right (I read the FAQ 7.42): my 
question has no real meaning.

Thanks for pointing me the 7.42.

Christophe

On Nov 6, 2012, at 5:13 PM, Christophe Genolini wrote:


I get it from windows tack manager (under Window 7). I guess it is in K 
something.
My point was not about "how big is my dataset" (anyway, it is a fake dataset, so it can 
be as big as I want) but more about "where on hell are lost the 52 760 - 39 668 K ?"
:-)

Ask your system ;) - you're comparing wrong things: a) you didn't run garbage 
collection so there will be temporary objects around and b) see FAQ 7.42 why 
what you're looking at has no real meaning.

Cheers,
Simon




Christophe


  On Nov 6, 2012, at 1:03 PM, Christophe Genolini wrote:


Hi the list

I have package foo0 with a big dataset 'myData'.
In DESCRIPTION, if I use 'LazyData: no', then I get:

- when I open a R session : memory used=20 908
- when I attach 'library(foo0)' : memory used=24364
- then I load the set 'data(myData)' : memory used=39 668

If I use LazyData: yes', then I get
- when I open a R session : memory used=20 908
- when I attach 'library(foo0)' : memory used=52 760.

In this second example, after 'library(foo0)', I was expecting the memory to 
rize up to 39 668, not to 52 760... Where does the difference come from?


What do you mean by "memory used" - i.e. where do you get that from? After GC?
This certainly doesn't look like a "big dataset" by the numbers - I would 
classify that as tiny :)

Cheers,
Simon



Thanks
Christophe


--
Christophe Genolini
Maître de conférences en bio-statistique
Vice président Communication interne et animation du campus
Université Paris Ouest Nanterre La Défense

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




--
Christophe Genolini
Maître de conférences en bio-statistique
Vice président Communication interne et animation du campus
Université Paris Ouest Nanterre La Défense







--
Christophe Genolini
Maître de conférences en bio-statistique
Vice président Communication interne et animation du campus
Université Paris Ouest Nanterre La Défense

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


[Rd] Comments in the DESCRIPTION file

2012-11-07 Thread Christophe Genolini

Hi all,

Is it possible to add comments in the DESCRIPTION file?

Sincerely
Christophe

--
Christophe Genolini
Maître de conférences en bio-statistique
Vice président Communication interne et animation du campus
Université Paris Ouest Nanterre La Défense

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


[Rd] What is the INDEX file for?

2012-11-09 Thread Christophe Genolini

Hi the list,

In WRE (or in Rdindex), we can find how the INDEX is make, how to change it, but I do not manage to 
find the purpose of this file. So what is the INDEX file for?


Thanks
Christophe

--
Christophe Genolini
Maître de conférences en bio-statistique
Vice président Communication interne et animation du campus
Université Paris Ouest Nanterre La Défense

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


[Rd] "R CMD check" does not find a mistake

2009-06-09 Thread Christophe Genolini

Hi the list,

I build a package. They was a mistake in it, but R CMD check did not 
find it. Is that normal ?


Here is what Kurt gets (which is right, I did this mistake):

--- 8< 
* checking for code/documentation mismatches ... WARNING
S4 class codoc mismatches from documentation object 'LongData-class':
Slots for class 'LongData'
Code: id other time traj varName
Docs: id time traj varName
--- 8< 

But here is what I get on my computer:

--- 8< 
C:\Documents and Settings\Christophe\Mes 
documents\Recherche\Trajectoires\kmeal>

R CMD check longitudinalData
* checking for working pdflatex ... OK
* using log directory 'C:/Documents and Settings/Christophe/Mes 
documents/Recher

che/Trajectoires/kmeal/longitudinalData.Rcheck'
* using R version 2.9.0 Patched (2009-06-07 r48733)
* using session charset: ISO8859-1
* checking for file 'longitudinalData/DESCRIPTION' ... OK
* checking extension type ... Package
* this is package 'longitudinalData' version '0.5'
* package encoding: latin1
* checking package dependencies ... OK
* checking if this is a source package ... OK
* checking for .dll and .exe files ... OK
* checking whether package 'longitudinalData' can be installed ... OK
* checking package directory ... OK
* checking for portable file names ... OK
* checking DESCRIPTION meta-information ... OK
* checking top-level files ... OK
* checking index information ... OK
* checking package subdirectories ... OK
* checking R files for non-ASCII characters ... OK
* checking R files for syntax errors ... OK
* checking whether the package can be loaded ... OK
* checking whether the package can be loaded with stated dependencies ... OK
* checking for unstated dependencies in R code ... OK
* checking S3 generic/method consistency ... OK
* checking replacement functions ... OK
* checking foreign function calls ... OK
* checking R code for possible problems ... OK
* checking Rd files ... OK
* checking Rd files against version 2 parser ... OK
* checking Rd cross-references ... OK
* checking for missing documentation entries ... OK
* checking for code/documentation mismatches ... OK
* checking Rd \usage sections ... OK
* checking examples ... OK
* checking PDF version of manual ... OK


C:\Documents and Settings\Christophe\Mes 
documents\Recherche\Trajectoires\kmeal>

R CMD build longitudinalData
* checking for file 'longitudinalData/DESCRIPTION' ... OK
* preparing 'longitudinalData':
* checking DESCRIPTION meta-information ... OK
* removing junk files
* checking for LF line-endings in source and make files
* checking for empty or unneeded directories
* building 'longitudinalData_0.5.tar.gz'
--- 8< 

Christophe

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


[Rd] Inheritance before ANY...

2009-06-09 Thread Christophe Genolini

Hi all,
I am programming using S4. I define two classes, "B" is inheriting from 
"A". Apparently (at least since version 2.9.0 ?), when the correct 
signature is not find,
R prefers to chose a signature in the ancestor BEFORE a signature in the 
class. This is very strange to me...


If I define plot for ("A",missing) and ("B",ANY), calling 
plot("B",missing), I would expect R to chose plot("B",ANY) before 
plot("A",missing)


Sincerely
Christophe


-- (translate from french) 
Note : method with signature "A#missing" chose for function "plot",
signature cible "B#missing".
"B#ANY" could also be compatible

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


[Rd] "median" accepting ordered factor

2009-06-13 Thread Christophe Genolini

Hi the list,
The function median start by exclude the factor. Indeed, it not possible 
to calculate the median for a factor, but it is possible to evaluate the 
median for an ordered factor.
Would it be possible to change the median function to accept also 
ordered factor? This would be helpful specially in social science...

Christophe


median <- function(x, na.rm=FALSE) UseMethod("median")

median.default <- function(x, na.rm = FALSE)
{
   if(is.factor(x) & !is.ordered(x)) stop("need numeric or ordered data")
   ## all other objects only need sort() & sum() to be working
   if(length(names(x))) names(x) <- NULL # for e.g., c(x = NA_real_)
   if(na.rm) x <- x[!is.na(x)] else if(any(is.na(x))) return(x[FALSE][NA])
   n <- length(x)
   if (n == 0L) return(x[FALSE][NA])
   half <- (n + 1L) %/% 2L
   if(n %% 2L == 1L | is.ordered(x)) sort(x, partial = half)[half]
   else sum(sort(x, partial = half + 0L:1L)[half + 0L:1L])/2
}

a1 <- factor(letters[c(1,2,3,2,3,1,3,5,4,3,4,1,1,1,1,1)],ordered=TRUE)
a2 <- factor(letters[c(1,2,3,2,3,1,3,5,4,3,4,1,1,1,1,1,1)],ordered=TRUE)
median(a1)
median(a2)

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


[Rd] Argument as.integer(NA) to a function C

2009-06-18 Thread Christophe Genolini

Hi the list,
I am writing a R function that call a C function. The C function needs 
integers but I do not manage to give a NA integer as argument :


--- C code ---
void essai(int *t){
   Rprintf("\nT0=%i T1=%i T2=%i T3=%i",t[0],t[1],t[2],t[3]);
}

--- R ---
boub <- c(1,2,3,4)
.C("pour",as.integer(boub),NAOK=TRUE)

# T0=1 T1=2 T2=3 T3=4[[1]]
# [1] 1 2 3 4

boub <- c(1,2,NA,4)
.C("essai",as.integer(boub),NAOK=TRUE)

# T0=1 T1=2 T2=-2147483648 T3=4[[1]]
# [1]  1  2 NA  4
--- ---

In the second example, T2=-2147483648 and not NA.

I check the "writing R extension", there is a part that explain that the 
test of NA is not the same between double and integer (NA_INTEGER, 
ISNA), but I did not find explanation on passing NA argument as integer.


Any idea of what is wrong in my code?

Christophe

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


[Rd] Package that does not work until I re write the exactly the same code

2009-09-09 Thread Christophe Genolini

Hi the list,

I am writing a package in S4 and I do not manage to understand a bug.
The "R CMD check" and the "R CMD build" both work. Here is links to the 
package (not on CRAN yet for the raison that I explain bellow):


http://christophe.genolini.free.fr/aTelecharger/kml_0.5.zip
http://christophe.genolini.free.fr/aTelecharger/kml_0.5.tar.gz

Then I install the package and I try an example:

--- 8< --
library(kml)
dn <- as.cld(gald())
kml(dn)
# XXX ~ Fast KmL ~
# Erreur dans as.vector(x, mode) : argument 'mode' incorrect
--- 8< --


So I make some verifications:
--- 8< 
class(dn)
# [1] "ClusterizLongData"
# attr(,"package")
# [1] "kml"

getMethod("kml","ClusterizLongData")
# Method Definition:
#
# function (Object, nbClusters = 2:6, nbRedrawing = 20, saveFreq = 100,
#   maxIt = 200, trajMinSize = 2, print.cal = FALSE, print.traj = FALSE,
#imputationMethod = "copyMean", distance, power = 2, centerMethod = 
meanNA,
#startingCond = "allMethods", distanceStartingCond = "euclidean", 
#   ...)

#{
#   nbIdFull <- nrow(Object["traj"])
# .. [[[The full code is available below]]]
# }
# 
#
#Signatures:
#   Object
# target  "ClusterizLongData"

# defined "ClusterizLongData"
--- 8< 

Everything seems fine. The code is correct.
So I copy-and-paste the code that I get with 
getMethods("kml","ClusterizLongData") and I affect it to a function 
"func". Then I define again the method "kml".


Then I run again the example that does not work before and it works...
Any explanations?

Christophe Genolini

--- 8< --
###
### Affecting to func the code that getMethod("kml","ClusterizLongData") 
delivers

###
func <- function (Object, nbClusters = 2:6, nbRedrawing = 20, saveFreq = 
100,

   maxIt = 200, trajMinSize = 2, print.cal = FALSE, print.traj = FALSE,
   imputationMethod = "copyMean", distance, power = 2, centerMethod = 
meanNA,

   startingCond = "allMethods", distanceStartingCond = "euclidean",
   ...)
{
   nbIdFull <- nrow(Object["traj"])
   convergenceTime <- 0
   noNA <- selectSupTrajMinSize(Object, trajMinSize)
   trajNoNA <- Object["traj"][noNA, ]
   nbTime <- length(Object["time"])
   nbId <- nrow(trajNoNA)
   saveCld <- 0
   scr <- plotAll(Object, print.cal = print.cal, print.traj = print.traj,
   print.sub = FALSE, col = "black", type.mean = "n")
   if (length(startingCond) == 1) {
   if (startingCond == "allMethods") {
   startingCond <- c("maxDist", "randomAll", rep("randomK",
   nbRedrawing))[1:nbRedrawing]
   }
   else {
   startingCond <- rep(startingCond, nbRedrawing)
   }
   }
   else {
   }
   if (missing(distance)) {
   distance <- "euclidean"
   }
   if (is.character(distance)) {
   distInt <- pmatch(distance, METHODS)
   }
   else {
   distInt <- NA
   }
   if (print.traj) {
   cat(" ~ Slow KmL ~\n")
   fast <- FALSE
   screenPlot <- scr[2]
   if (!is.na(distInt)) {
   distanceSlow <- function(x, y) {
   dist(rbind(x, y), method = distance)
   }
   }
   else {
   distanceSlow <- distance
   }
   }
   else {
   screenPlot <- NA
   if (is.na(distInt)) {
   cat(" ~ Slow KmL ~\n")
   fast <- FALSE
   distanceSlow <- distance
   }
   else {
   cat(" ~ Fast KmL ~\n")
   fast <- TRUE
   }
   }
   nameObject <- deparse(substitute(Object))
   for (iRedraw in 1:nbRedrawing) {
   for (iNbClusters in nbClusters) {
   saveCld <- saveCld + 1
   clustersInit <- partitionInitialise(nbClusters = iNbClusters,
   method = startingCond[iRedraw], lengthPart = nbId,
   matrixDist = as.matrix(dist(trajNoNA, method = 
distanceStartingCond)))

   clust <- rep(NA, nbIdFull)
   if (fast) {
   resultKml <- .C("kml1", as.double(t(trajNoNA)),
 iNbInd = as.integer(nbId), iNbTime = as.integer(nbTime),
 iNbCluster = as.integer(iNbClusters), maxIt = 
as.integer(maxIt),
 distance = as.integer(distInt), power = 
as.numeric(power),
 vClusterAffectation1 = 
as.integer(clustersInit["clusters"]),

 convergenceTime = as.integer(convergenceTime),
 NAOK = TRUE, PACKAGE = "kml")[c(8, 9)]
   clust[noNA] <- resultKml[[1]]
   }
   else {
   resultKml <- trajKmlSlow(traj = trajNoN

Re: [Rd] Package that does not work until I re write the exactly the same code

2009-09-10 Thread Christophe Genolini

Martin Morgan find the solution. Before
  setMethod("kml","ClusterizLongData",func)
kml was in environment kml, After, kml is in environment global.

So, using traceback(), we find that kml use an object Partition that is 
define in another package and that was export to the global environment 
but not to kml environment.

Adding import or importForm in NAMESPACE solve the problem.

Christophe


Hi the list,

I am writing a package in S4 and I do not manage to understand a bug.
The "R CMD check" and the "R CMD build" both work. Here is links to 
the package (not on CRAN yet for the raison that I explain bellow):


http://christophe.genolini.free.fr/aTelecharger/kml_0.5.zip
http://christophe.genolini.free.fr/aTelecharger/kml_0.5.tar.gz

Then I install the package and I try an example:

--- 8< --
library(kml)
dn <- as.cld(gald())
kml(dn)
# XXX ~ Fast KmL ~
# Erreur dans as.vector(x, mode) : argument 'mode' incorrect
--- 8< --


So I make some verifications:
--- 8< 
class(dn)
# [1] "ClusterizLongData"
# attr(,"package")
# [1] "kml"

getMethod("kml","ClusterizLongData")
# Method Definition:
#
# function (Object, nbClusters = 2:6, nbRedrawing = 20, saveFreq = 100,
#   maxIt = 200, trajMinSize = 2, print.cal = FALSE, print.traj = FALSE,
#imputationMethod = "copyMean", distance, power = 2, centerMethod 
= meanNA,
#startingCond = "allMethods", distanceStartingCond = "euclidean", 
#   ...)

#{
#   nbIdFull <- nrow(Object["traj"])
# .. [[[The full code is available below]]]
# }
# 
#
#Signatures:
#   Object# target  "ClusterizLongData"
# defined "ClusterizLongData"
--- 8< 

Everything seems fine. The code is correct.
So I copy-and-paste the code that I get with 
getMethods("kml","ClusterizLongData") and I affect it to a function 
"func". Then I define again the method "kml".


Then I run again the example that does not work before and it works...
Any explanations?

Christophe Genolini

--- 8< --
###
### Affecting to func the code that 
getMethod("kml","ClusterizLongData") delivers

###
func <- function (Object, nbClusters = 2:6, nbRedrawing = 20, saveFreq 
= 100,

   maxIt = 200, trajMinSize = 2, print.cal = FALSE, print.traj = FALSE,
   imputationMethod = "copyMean", distance, power = 2, centerMethod = 
meanNA,

   startingCond = "allMethods", distanceStartingCond = "euclidean",
   ...)
{
   nbIdFull <- nrow(Object["traj"])
   convergenceTime <- 0
   noNA <- selectSupTrajMinSize(Object, trajMinSize)
   trajNoNA <- Object["traj"][noNA, ]
   nbTime <- length(Object["time"])
   nbId <- nrow(trajNoNA)
   saveCld <- 0
   scr <- plotAll(Object, print.cal = print.cal, print.traj = print.traj,
   print.sub = FALSE, col = "black", type.mean = "n")
   if (length(startingCond) == 1) {
   if (startingCond == "allMethods") {
   startingCond <- c("maxDist", "randomAll", rep("randomK",
   nbRedrawing))[1:nbRedrawing]
   }
   else {
   startingCond <- rep(startingCond, nbRedrawing)
   }
   }
   else {
   }
   if (missing(distance)) {
   distance <- "euclidean"
   }
   if (is.character(distance)) {
   distInt <- pmatch(distance, METHODS)
   }
   else {
   distInt <- NA
   }
   if (print.traj) {
   cat(" ~ Slow KmL ~\n")
   fast <- FALSE
   screenPlot <- scr[2]
   if (!is.na(distInt)) {
   distanceSlow <- function(x, y) {
   dist(rbind(x, y), method = distance)
   }
   }
   else {
   distanceSlow <- distance
   }
   }
   else {
   screenPlot <- NA
   if (is.na(distInt)) {
   cat(" ~ Slow KmL ~\n")
   fast <- FALSE
   distanceSlow <- distance
   }
   else {
   cat(" ~ Fast KmL ~\n")
   fast <- TRUE
   }
   }
   nameObject <- deparse(substitute(Object))
   for (iRedraw in 1:nbRedrawing) {
   for (iNbClusters in nbClusters) {
   saveCld <- saveCld + 1
   clustersInit <- partitionInitialise(nbClusters = iNbClusters,
   method = startingCond[iRedraw], lengthPart = nbId,
   matrixDist = as.matrix(dist(trajNoNA, method = 
distanceStartingCond)))

   clust <- rep(NA, nbIdFull)
   if (fast) {
   resultKml <- .C("kml1", as.double(t(trajNoNA)),
 iNbInd = as.integer(nbId), iNbTime = as.integer(nbTime),
 iNbCluster = as.integer(iNbClusters), maxIt = 
as.integer(maxIt),
   

[Rd] Canberra distance

2010-02-06 Thread Christophe Genolini

Hi the list,

According to what I know, the Canberra distance between X et Y is : sum[ 
(|x_i - y_i|) / (|x_i|+|y_i|) ] (with | | denoting the function 
'absolute value')
In the source code of the canberra distance in the file distance.c, we 
find :


   sum = fabs(x[i1] + x[i2]);
   diff = fabs(x[i1] - x[i2]);
   dev = diff/sum;

which correspond to the formula : sum[ (|x_i - y_i|) / (|x_i+y_i|) ]
(note that this does not define a distance... This is correct when x_i 
and y_i are positive, but not when a value is negative.)


Is it on purpose or is it a bug?

Christophe

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


Re: [Rd] Canberra distance

2010-02-06 Thread Christophe Genolini
The definition I use is the on find in the book "Cluster analysis" by 
Brian Everitt, Sabine Landau and Morven Leese.
They cite, as definition paper for Canberra distance, an article of 
Lance and Williams "Computer programs for hierarchical polythetic 
classification" Computer Journal 1966.
I do not have access, but here is the link : 
http://comjnl.oxfordjournals.org/cgi/content/abstract/9/1/60

Hope this helps.

Christophe

On 06/02/2010 10:39 AM, Christophe Genolini wrote:

Hi the list,

According to what I know, the Canberra distance between X et Y is : 
sum[ (|x_i - y_i|) / (|x_i|+|y_i|) ] (with | | denoting the function 
'absolute value')
In the source code of the canberra distance in the file distance.c, 
we find :


sum = fabs(x[i1] + x[i2]);
diff = fabs(x[i1] - x[i2]);
dev = diff/sum;

which correspond to the formula : sum[ (|x_i - y_i|) / (|x_i+y_i|) ]
(note that this does not define a distance... This is correct when 
x_i and y_i are positive, but not when a value is negative.)


Is it on purpose or is it a bug?


It matches the documentation in ?dist, so it's not just a coding 
error.  It will give the same value as your definition if the two 
items have the same sign (not only both positive), but different 
values if the signs differ.


The first three links I found searching Google Scholar for "Canberra 
distance" all define it only for non-negative data.  One of them gave 
exactly the R formula (even though the absolute value in the 
denominator is redundant), the others just put x_i + y_i in the 
denominator.


None of the 3 papers cited the origin of the definition, so I can't 
tell you who is wrong.


Duncan Murdoch




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


Re: [Rd] Canberra distance and binary distance

2010-02-06 Thread Christophe Genolini

I guess there is also a problem in the binary distance since

x <- y <- rep(0,10)
dist(rbind(x,y),method="binary")

gives 0 whereas it suppose to be undefine. (the aka asymmetric binary is 
not suppose to take in account the (off,off) couples in its calculation)


Christophe

The definition I use is the on find in the book "Cluster analysis" by 
Brian Everitt, Sabine Landau and Morven Leese.
They cite, as definition paper for Canberra distance, an article of 
Lance and Williams "Computer programs for hierarchical polythetic 
classification" Computer Journal 1966.
I do not have access, but here is the link : 
http://comjnl.oxfordjournals.org/cgi/content/abstract/9/1/60

Hope this helps.

Christophe

On 06/02/2010 10:39 AM, Christophe Genolini wrote:

Hi the list,

According to what I know, the Canberra distance between X et Y is : 
sum[ (|x_i - y_i|) / (|x_i|+|y_i|) ] (with | | denoting the function 
'absolute value')
In the source code of the canberra distance in the file distance.c, 
we find :


sum = fabs(x[i1] + x[i2]);
diff = fabs(x[i1] - x[i2]);
dev = diff/sum;

which correspond to the formula : sum[ (|x_i - y_i|) / (|x_i+y_i|) ]
(note that this does not define a distance... This is correct when 
x_i and y_i are positive, but not when a value is negative.)


Is it on purpose or is it a bug?


It matches the documentation in ?dist, so it's not just a coding 
error.  It will give the same value as your definition if the two 
items have the same sign (not only both positive), but different 
values if the signs differ.


The first three links I found searching Google Scholar for "Canberra 
distance" all define it only for non-negative data.  One of them gave 
exactly the R formula (even though the absolute value in the 
denominator is redundant), the others just put x_i + y_i in the 
denominator.


None of the 3 papers cited the origin of the definition, so I can't 
tell you who is wrong.


Duncan Murdoch







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


[Rd] Portability of a C function

2010-02-14 Thread Christophe Genolini

Hi the list,

In a package P1, I write a function f1 in C, potentially an internal 
function (not to be called from R).
In a package P2, I write a function f2 in C. The f2 function needs to 
use f1 from P1. Is it possible ?


--- 8<  In file P1.c -
double f1(x,y){
  
}

--- 8<  In file P2.c -
void f2(x,y,z){
  double result;
  
  result = f1(x,y);
  
}

Thanks
Christophe

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


Re: [Rd] Portability of a C function

2010-02-14 Thread Christophe Genolini

Thanks, this helps a lot.

So if I understand correctly:
in package P1, I want to export printMatrix and printMatrixInt. In my 
file P1.c, I have to add


void R_init_P1(DllInfo *info){
   R_registerCCallable("longitudinalData","printMatrix",printMatrix);
   R_registerCCallable("longitudinalData","printMatrixInt",printMatrixInt);
};


In P2.c, I have to add :

void R_init_P2(DllInfo *info){
   printMatrix = R_GetCCallable("longitudinalData","printMatrix");
   printMatrixInt = R_GetCCallable("longitudinalData","printMatrixInt");
};


I still have a problem here: "Writing R ext" say that 'printMatrix' and 
'printMatrixInt' should have "an appropriate declaration". What is the 
appropriate declaration?


Christophe



Hello,

This was discussed this week in the thread "LinkingTo and C++".

It is possible, and documented in WRE section 5.4 : 
http://cran.r-project.org/doc/manuals/R-exts.html#Registering-native-routines 



Romain

On 02/14/2010 12:58 PM, Christophe Genolini wrote:


Hi the list,

In a package P1, I write a function f1 in C, potentially an internal
function (not to be called from R).
In a package P2, I write a function f2 in C. The f2 function needs to
use f1 from P1. Is it possible ?

--- 8<  In file P1.c -
double f1(x,y){

}

--- 8<  In file P2.c -
void f2(x,y,z){
double result;

result = f1(x,y);

}

Thanks
Christophe




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


[Rd] Strange behavior of assign in a S4 method.

2010-03-15 Thread Christophe Genolini

Hi the list,
I define a method that want to change an object without assignation 
(foo(x) and not x<-foo(x)) using deparse and assign.
But when the argument of the method does not match *exactly* with the 
definition of the generic function, assign does not work...

Anything wrong?

Christophe

#-- Does not work --#
setGeneric("foo1",function(x,...){standardGeneric("foo1")})

setMethod(f="foo1",signature="numeric",definition=
   function(x,y=1,...){
   nameX<-deparse(substitute(x))
   x <- x^2
   assign(nameX,x,envir=parent.frame())
   }
)

e <- 3
foo1(e,y=5)
cat(e)


#-- Does work --#
setGeneric("foo2",function(x,...){standardGeneric("foo2")})

setMethod(f="foo2",signature="numeric",definition=
   function(x,...){
   nameX<-deparse(substitute(x))
   x <- x^2
   assign(nameX,x,envir=parent.frame())
   }
)

e <- 3
foo2(e,y=5)
cat(e)

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


Re: [Rd] Strange behavior of assign in a S4 method.

2010-03-16 Thread Christophe Genolini

Dear Wolfgang,

Thanks for the showMethod and the link.



Perhaps juggling with the 'n' argument of 'parent.frame' could help in 
hacking something together that 'works'
I just change the argument list of foo2 to perfectly match with the 
definition.
but as far as I can see what you want to is an abuse of R's pass by 
value / functional language semantics.


Yes I kown. When I learnt object programming, one of the basic was that 
some methods was design to change internals value of the fields. It is 
what I try to do here.
For example, try these and check whether this results in what you 
intended:


foo2(3)
foo2(e+2)
sapply(1:5, foo2)
ls()
This will not apply, because I my case, the function foo2 is avalable 
only for object of class FooClass and the only possible use will be :


toto <- new("FooClass")

foo2(toto)

Best wishes
Christophe


    Best wishes
Wolfgang


Christophe Genolini scripsit 15/03/10 11:33:

Hi the list,
I define a method that want to change an object without assignation 
(foo(x) and not x<-foo(x)) using deparse and assign.
But when the argument of the method does not match *exactly* with the 
definition of the generic function, assign does not work...

Anything wrong?

Christophe

#-- Does not work --#
setGeneric("foo1",function(x,...){standardGeneric("foo1")})

setMethod(f="foo1",signature="numeric",definition=
   function(x,y=1,...){
   nameX<-deparse(substitute(x))
   x <- x^2
   assign(nameX,x,envir=parent.frame())
   }
)

e <- 3
foo1(e,y=5)
cat(e)


#-- Does work --#
setGeneric("foo2",function(x,...){standardGeneric("foo2")})

setMethod(f="foo2",signature="numeric",definition=
   function(x,...){
   nameX<-deparse(substitute(x))
   x <- x^2
   assign(nameX,x,envir=parent.frame())
   }
)

e <- 3
foo2(e,y=5)
cat(e)

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




--
Wolfgang Huber
EMBL
http://www.embl.de/research/units/genome_biology/huber/contact





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


[Rd] S4: Documenting several fields at once

2010-03-22 Thread Christophe Genolini

Hi all,
I defined an S4 object in which there is a lot of fields that have very 
similar names and purposes.

--- 8< --
setClass(
  Class="foo",
  representation=representation(
 c2="list",
 c3="list",
 c4="list",
 c5="list",
 c6="list",
 c7="list",
   ...
 c26="list"
 )
)
--- 8< --

In the documentation (Rd file), is there a way to describe only one of 
the field, then say all the other work the same way?


--- 8< --
\section{Slots}{
 \describe{
   \item{\code{c2}}{list of Clustering with 2 clusters.}
   \item{\code{c3}}{list of Clustering with 3 clusters.}
   \item{\code{c4} ... \code{c26}}{list of Clustering with 4, ..., 26 
clusters.}

 }
}
--- 8< -

Thanks

Christophe

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


[Rd] Using SVN + SSH on windows

2010-03-27 Thread Christophe Genolini

Hi the list,
I try to use R-Forge for developping a projet. I am using tortoise SVN 
(last version) but I do not manage to Commit. I read the R-Forge user 
Manual and some post on  but I do not manage to find the solution. Here 
is what I did:


1/ I download 'puttygen.exe'. I generate a key (256 bits).
2/ I save the private key in a file 'private.ppk' on my computer.
3/ I copy-paste the public key on sourceforge
ssh-rsa 
B3NzaC1yc2EBJQAAACEAobwycGGZrMZ39i7Vtrdk3ahN1hVw/tPoiShJGk1xjRs= 
rsa-key-20100327

4/ I wait two hours.
5/ On my computer, I run 'pageant.exe'.
6/ I click on 'Add key'. I load the file 'private.ppk'
7/ I close 'pageant.exe' (still actif in the task bar).
8/ I open explorer. I create a directory that is suppose to be the 
local directoy for the projet.

9/ I right-click on the directory. I open 'SVN checkout'
10/ In 'URL of  repository:', I write : 
'svn+ssh://christo...@svn.r-forge.r-project.org/svnroot/kml3d'

(christophe is my accoung, kml3d is the project)
And...

...nothing happen. No bug, not warning, nothing.

I try several things: if I do 
'svn://christo...@svn.r-forge.r-project.org/svnroot/kml3d', I do manage 
to download the project. But then, I do not manage to upload some 
modification.


I also see on some tutorial that we might need putty.exe or plink.exe. I 
download them, but R-Forge user Manual do not mention them.


Any idea of what goes wrong ?

Thanks
Christophe

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


Re: [Rd] Using SVN + SSH on windows

2010-03-27 Thread Christophe Genolini

Henrik Bengtsson a écrit :

2010/3/27 hb :
  

On Sat, Mar 27, 2010 at 3:12 PM, Christophe Genolini  
wrote:


Hi the list,
I try to use R-Forge for developping a projet. I am using tortoise SVN (last
version) but I do not manage to Commit. I read the R-Forge user Manual and
some post on  but I do not manage to find the solution. Here is what I did:

1/ I download 'puttygen.exe'. I generate a key (256 bits).
2/ I save the private key in a file 'private.ppk' on my computer.
3/ I copy-paste the public key on sourceforge
ssh-rsa
B3NzaC1yc2EBJQAAACEAobwycGGZrMZ39i7Vtrdk3ahN1hVw/tPoiShJGk1xjRs=
rsa-key-20100327
4/ I wait two hours.
5/ On my computer, I run 'pageant.exe'.
6/ I click on 'Add key'. I load the file 'private.ppk'
7/ I close 'pageant.exe' (still actif in the task bar).
8/ I open explorer. I create a directory that is suppose to be the local
directoy for the projet.
9/ I right-click on the directory. I open 'SVN checkout'
10/ In 'URL of  repository:', I write :
'svn+ssh://christo...@svn.r-forge.r-project.org/svnroot/kml3d'
(christophe is my accoung, kml3d is the project)
And...

...nothing happen. No bug, not warning, nothing.

I try several things: if I do
'svn://christo...@svn.r-forge.r-project.org/svnroot/kml3d', I do manage to
download the project. But then, I do not manage to upload some modification.
  

All looks ok, but I think you are using the wrong protocol. It should be 
'svn+ssh' for *commits*, i.e.

svn+ssh://christo...@svn.r-forge.r-project.org/svnroot/kml3d

which *is* shown at http://r-forge.r-project.org/scm/?group_id=727



  
Now, in addition, I configure putty as Uwe advice me. I follow the 
tutorial http://www.mono-project.com/Putty_and_TortoiseSvn

Sorry, I missed that you've tried that (I scrolled past it on my small screen).

- When you generated a key in PUTTYgen, did you enter a passphrase?  I
think you have to leave that blank.

- Make sure not to have any newlines/spaces in the key, when you paste
it, that is, you should have:

Line 1: ssh-rsa
Line 2: 
  
On two line ? On R-forge, they say "/Make sure there are no line breaks 
except between keys."/

You can have multiple entries as the above.

- You need to checkout with the svn+ssh URL, because that it is what
TortoiseSVN will use for commits (unless you do "relocate").  If you
can checkout using this protocol, you should be able to commit.  Thus,
focus your troubleshooting on checking out.

- In the "Default Settings" PuTTY Configurations, make sure "Attempt
authentication using Pageant" is checked under the Connection -> SSH
-> Auth panel.
  

I did

- Make sure Pageant lists the key in its dialog.

  

It is.


Does it work?

  

No. In "putty", I get :
"login as: christophe"

Then a pop up say : "Assertion failed!
Program:...\pageant.exe
File: ..\sshrsa.c
Line:793
..."

Then I click "ignore"

On putty again :

"Authenticating with public key "rsa-key-20100327" from agent
Access denied
christo...@kml3d.r-forge.r-project.org's password:
Linux xmrforge2 2.6.18-xen #1 SMP Fri May 18 16:01:42 BST 2007 x86_64

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Sat Mar 27 17:56:55 2010 from 
def92-4-82-225-59-146.fbx.proxad.net

This is a restricted account.
You cannot execute anything here.
Goodbye."




/Henrik

  

/Henrik

PS. Don't think you need plink, but I might be wrong.



I also see on some tutorial that we might need putty.exe or plink.exe. I
download them, but R-Forge user Manual do not mention them.

Any idea of what goes wrong ?

Thanks
Christophe

__
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] Possible improvements/clarifications for R-forge (Was: Re: Using SVN + SSH on windows)

2010-03-28 Thread Christophe Genolini

Wahou! I did not plan to start such a debate...
It is really not hard to set it up. I am using a vanilla ssh (rather 
than putty) and that works fine all the time...
The problem is not how hard or easy it is, the problem is how time 
consuming it is.


I am pretty sur that I will manage to make it work. But when? I allready 
lose three hours Friday and two hour on saturday... That's definitly too 
much. Because I am not an engeneer in computing, I am a researcher. To 
make my research, I have to be expert in longitudinal data, in 
clustering, in anorexia, I have to speak english, I have to know R, and 
C, and package managing, and LaTeX, and gimp, and... and... and...

There is so many things to know... I can not be expert in all.

So I do not have time to (and I do not want to) explore all the ssh 
subtulties... Worse, I have a project, I manage to find some people that 
want to work on the projet (but that also have a lot of other staff to 
do), I do not want them to give up because it will take to much time for 
them to make ssh run.


Generalier, I think that anything should be done to make tools easy to 
use for non-expert, because more and more R user are occasional user. 
They are not experts, they don't want to become expert. They are just 
feed up to pay a lot of money for SPSS or Stata... But I guess this is 
another debate.


Christophe

I wonder why nobody included the R-forge maintainer in this thread so 
far. Let me add Stefan now.


Best wishes,
Uwe



On 28.03.2010 18:34, Henrik Bengtsson wrote:

Hi,

first, r-forge.r-project.org is filling a need and provides a great
service to the community.  Please read this thread as sincere feedback
for making it even better, not as a complaint.  I fully understand
that r-forge is ran by limited resources and on a volunteer basis.
I'll list some points about r-forge that I think could be
improved/clarified.  Not expecting anything, just sharing my
experience.


1. Part of the R-forge services runs on a schedule, e.g. building and
checking packages.  As a user you do not really know when this
happens.

Some of this is documented at http://site.r-forge.r-project.org/, but
not everything, e.g. as seen in another message on r-devel, the cron
job for updating SSH keys is not specified.  Moreover, all static
documentation tends to become outdated.  In other words, as a user I
am not certain that http://site.r-forge.r-project.org/ is up to date.

Providing some kind of online log of what the r-forge servers are
doing would help the user to plan, troubleshoot etc.  Right now there
are too many degrees of freedom to figure out what and when things
happens.  The Bioconductor project provides a small log summary/status
with timestamps of the last run, cf. small box at the top of
http://bioconductor.org/checkResults/2.6/bioc-LATEST/.



2. It is not possible to check the R CMD build/check log files for
other people's packages.

The log files are considered private to the project members.  This
means that I cannot troubleshoot other packages part of projects that
I am not a member.  This limits my chances to troubleshoot problems I
have when my package depends on an external package.  It also limits
my chances to contribute with troubleshooting/bug reports for other
packages.  This is one of the features that makes the Bioconductor
repository a success. Making these log files public would improve lots
of things.


3. For some OSes, the log files for the build and check of packages 
are missing.


For instance, none of my packages has log files for Linux x86_32, e.g.
"Logfile for R.batch not available.".  It is not clear if this is
because I made something wrong, or this is the flavor of the day, or a
permanent error.  (I looks permanent for "Linux x86_32", but not sure
about the others).

Being able to access the r-forge server logs, similar to the
Bioconductor status box, would help.



4. It is not clear how dependencies are dealt with in the build/check 
process.


If I have r-forge packages A v1.0.0, B v1.0.0, and C v1.0.0, and
package A depends on B (>= 1.0.0) and package B depends on C (>=
1.0.0), when are these packages built?  Are they built in
lexicographic order or in some optimized order?  For instance, if I
bump the versions of the packages and the dependencies to B (>= 1.1.0)
and C (>= 1.1.0), when will package A be build and available?  If
there is a lexicographic build/cron cycle, will it take three cycles?
Will A and B fail in the first cycle when only C is build.  Then in
the 2nd cycle, will A fail and B and C build, and in the 3rd cycle
also A will build?

Again/thus, when my package A is not available, is that because I did
something wrong, the cron job had hiccups is delayed, or something
else.  Seeing the full server logs or other status reports would help.



5. No https access - only svn+ssh access with private/public keys

The svn+ssh protocol for SVN commits is a show stopper for people who
never used SVN or ssh authentication keys before.

[Rd] Difference Linux / Windows

2010-03-31 Thread Christophe Genolini

Hi the list,
I am writing a package that happen to not be compatible with linux 
because I did not know that the function "savePlot" was available only 
on windows. Is there a list of "incompatible" function? How can I get 
this kind of information?

Thanks
Christophe

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


[Rd] Microsoft conspiracy against R?

2010-04-05 Thread Christophe Genolini

Hi the list,
I am using getGraphicsEvent (pakage kml, function 'choice') to build a 
user friendly interface, but it seems that it is not linux/mac 
compatible. Is there anythink like getGraphicsEvent for R linux/mac?

Christophe

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


[Rd] Including a file in a Rd file

2010-04-06 Thread Christophe Genolini

Hi all,
Is it possible to include a file in an .Rd file? For example, it might 
be convenient to write a file "author.Rd" and then include it in all the 
Rd file:


\author{
 \include{author.Rd}
}

Christophe

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


[Rd] generic '[' for a non-exported class

2010-04-07 Thread Christophe Genolini

Hi all,
I define a S4 class 'foo'. I define '[' and '[<-' for it.
I do not want to export foo, so I do not put it in NAMESPACE.
I do not want to export '[' and '[<-' either (since the user can not use 
foo, no raison to give him access to '[' for foo).


But R CMD check does not agree with me and report an error:
Undocumented S4 methods:
 generic '[' and siglist 'foo'
 generic '[<-' and siglist 'foo'


Any solution ?
Christophe

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


[Rd] Standard method for S4 object

2008-02-24 Thread Christophe Genolini
Hi the list,

I am defining a new class. Shortly, I will submit a package with it. 
Before, I would like to know if there is a kind of "non official list" 
of what method a new S4 object should have.
More precisely, personally, I use 'print', 'summary' and 'plot' a lot. 
So for my new class, I define these 3 methods and of course, a get and a 
set for each slot. What else? Is there some other methods that a R user 
can reasonably expect? Some "minimum basic tools"...

Thanks

Christophe


[[alternative HTML version deleted]]

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


Re: [Rd] Standard method for S4 object

2008-02-24 Thread Christophe Genolini
For what I understand so far :

For set, you can add some verification of object internal coherance. The 
initialize make verification when you create your object,
aSlotName<- can make some verification when you change your slot.

For get, you can build some more elabored method than just getting a  
slot. For example
getSlotA can get the value of a slot wich is a list for some convenience 
and return a matrix.
Or it can get matrix A using some columne name define in slot B.
Or it can get the first colonm of A only...

Christophe


> I don't know of any  '"non official list" of what method a new S4 object
> should have' - such a list would have to depend on what the object
> represents.  If it represents the output of fitting a model, then methods
> for 'residuals', 'fitted' and 'coefficients' would probably be nice.
>
> Also, out of curiosity, what do your methods for `get' and `set' for each
> slot look like?  Is there any advantage to using such methods over using
>
> slot(objectOfYourClass, "aSlotName") # for get, and
> slot(objectOfYourClass, "aSlotName") <- aValue # for set
>
> On Sat, 23 Feb 2008, Christophe Genolini wrote:
>
>   
>> Hi the list,
>>
>> I am defining a new class. Shortly, I will submit a package with it.
>> Before, I would like to know if there is a kind of "non official list"
>> of what method a new S4 object should have.
>> More precisely, personally, I use 'print', 'summary' and 'plot' a lot.
>> So for my new class, I define these 3 methods and of course, a get and a
>> set for each slot. What else? Is there some other methods that a R user
>> can reasonably expect? Some "minimum basic tools"...
>>
>> Thanks
>>
>> Christophe
>>
>>
>>  [[alternative HTML version deleted]]
>>
>> __
>> R-devel@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel
>>
>> 
>
>   


[[alternative HTML version deleted]]

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


[Rd] S4 : declaration of inheritance

2008-02-25 Thread christophe . genolini
Hi the list,

There is two way to declare a new object with inheritence : one can do

setMethod("myClass",
  representation("fatherClass",x="numeric")
  

or

setMethod("myClass",
  representation(x="numeric"),
  containt="fatherClass"
  

Is there any difference ? What is the usal way ?

Christophe

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


Re: [Rd] S4 : declaration of inheritance

2008-02-25 Thread christophe . genolini
Sorry, I make a mistake... I meant :
what the difference between

setClass("myClass",
   representation("fatherClass",x="numeric")
   

or

setClass("myClass",
   representation(x="numeric"),
   contains="fatherClass"
   



> setClass("myClass",
>representation(x="numeric"),
>contains="fartherClass")
>
> seems more logical to me in sense of syntax (pay attention to setClass
> instead of setMethod and contains instead of containt), but both work
> apparently.
>
> Oleg
>
> [EMAIL PROTECTED] wrote:
> > Hi the list,
> >
> > There is two way to declare a new object with inheritence : one can do
> >
> > setMethod("myClass",
> >   representation("fatherClass",x="numeric")
> >   
> >
> > or
> >
> > setMethod("myClass",
> >   representation(x="numeric"),
> >   containt="fatherClass"
> >   
> >
> > Is there any difference ? What is the usal way ?
> >
> > Christophe
> >
> > __
> > R-devel@r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-devel
>
> --
> Dr Oleg Sklyar * EBI-EMBL, Cambridge CB10 1SD, UK * +44-1223-494466
>

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


Re: [Rd] Great tool

2008-03-06 Thread Christophe Genolini

I believe that codetools is "incredibly usefull", but it is very difficult to
learn how to use it...
Anythink else thant reading the code available ?

For exemple, how to track down free varaible ? I try

findGlobals(get(functionNames),FALSE)$variables

but it does not work...

Christophe


Gabor Grothendieck wrote:
> 
> Tracking down the free variables in a function when
> reworking old code.
> 
> On Jan 21, 2008 12:41 PM, Charles C. Berry <[EMAIL PROTECTED]> wrote:
>> On Sun, 20 Jan 2008, Gabor Grothendieck wrote:
>>
>> > I agree.  Its incredibly useful.
>>
>> OK gentlemen, you have piqued my curiosity.
>>
>> Can you give an example or two of situations you encountered in which a
>> codetools function was so helpful?
>>
>> Chuck
>>
>>
>>
>> >
>> > On Jan 20, 2008 11:02 PM, Henrik Bengtsson <[EMAIL PROTECTED]>
>> wrote:
>> >> Hi,
>> >>
>> >> I just have drop a note to say that the 'codetools' (and the part of R
>> >> CMD check that use it) is a pleasure to use and saves me from hours of
>> >> troubleshooting.  Each time it finds something I am amazed how
>> >> accurate it is.  Thanks to Luke T. and everyone else involved in
>> >> creating it.
>> >>
>> >> Cheers,
>> >>
>> >> Henrik
>> >>
>> >> __
>> >> 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
>> >
>>
>> Charles C. Berry(858) 534-2098
>> Dept of Family/Preventive
>> Medicine
>> E mailto:[EMAIL PROTECTED]   UC San Diego
>> http://famprevmed.ucsd.edu/faculty/cberry/  La Jolla, San Diego
>> 92093-0901
>>
>>
>>
> 
> __
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Great-tool-tp14990920p15885369.html
Sent from the R devel mailing list archive at Nabble.com.

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


[Rd] package.skeleton.S4

2008-03-30 Thread Christophe Genolini
Hi the devel list.

I am adapting the package.skeleton to S4 classes and methods
I would have been very proud to post a new working function on this list.
Unfortunately, I do not manage to solve all the problems. Mainly

 - sys.source does not compile a file with setClass
 - dumpMethod does not exists yet

In the following code, thise two problems are notified by a line 
#

Still with this two issues, it is possible to use package.skeleton.S4 in 
the following way:
 - first run package.skeleton (in the classical way, on a file or in the 
console).
This creates the directories and the files
 - then run package.skeleton.S4.
 It has to be done
  * using the code_files option (since dumpMethod does not exists)
  * providing the list of the class (since sys.source does not 
compile setClass)
  * using the same path than package.skeleton

At this three conditions, package.skeleton.S4 will :
 - modify the DESCRIPTION package,
 - run promptClass on the classes gived in the list,
 - run promptMethod on all the methods related to the classes gives in 
the list.

I tryed to solve the sys.source problem, but I am not good enough in R 
to do it myself.
I do not even know if it is something hard to do or very easy. So I post 
this uncompleted function...
If someone is interested in fixing it and then adding it somewhere,
I then will write the package.skeleton.S4.Rd

sincerly

Christophe


--- 8< - package.skeleton.S4 ---

package.skeleton.S4 <- function(name = "anRpackage", list, environment = 
.GlobalEnv,
path = ".", force = FALSE, namespace = FALSE, code_files = 
character(),S4=FALSE)
{
cat(missing(list)," EEE\n")
### If pakage.skeleton has not been run, run it on false data
dir <- file.path(path, name)
code_dir <- file.path(dir, "R")
docs_dir <- file.path(dir, "man")
data_dir <- file.path(dir, "data")
if (!file.exists(dir)){
environment <- new.env()
assign("falseData-ToErase",NULL,environment)

package.skeleton(name=name,environment=environment,path=path,namespace=namespace)
}else{}

### Build up the list_S4
###   If list_S4 is empty :
###  If code_files_S4 is not empty, the file in code_file_S4 are 
source.
###  then list receive ls() after removing ".__C__" (either if 
code_files is empty or not)
if (!is.character(code_files)){stop("'code_files S4' should be a 
character vector")}else{}
use_code_files <- length(code_files) > 0

if (missing(list)){

# Has to be false
# since sys.source does not work :-(
if (use_code_files){
environment <- new.env()
for (cf in code_files){sys.source(cf, envir = environment)}
}else{}
list <- ls(pattern=".__C__",all.names=TRUE)
list <- substr(list,7,nchar(list))
}else{}

### Check that the parameters are of correct type
if (!is.character(list)){stop("'list' should be a character vector 
naming R objects")}else{}
if (!is.logical(namespace) || (length(namespace) != 
1)){stop("'namespace' should be a single logical")}else{}
curLocale <- Sys.getlocale("LC_CTYPE")
on.exit(Sys.setlocale("LC_CTYPE", curLocale), add = TRUE)
if (Sys.setlocale("LC_CTYPE", "C") != "C"){warning("cannot turn off 
locale-specific chars via LC_CTYPE")}else{}

### Remove non existing object from the list
have <- sapply(list, isClass, where = environment)
if (any(!have))
warning(sprintf(ngettext(sum(!have), "class '%s' not found",
"class '%s' not found"), paste(sQuote(list[!have]),
collapse = ", ")), domain = NA)
list <- list[have]
if (!length(list))
stop("no R classes specified or available")

### Addition to DESCRIPTION
message("Adding to DESCRIPTION ...")
description <- file(file.path(dir, "DESCRIPTION"), "a+b")
cat("\nDepends: methods\nLazyLoad: yes\nCollate: gives the order in 
which file shall be sourced\n",append=TRUE,file = description,sep = "")
close(description)

### Remove elements starting with "." from the list
internalObjInds <- grep("^\\.", list)
internalObjs <- list[internalObjInds]
if (any(internalObjInds)){list <- list[-internalObjInds]}else{}

### Remplace strange char by "_" and check the name validity (but 
only if code_file is user define)
if (!use_code_files){
list0 <- gsub("[[:cntrl:]\"*/:<>?\\|]", "_", list)
wrong <- 
grep("^(con|prn|aux|clock\\$|nul|lpt[1-3]|com[1-4])(\\..*|)$",list0)
if (length(wrong)){list0[wrong] <- paste("zz", list0[wrong], sep 
= "")}else{}
ok <- grep("^[[:alnum:]]", list0)
if (length(ok) < length(list0)){list0[-ok] <- paste("z", 
list0[-ok], sep = "")}else{}
list1 <- tolower(list0)
list2 <- make.unique(list1, sep = "_")
changed <- (list2 != list1)
list0[changed] <-

[Rd] tests Rin and Rout

2008-03-30 Thread Christophe Genolini

>
> Generally I find it's good to look at examples that work.  For 
> examples of packages using tests, look at source packages on CRAN.  
> Run the tests on them (using R CMD check), and see what gets produced.
>
Do you have the name of a package that use it ? I try the 10 first 
package, and 10 other at random, but none of them use tests...
>>> Create tests/myPack.R with those lines in it plus lines to actually 
>>> run the code.
>> Does it mean that each time I change the code, I will have to change 
>> it twice, once in R/ and once in tests/
>
> There shouldn't be any duplication.  Just put tests in the tests 
> directory.  That code will be run with your package loaded when you 
> run R CMD check.  If it fails, your package will fail the check.
Sorry, this is very unclear to me. What do you call "tests" that I have 
to put in the tests directory ?
Let's take an example : My package is a single function that take the 
square of only positive number. I make a mistake and I forget that it 
has to reject negative number :

sq <- function(x){return(x2)}

Fortunately, I am very conscientious (!) and I did prepare some test :
- sq(2) should be 4
- sq(Inf) should be Inf
- sq(-2) should be NA (on this example, this last test will fail)

At his point :
sq <- function(x){return(x2)} is in R/main.r

1) What shall I put in the test file ?
2) Cann't I build a Rout file containning the expected results 4 ; Inf; 
NA ?

Thanks for helping

Christophe
>>   If the code generates errors, your test will fail.  If you want to 
>> see reports of changes to the output, also include 
>> tests/myPack.Rout.save with the known correct versions of the output.
>>
> What should the Rout.save looks like ? I mean, what is the syntax of 
> this file ?

It should just be a copy of the Rout file produced from a previous 
trusted run.  R CMD check will ignore certain differences (like changes 
to the date or R version at the top of the file), but will report on 
others.

Duncan Murdoch

[[alternative HTML version deleted]]

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


Re: [Rd] tests Rin and Rout

2008-04-05 Thread Christophe Genolini

> hmm, I see 219 out 1378 CRAN packages having a 'tests'
> subdirectory, so it seems you have been a bit unlucky. ;-)
>   
Luck has probably nothing related with my failure.
I just try to look in packages recommanded by Pr Brian Ripley (like 
codetools, foreign, lattice)
and I did not find any tests directories. So either I am not looking in 
the right place, or tests are
not including in the package for windows. Any idea?

Thanks

Christophe

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


Re: [Rd] package.skeleton.S4

2008-04-05 Thread Christophe Genolini
John Chambers a écrit :
> Christophe,
>
> Thanks for your work; unfortunately,  at the same time you were 
> developing your version, the original function was being extended in 
> the same direction.
Next time, I will try to not be late...

> Version 2.7 of R is currently in alpha testing
I try using 
https://svn.r-project.org/R/trunk/src/library/utils/R/package.skeleton.R
I get

Erreur dans get(name, envir = asNamespace(pkg), inherits = FALSE) :
  variable ".methodsPackageMetaNamePattern" introuvable

I gess it is not a bug, I guess it is because I do not have the methods 
V2.7 library
So I'll wait until the 22 april.

Christophe

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


Re: [Rd] tests Rin and Rout

2008-04-05 Thread Christophe Genolini
Prof Brian Ripley a écrit :
> Recommended packages cluster codetools foreign lattice nlme and rpart
> have tests, for example.  (As do standard packages grDevices, grid and 
> stats.)
>
Thanks for your help.

Concerning .Rin, I check all the package you point, but none of them use it.
Does someone know a package using .Rin ?

Christophe

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


Re: [Rd] package.skeleton.S4

2008-04-05 Thread Christophe Genolini

> Hmm, please reconsider!
> We have been providing R 2.7.0 alpha in all the usual platform
> flavors for almost two weeks now and we *REALLY* would like
> it to be used and get feedback on new features *BEFORE* release
> if at all  possible!
>
>   
Ok ok ok, I will...
But I do not find the windows version. Where is it ?
And I am not sure I will be able to compile it...

Christophe

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


Re: [Rd] package.skeleton.S4

2008-04-05 Thread Christophe Genolini

>> And I am not sure I will be able to compile it...
>
> It's also not that hard
I do not understand what I have to do...
More precisely, I under windows XP32bit. As you told me, I downloaded 
the version 2.7alpha exactly like I did with the 2.6.2, I install it 
exactly the same way and it seems to work. I did not compile anything... 
Should I have ?


For package.skeleton, I will make some more advance test this week, but 
I already have a warnings:

Warning messages:
1: In system(paste("rm ", file.path(docs_dir, sprintf("%s.Rd", 
list0[item] :
  rm introuvable
2: In system(paste("rm ", file.path(docs_dir, sprintf("%s.Rd", 
list0[item] :
  rm introuvable

I guess it is because "rm" is unix and not windows ?

On monday, I will also use it on windows 64bit.

Christophe

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


Re: [Rd] package.skeleton.S4

2008-04-05 Thread Christophe Genolini
Am I suppose to repport only but, or can I also make some comments?
Well, I guess if I am not suppose to comment, it is easy to ignore them...

Concerning the help file, some other examples might be a good complement 
to the existing one.

--- 8< --
\examples{
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)

# using list will create one file for each function
package.skeleton(name="mypkg",list=c("f","g","d","e"))


### Using a file :
sink("myPack2.r")
cat("
f2 <- function(x,y) x*y
d2 <- data.frame(a=rnorm(10),b=1:10)
")
sink()

# using code_files will copy the file
package.skeleton(name="mypkg2",code_files="myPack2.r")

### Dealing with S4 :
sink("myPack3.r")
cat("
setClass('A',representation(x='numeric'))

setMethod('print','A',function(x){cat('AAA',[EMAIL 
PROTECTED],'AAA');return(invisible())})
")
sink()
package.skeleton(name="mypkg3",code_files="myPack3.r")

### function or variable starting with . (dot) are hidden (see NAMESPACE)
.h <- function(x,y) x/y
package.skeleton(name="mypkg4",list=c("f","g","d","e",".h"))
}
--- 8< --


Concerning the package construction:
after running package.skeleton, we (low level user) migth expect R CMD 
check and R CMD build to compile
It is not the case because of an error and some warnings.

Here is the error :
Examples failed

May be some '#' can be put in the example code to prevent it from failling?

The warnings are :
~kwd1 is not a keyword
duplicated alias for myMethod,AA-method
missing link()
Unaccounted top-level text

for french people, some "é" and "è" provoque warnings as well.


Christophe

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


Re: [Rd] package.skeleton does invalide regular name...

2008-07-15 Thread Christophe Genolini
By the way, will it be a big change to allow the user to give the name 
of a directories instead of a file ? The following code :

code_file=c("dir1\file1.r","dir1\file2.r","dir1\file3.r")

willl become :

code_file=c("dir1\")

Then, reconizing that dir1\ is a directories, skeleton.package will 
include all the file that are in the directorie ?


Christophe



On 7/15/2008 1:33 PM, [EMAIL PROTECTED] wrote:

Hi the list,

I am using package.skeleton on a file that has a very classic name, 
but package.skeleton detect it as a invalid name :


--- 8< ---
package.skeleton(name="packClassicBis",code_files="./packClassic/R/progClassic.R") 



Création des répertoires...
Création de DESCRIPTION...
Création de 'Read-and-delete-me'...
Recopiage des fichiers de code...
Création des fichiers d'aide ...
Terminé.
Les étapes suivantes sont décrites dans 
'./packClassic4/Read-and-delete-me'.

Warning message:
In package.skeleton(name = "packClassic4", code_files = 
"./packClassic/R/progClassic.R") :

  Nom(s) de fichier(s) invalide(s) pour du code R ./packClassic4/R:
  'progClassic.R'
sont maintenant renommés vers 'z.R'
--- 8< ---

It create the file "zprogClassic.R" in directorie "packClassicBis\R"
Is there something wrong in my code or is it a bug in package.skeleton ?



I think you're right, it's a bug.  package.skeleton assumes that 
code_files lists files in the current directory, and will give that 
warning if they are given with qualified paths.


It should be easy to fix; I'll take a look.  Thanks for the report.

Duncan Murdoch



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


[Rd] unlist change the ordered type

2008-10-24 Thread Christophe Genolini

Hi the list,

unlist respect the all the atomic type except orderd (it change of 
ordered into factor) :


### integer
class(unlist(list(1:5,1:3)))
#[1] "integer"

### numeric
class(unlist(list(1.2,3.5)))
#[1] "numeric"

### character
class(unlist(list("e","e")))
#[1] "character"

### factor
class(unlist(list(factor("e"),factor("e"
#[1] "factor"

### ordered
class(unlist(list(ordered("e"),ordered("e"
#[1] "factor"

Christophe

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


[Rd] Strange behavior of C compiled program

2009-02-08 Thread Christophe Genolini

Hi the list,

I need to include some C code in R, but the behavior of the C code is 
strange : Here is my code :

--- 8< ---
   Rprintf("\n  mTraj=%f 
mClus=%f",mTraj[i+nbId*c],mClustersCenter[j+nbClusters*c]);


   Rprintf("\nDistA=%d Tmp=%d",dist,tmp);
   tmp = mTraj[i+nbId* c] - mClustersCenter [j+nbClusters* c];

   Rprintf("\nDistB=%d Tmp=%d",dist,tmp);
   dist += (tmp * tmp);

   Rprintf("\nDistC=%d Tmp=%d",dist,tmp);
--- 8< 

Herer are the stranges results it gives :

 mTraj=1.00 mClus=3.00
DistA=0 Tmp=0
DistB=0 Tmp=0
DistC=0 Tmp=1074790400

I ask on a C chat, but no one can answer me.
Any idea of what wrong ?

Thanks
Christophe

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


Re: [Rd] Strange behavior of C compiled program

2009-02-09 Thread Christophe Genolini
Thanks, that was a stupid mistake (I did not know that this is so 
important).


So I still have a problem realy more complex and I do not know was is 
wrong. I am running a .C procedure in a R loop.
After 4, 5 or sometimes 6 call to the C procedure, Rgui crash (it closes 
asking me if I want to send a report to Microsoft).
Is there a debuger that can run the C code with some R in it ? And what 
kind of mistake can provoque such a crash ?


Thanks
Christophe


So I thaught that I find t

On 08/02/2009 5:37 PM, Christophe Genolini wrote:

Hi the list,

I need to include some C code in R, but the behavior of the C code is 
strange : Here is my code :

--- 8< ---
Rprintf("\n  mTraj=%f 
mClus=%f",mTraj[i+nbId*c],mClustersCenter[j+nbClusters*c]);


Rprintf("\nDistA=%d Tmp=%d",dist,tmp);
tmp = mTraj[i+nbId* c] - mClustersCenter [j+nbClusters* c];

Rprintf("\nDistB=%d Tmp=%d",dist,tmp);
dist += (tmp * tmp);

Rprintf("\nDistC=%d Tmp=%d",dist,tmp);
--- 8< 

Herer are the stranges results it gives :

 mTraj=1.00 mClus=3.00
DistA=0 Tmp=0
DistB=0 Tmp=0
DistC=0 Tmp=1074790400

I ask on a C chat, but no one can answer me.
Any idea of what wrong ?


You likely have the wrong types for the variables you're printing.  In 
C, the format has to match the type of the variable; if you use the 
wrong one, you get garbage.


Duncan Murdoch



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


[Rd] \usage without \alias

2009-02-10 Thread Christophe Genolini

Hi the list,

I am checking a package and I get a warnings :

--- 8< 
Objects in \usage without \alias in documentation object 'plot,Calinski'
--- 8< 

'Calinski' is a S4 class and I define a S4 method for ploting it. Here 
is my plotCalinski.rd file :


--- 8< 
\name{plot,Calinski}
\alias{plot,Calinski}
\alias{plot,Calinski-method}

\title{ ~ Function: plot for Calinski ~ }
\description{
 \code{plot} the Calinski creterion.
}
\usage{
plot(x, y, ...)
}
--- 8< 

Any idea of what is wrong ?

Thanks
Christophe

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


[Rd] getGraphicsEvent in an example

2009-02-17 Thread Christophe Genolini

Hi the list,
Is there a way to include a function using a getGraphicsEvent in the 
\examples section?

Christophe

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


Re: [Rd] getGraphicsEvent in an example

2009-02-18 Thread Christophe Genolini

Greg Snow a écrit :

Just wrap the example in either \dontrun{} or
if(interactive()){

}
  

Thanks. Your solution gives me an other idea :
try(myFunction) works as well.

Christophe



That way that example will be skipped when the automatic tests are done, but 
will still be available for a reader to run by copy/paste or the examples 
function (2nd case above).

This has worked for me, examples using these are playSudoku in the sudoku 
package and dynIdentify in TeachingDemos.

Hope this helps,




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


[Rd] matplot and lend="butt"

2009-03-23 Thread Christophe Genolini

Hi the list,

I am using matplot with the option lend="butt", but only the first line 
(the black) is printed correctly  :


> matplot(matrix(1:9,3),type="c",lwd=10,lty=1,lend="butt")

Is it a bug ?
I am using R2.8.1 under windows XP pack3.

Christophe

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


Re: [Rd] savePlot export "strange" eps (PR#13620)

2009-03-24 Thread Christophe Genolini
Sorry for that... I find a strange behavior in "savePlot" ; before 
report a bug, I read the posting guide and I try to simplify my exemple 
as much as possible. Doing this, I change my code and I remove the " 
type='eps' " option... Sorry !


Let's start this again.

When I use savePlot(file="toto.eps",type="eps") and I try to incorporate 
"toto.eps" in a LaTeX document, I get a strange behavior:
LaTeX run normaly, so does dvips. But the generated postscript include a 
graph that overwirte the line above it.

If my latex is

bonjour bonjour2 bonjour3
\begin{center}
\includegraphics[width=12cm]{toto.eps}
\end{center}

Then "bonjour2 bonjour3" is hidden by the graph.

Version: 2.8.1
OS: Windows XP
LaTeX : Miktex 2.7

Christophe




cgeno...@u-paris10.fr wrote:

Full_Name: Christophe Genolini
Version: 2.8.1
OS: Windows XP
Submission from: (NULL) (82.225.59.146)


savePlot export "eps" graph that seems to be incorrect. 



Looks like you saved an EMF rather than an eps file???

Uwe Ligges



Trying to incorporate them in a LaTeX file, I get : 
++

Cannot determine size of graphics in foo.eps (no BoundingBox)
--

Trying to open them with GSview, I get :
++
GSview 4.9 2007-11-18
AFPL Ghostscript 8.54 (2006-05-17)
Copyright (C) 2005 artofcode LLC, Benicia, CA.  All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
Displaying non DSC file C:/Documents and Settings/Christophe/Mes
documents/Recherche/Trajectoires/kmeal/trajectories/testsDev/toti.eps
Error: /undefined in 
Operand stack:

Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--  
--nostringval--   2   %stopped_push   --nostringval--   
--nostringval--   false  1   %stopped_push   1   3   %oparray_pop   
1   3   %oparray_pop   1   3  %oparray_pop   1   3   %oparray_pop   
.runexec2   --nostringval--  --nostringval--   --nostringval--   2   
%stopped_push   --nostringval--

Dictionary stack:
   --dict:1130/1686(ro)(G)--   --dict:0/20(G)--   --dict:74/200(L)--
Current allocation mode is local
Last OS error: No such file or directory

--- Begin offending input ---
   €      L   z  f  C  fC   EMF   $6  7    
l   �    °    €— ° G r a p h A p p 
%        €%
       €%        €%        €%        €%        €%        
€%       €%        €%        €%        €%        €K   @   
0              N   N   y  @  N   N   y  @  %        
€%        €:     _   8      8   8 
   %              ;            l   *  
6      Z  õ  <      @      f   ï  `  0  %   
    €(         %        €%        €K   @   0         
      N   N  y  @  N   N   y  @  %        €%        €:   
  _   8      8   8%   
           ;            m  ñ  6      Z  »  <      
@      g  µ  `  ÷  %   
    €(         %        €%        €K   @   0         
     ¡  ¡  ¡  ¡  %        €%        €:   
  _   8      8   8    --- End 
offending input ---

file offset = 1024
gsapi_run_string_continue returns -101

__
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