[R] possible bug in ggplot2 v0.5.2???

2007-07-03 Thread Stephane Cruveiller

Dear R-Users,

I recently gave a try to the nice package ggplot2. Everything  went
well until I tried to add a smoother (using lm method for instance).
On the graphic device the regression line is displayed but not confidence
intervals as it should be (at least on ggplot website). I tried to do 
the job on

both MS winXP and Linux i586: same result. Did anyone encountered this
problem? Did I miss something?


My R version is 2.4.1.



Thanks,

Stéphane.


--
==
Stephane CRUVEILLER Ph. D.
Genoscope - Centre National de Sequencage
Atelier de Genomique Comparative
2, Rue Gaston Cremieux   CP 5706
91057 Evry Cedex - France
Phone: +33 (0)1 60 87 84 58
Fax: +33 (0)1 60 87 25 14
EMails: [EMAIL PROTECTED] ,[EMAIL PROTECTED]
===

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] .C interface and Strings...

2007-01-12 Thread Stephane Cruveiller

Dear R users,

I am trying to include C code into R via the .C interface.  I have read
that arguments passed to a C function have to be correctly DEreferenced.
This is something that can be easily done for numbers (integers or 
float) by adding

a * before the reference like for instance:


#includeR.h


void hellofct(int *n)
   {
   int i;
   for (i=0;i*n;i++)
   {
   Rprintf(Hello, world!\n);
   }
   }
  


However, I can not figure out how that can be achieved for strings.
My prototype function would be something like:


#includeR.h


void displaystring(char *str)
   {
   Rprintf(String displayed:%s\n, );
   }
  


any hints?

Thx.

Stéphane.

--
==
Stephane CRUVEILLER Ph. D.
Genoscope - Centre National de Sequencage
Atelier de Genomique Comparative
2, Rue Gaston Cremieux   CP 5706
91057 Evry Cedex - France
Phone: +33 (0)1 60 87 84 58
Fax: +33 (0)1 60 87 25 14
EMails: [EMAIL PROTECTED] ,[EMAIL PROTECTED]
===

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] RMySQL...Can't initialize driver??? Solved!!!

2006-06-28 Thread Stephane Cruveiller

Hi,

I have finally made it working. I do not if that was the problem but
the libraries (DBI and RMySQL) were installed in a non-standard
location (of course specified in a .Renviron file). Reinstalling both of
them at R root did the trick...


thanks to you all for your help...

Stephane.

Rainer M Krug wrote:

Stephane Cruveiller wrote:
  

Rainer M Krug wrote:
I followed your instruction. Here is my .my.cnf:
---
[client]
user=steff
password=XX
database=justforfun
---
with it, I can connect to my MYSQL server without problem
and then I try to connect through R:

---


library(RMySQL)
  

Loading required package: DBI


m - dbDriver(MySQL)
  

Error in new(MySQLDriver, Id = drvId) : unused argument(s) (Id ...)
---

It still produces the error. I really  do not  know what is going on
here...



Sorry - no idea. I guess you are using Linux? And all packages are up to
date?

Rainer




  


Then you do:


library(RMySQL)
m - dbDriver(MySQL)
con - dbConnect(m, group = renpatch)
q - TheSQLQuery
rs - dbSendQuery(con, q)
TheResults - fetch(rs, n = -1)
dbDisconnect(con)
rm(con)


and it should work - at least that is what it is doing for me.

Rainer

  
  

Stephane.




  


__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

[R] RMySQL...Can't initialize driver???

2006-06-27 Thread Stephane CRUVEILLER
Dear R users,

I would like to query a MySQL database through R. I have installed
the latest required packages (RMySQL and DBI) in R (v2.3.1). A MySQL
server (v5.0.22) is running on my local machine but I can't initialize MYSQL 
driver: 

 library(RMySQL)
Loading required package: DBI
 MySQL(max.con = 10, fetch.default.rec = 500, force.reload = F)
Error in new(MySQLDriver, Id = drvId) : unused argument(s) (Id ...)
-

Could somebody tell me what I have missed?


Thx

Stéphane.


-- 
==
Stephane CRUVEILLER Ph. D.
Genoscope - Centre National de Sequencage
Atelier de Genomique Comparative
2, Rue Gaston Cremieux   CP 5706
91057 Evry Cedex - France
Phone: +33 (0)1 60 87 84 58
Fax: +33 (0)1 60 87 25 14
EMails: [EMAIL PROTECTED] ,[EMAIL PROTECTED]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] RMySQL...Can't initialize driver???

2006-06-27 Thread Stephane Cruveiller

Dear R users,

I would like to query a MySQL database through R. I have installed
the latest required packages (RMySQL and DBI) in R (v2.3.1). A MySQL
server (v5.0.22) is running on my local machine but I can't initialize 
MYSQL

driver:

 library(RMySQL)
Loading required package: DBI
 MySQL(max.con = 10, fetch.default.rec = 500, force.reload = F)
Error in new(MySQLDriver, Id = drvId) : unused argument(s) (Id ...)
-

Could somebody tell me what I have missed?


Thx

Stéphane.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Re: [R] RMySQL...Can't initialize driver???

2006-06-27 Thread Stephane Cruveiller

Duncan Murdoch wrote:

On 6/27/2006 8:51 AM, Stephane Cruveiller wrote:

Dear R users,

I would like to query a MySQL database through R. I have installed
the latest required packages (RMySQL and DBI) in R (v2.3.1). A MySQL
server (v5.0.22) is running on my local machine but I can't 
initialize MYSQL

driver:
 


  library(RMySQL)
Loading required package: DBI
  MySQL(max.con = 10, fetch.default.rec = 500, force.reload = F)
Error in new(MySQLDriver, Id = drvId) : unused argument(s) (Id ...)
- 



Could somebody tell me what I have missed?


I have never used RMySQL, but from the error message, this looks like 
an incompatibility between it and DBI, presumably because one is newer 
than the other.


I have always found it easier to use RODBC.  Because it uses the more 
general ODBC interface, it may be slower than a package that is tuned 
to a particular database, but it works, which is a substantial advantage.

thanks for the hint... I  will give it a try very soon.


Duncan Murdoch



Stephane.
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Re: [R] RMySQL...Can't initialize driver???

2006-06-27 Thread Stephane Cruveiller

Rainer M Krug wrote:

Stephane Cruveiller wrote:
  

Duncan Murdoch wrote:


On 6/27/2006 8:51 AM, Stephane Cruveiller wrote:
  

Dear R users,

I would like to query a MySQL database through R. I have installed
the latest required packages (RMySQL and DBI) in R (v2.3.1). A MySQL
server (v5.0.22) is running on my local machine but I can't
initialize MYSQL
driver:


  library(RMySQL)
Loading required package: DBI
  MySQL(max.con = 10, fetch.default.rec = 500, force.reload = F)
Error in new(MySQLDriver, Id = drvId) : unused argument(s) (Id ...)
-


Could somebody tell me what I have missed?



I am running R 2.3.0 under Linux and connect to a MySQl 4.1 server.

You have to create a file in your home directory which has the
connection infos. It should look like that:


[renpatch]
user = UserName
password = PassWord
database = ...
host = ...

[renpatch_renosterbos]
user = UserName
password = PassWord
database = ...
host = ..

and be called .my.conf

  

I followed your instruction. Here is my .my.cnf:
---
[client]
user=steff
password=XX
database=justforfun
---
with it, I can connect to my MYSQL server without problem
and then I try to connect through R:

---
 library(RMySQL)
Loading required package: DBI
 m - dbDriver(MySQL)
Error in new(MySQLDriver, Id = drvId) : unused argument(s) (Id ...)
---

It still produces the error. I really  do not  know what is going on here...



Then you do:


library(RMySQL)
m - dbDriver(MySQL)
con - dbConnect(m, group = renpatch)
q - TheSQLQuery
rs - dbSendQuery(con, q)
TheResults - fetch(rs, n = -1)
dbDisconnect(con)
rm(con)


and it should work - at least that is what it is doing for me.

Rainer

  


Stephane.
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Re: [R] aggregate function....

2006-03-31 Thread Stephane CRUVEILLER
Nice trick, thx...

Stéphane.

On Wed, 2006-03-29 at 11:17 -0500, jim holtman wrote:
 try 'by':
  
  x
   S_id AF_Class count... R_gc_percent S_length
 5  82644971   30 0.4835678
 6  826449737 0.4835678
 8  82645541   31 0.5138894 
 9  82645542   11 0.5138894
 10 826455431 0.5138894
  do.call('rbind', by(x, x$S_id, function(y) y[which.max(y
 $AF_Class),]))
S_id AF_Class count... R_gc_percent S_length 
 8264497 826449737 0.4835678
 8264554 826455431 0.5138894
  
 
 
  
 On 3/29/06, Stephane CRUVEILLER [EMAIL PROTECTED] wrote: 
 Dear R users,
 
 I have some trouble with the aggregate function. Here are my
 data
 
  daf
  S_id AF_Class count... R_gc_percent S_length
 5  82644971   30 0.4835678
 6  826449737 0.4835678
 8  82645541   31 0.5138894
 9  82645542   11 0.5138894
 10 826455431 0.5138894
 
 for a given S_id, I would like to select the line
 corresponding to the
 max count. To perform this, I used:
  aggregate(daf,list(daf$S_id),max) 
 Group.1S_id AF_Class count... R_gc_percent S_length
 1 8264497 82644973   30 0.4835678
 2 8264554 82645543   31 0.5138894
 
 which is ok for the count. But I realized that max function is
 also 
 applied
 to AF_class (should be 1 and 1 instead of 3 and 3), so it
 seems that
 aggregate is not the appropriate function for that I want to
 do. Is
 there any other function I could use instead?
 
 Best whishes, 
 
 
 Stéphane.
 --
 ==
 Stephane CRUVEILLER Ph. D.
 Genoscope - Centre National de Sequencage
 Atelier de Genomique Comparative
 2, Rue Gaston Cremieux   CP 5706 
 91057 Evry Cedex - France
 Phone: +33 (0)1 60 87 84 58
 Fax: +33 (0)1 60 87 25 14
 EMails: [EMAIL PROTECTED] ,[EMAIL PROTECTED]
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide!
 http://www.R-project.org/posting-guide.html
 
 
 
 -- 
 Jim Holtman
 Cincinnati, OH 
 +1 513 646 9390 (Cell)
 +1 513 247 0281 (Home)
 
 What the problem you are trying to solve? 
-- 
==
Stephane CRUVEILLER Ph. D.
Genoscope - Centre National de Sequencage
Atelier de Genomique Comparative
2, Rue Gaston Cremieux   CP 5706
91057 Evry Cedex - France
Phone: +33 (0)1 60 87 84 58
Fax: +33 (0)1 60 87 25 14
EMails: [EMAIL PROTECTED] ,[EMAIL PROTECTED]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] kmeans: did not converge in 10 iterations

2006-03-30 Thread Stephane CRUVEILLER
On Thu, 2006-03-30 at 11:56 -0800, Linda Lei wrote:
 Hi All,
 
  
 
 I run function kmeans to cluster a matrix. But when the matrix size is
 big enough, it keeps saying did not converge in 10 iterations. Could
 you explain what it means and if the result is wrong? 
 
It means that the partition obtained is not stable (i.e. the algorithm
did not converge
toward an optimal solution). Indeed, a supplementary iteration will
modify it significantly.

try to increase iter.max parameter (default set to 10)
$ x.kmeans-kmeans(x,centers=3,iter.max=30) 

Stéphane.



  
 
 And the interesting thing is sometimes this warning happens when the
 sample size is around 51200 x 6, sometimes it happens around 3 x 6.
 Does the warning related to sample size or not?
 
  
 
 This also happens in bclust.
 
  
 
 Thank you!
 
  
 
 
 
 
   [[alternative HTML version deleted]]
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
-- 
==
Stephane CRUVEILLER Ph. D.
Genoscope - Centre National de Sequencage
Atelier de Genomique Comparative
2, Rue Gaston Cremieux   CP 5706
91057 Evry Cedex - France
Phone: +33 (0)1 60 87 84 58
Fax: +33 (0)1 60 87 25 14
EMails: [EMAIL PROTECTED] ,[EMAIL PROTECTED]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] aggregate function....

2006-03-29 Thread Stephane CRUVEILLER
Dear R users,

I have some trouble with the aggregate function. Here are my data

 daf
  S_id AF_Class count... R_gc_percent S_length
5  82644971   30 0.4835678
6  826449737 0.4835678
8  82645541   31 0.5138894
9  82645542   11 0.5138894
10 826455431 0.5138894

for a given S_id, I would like to select the line corresponding to the
max count. To perform this, I used:
  aggregate(daf,list(daf$S_id),max)
  Group.1S_id AF_Class count... R_gc_percent S_length
1 8264497 82644973   30 0.4835678
2 8264554 82645543   31 0.5138894

which is ok for the count. But I realized that max function is also
applied
to AF_class (should be 1 and 1 instead of 3 and 3), so it seems that
aggregate is not the appropriate function for that I want to do. Is
there any other function I could use instead?

Best whishes,


Stéphane.
-- 
==
Stephane CRUVEILLER Ph. D.
Genoscope - Centre National de Sequencage
Atelier de Genomique Comparative
2, Rue Gaston Cremieux   CP 5706
91057 Evry Cedex - France
Phone: +33 (0)1 60 87 84 58
Fax: +33 (0)1 60 87 25 14
EMails: [EMAIL PROTECTED] ,[EMAIL PROTECTED]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] List of lists???

2006-02-01 Thread Stephane CRUVEILLER
Thx for the hint...
the div - factor(c(1,1,1,2,2)) did exactly what I was expecting...

Stéphane.

Le Mardi 31 Janvier 2006 15:50, Gabor Grothendieck a écrit :
 Your post seems to be messed up but I will assume you have a
 5 column data frame and the questino is how to run f on the first
 three columns and separately on the last two.  I think the
 easiest is just the following where I have used the builtin iris
 data set where I have assumed that the operation you want
 to perform is summary for purposes of example:

 summary(iris[,1:3])
 summary(iris[,4:5])

 If this is not your real problem and the real problem has many more
 divisions then try this where div is a factor that defines the division
 of columns into sets:

 div - factor(c(1,1,1,2,2))
 lapply(split(names(iris), div), function(n) summary(iris[n]))

 On 1/31/06, Stephane CRUVEILLER [EMAIL PROTECTED] wrote:
  Hi,
 
  I would like to perform computations on some variables belonging to the
  same dataframe. For instance my data frame has the following shape:
  toto1toto2toto3toto4toto5
  1 12345
  2678910
 
  I would like to perform the calculation on c(toto1,toto2,toto3) and
  then the same calculation on c(toto4,toto5). Is there a way to tell R
  to do it using 3 loop (a list of lists)??
 
  Stephane.
  --
  ==
  Stephane CRUVEILLER Ph. D.
  Genoscope - Centre National de Sequencage
  Atelier de Genomique Comparative
  2, Rue Gaston Cremieux   CP 5706
  91057 Evry Cedex - France
  Phone: +33 (0)1 60 87 84 58
  Fax: +33 (0)1 60 87 25 14
  EMails: [EMAIL PROTECTED] ,[EMAIL PROTECTED]
 
  __
  R-help@stat.math.ethz.ch mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide!
  http://www.R-project.org/posting-guide.html

-- 
==
Stephane CRUVEILLER Ph. D.
Genoscope - Centre National de Sequencage
Atelier de Genomique Comparative
2, Rue Gaston Cremieux   CP 5706
91057 Evry Cedex - France
Phone: +33 (0)1 60 87 84 58
Fax: +33 (0)1 60 87 25 14
EMails: [EMAIL PROTECTED] ,[EMAIL PROTECTED]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] List of lists???

2006-01-31 Thread Stephane CRUVEILLER
Hi,

I would like to perform computations on some variables belonging to the same 
dataframe. For instance my data frame has the following shape:
toto1   toto2   toto3   toto4   toto5
1   1   2   3   4   5
2   6   7   8   9   10

I would like to perform the calculation on c(toto1,toto2,toto3) and then 
the same calculation on c(toto4,toto5). Is there a way to tell R to do it 
using a loop (a list of lists)??

Stephane.
-- 
==
Stephane CRUVEILLER Ph. D.
Genoscope - Centre National de Sequencage
Atelier de Genomique Comparative
2, Rue Gaston Cremieux   CP 5706
91057 Evry Cedex - France
Phone: +33 (0)1 60 87 84 58
Fax: +33 (0)1 60 87 25 14
EMails: [EMAIL PROTECTED] ,[EMAIL PROTECTED]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html