Re: [R] Hosting a R Graph Gallery?

2005-02-21 Thread Robert Cunningham
I too have often though a R-gallery would be useful.

It seems to me that a Wiki-style page with a database backend would be
the best bet.

It also seems to be that the best place to start is a complete image
gallery produced from all the examples in R base, then in packages in
CRAN. In this context the graphicsQC package
(http://www.stat.auckland.ac.nz/~paul/R/graphicsQC_0.4.tar.g) of Paul
Murrell seems useful.

Cheers, 


Robert Cunningham



Romain Francois [EMAIL PROTECTED] writes:

 Hello Sander,

 That's a good idea and i am up to it.

 Right now i am in an exam period, so it's not really the better time,
 give me a couple of weeks and i will come up with a specific format of
 R files to submit to me that i could post-process to generate html
 documents.
 To my mind, those html files should show :

 - the plot itself
 + Submitter(s)
 - web page
 - email (eventually protected, I don't know how to do it)
 - Bibliographic references
 - Required R packages
 + Commentaries
- in english
- and in any other languages

 I'm open to any suggestion.

 Romain.

 Le 18.02.2005 14:33, Sander Oom a écrit :

 Dear R users,

 Following some of the recent questions and discussions about the R
 plotting abilities, it occurred to me again that it would be very
 valuable to have an R graph gallery.

 Eric Lecoutre made a very nice example in:
 http://www.stat.ucl.ac.be/ISpersonnel/lecoutre/stats/fichiers/_gallery.pdf


 It would be very useful to many beginners, but probably also
 advanced users of R, to have an overview of R graph types with
 graphical examples  and associated R code.

 In order to facilitate the evolution of a large gallery, some sort
 of wiki environment might be most suitable, thus providing access to
 all users, but with limited maintenance costs for the provider.

 Do others agree this could be a valuable resource? Would anybody
 have the resources to host such an R graph gallery?

 Yours,

 Sander Oom.

 -- 
 Romain FRANCOIS : [EMAIL PROTECTED]
 page web : http://addictedtor.free.fr/  (en construction)
 06 18 39 14 69 / 01 46 80 65 60
 ___
 Etudiant en 3eme année
 Institut de Statistique de l'Université de Paris (ISUP)
 Filière Industrie et Services
 http://www.isup.cicrp.jussieu.fr/

 __
 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-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] LD_LIBRARY_PATH is harmfull

2005-02-21 Thread Alexander Klimov
Hi.

Consider the following situation: Solaris 8, /usr/local has gcc 2.95,
my home has gcc 3.4.3, my gcc is first on PATH, LD_LIBRARY_PATH is
unset (everything is perfect since I always use -R). In fact, programs
compiled with my gcc do not work if LD_LIBRARY_PATH is set to
something which has /usr/local/lib before home/lib, because it
overrides stored path (-R) and I got

   libgcc_s.so.1 (GCC_3.3) =   (version not found)

I found setting of LD_LIBRARY_PATH in bin/R (how /usr/local/lib get
into it at all and especially before PREFIX/lib??? -- there was no
LD_LIBRARY_PATH during configure!) and fixed it (although I spent
quite a while editing lib/R/bin/R and wondering an abscence of
any effect :-)

After all the troubles I manage to load an extension, but, frankly, I
think there were too many problems. It would be very nice if R-project
reject the idea of using LD_LIBRARY_PATH because its setting is
considered harmfull and leads to too many problems:
http://www.linuxmafia.com/faq/Admin/ld-lib-path.html

-- 
Regards,
ASK

__
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] Two-factorial Huynh-Feldt-Test

2005-02-21 Thread Bela Bauer
Peter Dalgaard wrote:
My suspicion would be that it has something to do with calculating the
correction terms before or after contrast transformations (there must
be a coordinate-free version of the corrections?), but I can't grok
the details that easily.
I must admit that I'm not too familiar with the way R handles these 
calculations internally, so I don't quite see what you mean. Could you 
somehow clarify this, possibly by pointing me to relevant documentation?

However, if you peek over on the R-devel
list, you will see that I was just about to get serious with
programming some of this stuff as methods for the mlm class. I think
you just volunteered to test the code...
I'd be happy to do that. I've subscribed to R-devel following your last 
email, but I can't seem to be able to find the thread that you're 
referring to. Could you forward the relevent messages or the code to me?

Thanks again
Bela Bauer
__
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] Hosting a R Graph Gallery?

2005-02-21 Thread Sander Oom
Thanks for the responses and offer!
Romain, good luck with your exams first of all!
Graphics in R base and R contributed is a good start indeed.
I thought of a wiki as well as it will require less maintenance from the 
host. Custom html could be powerful, but will require more input from 
host! With build-in search engines, indexing etc., a wiki environment 
could provide all functionality for an easy to navigate gallery!

To stimulate development and support of SVG functionality, we might want 
to offer people the option of submitting graphics in both png and svg!

The work by Jake looks very promising:
http://www.darkridge.com/~jake/RSvg/
The applet works well with the examples!
Cheers,
Sander.
Robert Cunningham wrote:
I too have often though a R-gallery would be useful.
It seems to me that a Wiki-style page with a database backend would be
the best bet.
It also seems to be that the best place to start is a complete image
gallery produced from all the examples in R base, then in packages in
CRAN. In this context the graphicsQC package
(http://www.stat.auckland.ac.nz/~paul/R/graphicsQC_0.4.tar.g) of Paul
Murrell seems useful.
Cheers, 

Robert Cunningham

Romain Francois [EMAIL PROTECTED] writes:

Hello Sander,
That's a good idea and i am up to it.
Right now i am in an exam period, so it's not really the better time,
give me a couple of weeks and i will come up with a specific format of
R files to submit to me that i could post-process to generate html
documents.
To my mind, those html files should show :
- the plot itself
+ Submitter(s)
   - web page
   - email (eventually protected, I don't know how to do it)
- Bibliographic references
- Required R packages
+ Commentaries
  - in english
  - and in any other languages
I'm open to any suggestion.
Romain.
Le 18.02.2005 14:33, Sander Oom a écrit :

Dear R users,
Following some of the recent questions and discussions about the R
plotting abilities, it occurred to me again that it would be very
valuable to have an R graph gallery.
Eric Lecoutre made a very nice example in:
http://www.stat.ucl.ac.be/ISpersonnel/lecoutre/stats/fichiers/_gallery.pdf
It would be very useful to many beginners, but probably also
advanced users of R, to have an overview of R graph types with
graphical examples  and associated R code.
In order to facilitate the evolution of a large gallery, some sort
of wiki environment might be most suitable, thus providing access to
all users, but with limited maintenance costs for the provider.
Do others agree this could be a valuable resource? Would anybody
have the resources to host such an R graph gallery?
Yours,
Sander Oom.
--
Romain FRANCOIS : [EMAIL PROTECTED]
page web : http://addictedtor.free.fr/  (en construction)
06 18 39 14 69 / 01 46 80 65 60
___
Etudiant en 3eme année
Institut de Statistique de l'Université de Paris (ISUP)
Filière Industrie et Services
http://www.isup.cicrp.jussieu.fr/
__
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-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

--
-
Dr. Sander P. Oom
Animal, Plant and Environmental Sciences
University of the Witwatersrand
Private Bag 3
Wits 2050
South Africa
Tel (work)  +27 (0)11 717 64 04
Tel (home)  +27 (0)18 297 44 51
Fax +27 (0)18 299 24 64
Email   [EMAIL PROTECTED]
Web www.oomvanlieshout.net/sander
__
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


X11 copy paste (was: Re: [R] Easy cut paste from Excel to R?)

2005-02-21 Thread Bernhard Bruemmer
Peter Dalgaard [EMAIL PROTECTED] writes:

 Don MacQueen [EMAIL PROTECTED] writes:

 I tried Ken's suggestion read.table(pipe(pbpaste),header=TRUE) on
 my Mac OS X system and it worked *without* generating any warning
 message.
 
 If my experience represents the norm, and Ken's is the exception, it
 is so simple that no further contribution to R is needed, I would
 say.  Thank you, Ken.

 My conjecture is that it only happens when there are fewer than 5 data
 lines.

 We still need to sort out X11. Too bad that the xclip program isn't
 ubiquitous.

Does Perl qualify as ubiquitous? If so, the piped xclip call can be
substituted for by the following:

data - read.delim(pipe(perl -MTk -e 'print MainWindow-new-SelectionGet'))

Works fine under Linux.

HTH, Bernhard

__
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] its plot with pch-argument

2005-02-21 Thread Mäkinen Jussi
Hi mighty R-gurus and other enthusiastics,

I just encountered this:

library(its)
x - its(sort(rnorm(10)), as.POSIXct(Sys.time() + 1:10))
plot(x, type = p, pch = c(rep(A, 5), rep(B, 5)))

Am I missing something if I expect that all the points labeled as 'A' should be 
below all those labeled as 'B'? 

Thanks,

Jussi Mäkinen

platform i386-pc-mingw32
arch i386   
os   mingw32
system   i386, mingw32  
status  
major2  
minor0.1
year 2004   
month11 
day  15 
language R

__
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] save plot as jpg/gif

2005-02-21 Thread Liu, Jane

I am generating multiple plots and would like to save them as jpg or gif
files. Could someone tell me which function I shall use?

Thanks!

__
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: X11 copy paste (was: Re: [R] Easy cut paste from Excel to R?)

2005-02-21 Thread Prof Brian Ripley
On Mon, 21 Feb 2005, Bernhard Bruemmer wrote:
Peter Dalgaard [EMAIL PROTECTED] writes:
Don MacQueen [EMAIL PROTECTED] writes:
I tried Ken's suggestion read.table(pipe(pbpaste),header=TRUE) on
my Mac OS X system and it worked *without* generating any warning
message.
If my experience represents the norm, and Ken's is the exception, it
is so simple that no further contribution to R is needed, I would
say.  Thank you, Ken.
My conjecture is that it only happens when there are fewer than 5 data
lines.
We still need to sort out X11. Too bad that the xclip program isn't
ubiquitous.
Does Perl qualify as ubiquitous?
It is specifically not required for R at runtime: see the `Writing R 
Extensions' manual.

If so, the piped xclip call can be
substituted for by the following:
data - read.delim(pipe(perl -MTk -e 'print MainWindow-new-SelectionGet'))
Works fine under Linux.
HTH, Bernhard
__
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
--
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595
__
R-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] Hosting a R Graph Gallery?

2005-02-21 Thread Eric Lecoutre
Hi,
About any graph gallery:
Philippe Grojean and me did have made some work. Our goal was to add a clip 
library to the SciViews project that would offer access to a graph gallery. 
I was workiong on the production of the gallery, where as Philippe is still 
working on his GUI API. One of the goal is to have automatic wizards to 
make easier the creation of a graphic.

Here was our approach and some thoughts:
- We should propose a format for a description file. Here are some elements 
that should be gathered for each graphic function:
- Name of the function (*)
- Name of the produced graphic (*)
- Description of the graphic (*)
- Number of variables (univariate / bivariate / multivariate...)
- Types of variables
- Sample code (sample graph) (*)
- Package (*)
The (*) are some information already available in Rd files (except maybe 
sample graph).

- If someone deos something, I think it would be useful to ensure that all 
is reusable. We should focus on describing graphics. Then, for example, 
SciViews could use the information to create a usable graph gallery.

If someone is interested, I ahve put in the following archive all my 
current code:
http://www.stat.ucl.ac.be/ISpersonnel/lecoutre/R/svGraphGallery.zip

There is no explanation but I would provide comments and help to any 
volonteer (basically, there is a file  .ggs with some descriptions as 
stated before and some R code to that produce HTML files).

The result (the current gallery) is there. It is aimed to be something like 
300 pixels large. At final step, graph would be clickable with a wizard.

http://www.stat.ucl.ac.be/ISpersonnel/lecoutre/R/svGraphGallery/dock/svGallery.html

Eric
At 08:46 21/02/2005, Robert Cunningham wrote:
I too have often though a R-gallery would be useful.
It seems to me that a Wiki-style page with a database backend would be
the best bet.
It also seems to be that the best place to start is a complete image
gallery produced from all the examples in R base, then in packages in
CRAN. In this context the graphicsQC package
(http://www.stat.auckland.ac.nz/~paul/R/graphicsQC_0.4.tar.g) of Paul
Murrell seems useful.
Cheers,
Robert Cunningham

Romain Francois [EMAIL PROTECTED] writes:
 Hello Sander,

 That's a good idea and i am up to it.

 Right now i am in an exam period, so it's not really the better time,
 give me a couple of weeks and i will come up with a specific format of
 R files to submit to me that i could post-process to generate html
 documents.
 To my mind, those html files should show :

 - the plot itself
 + Submitter(s)
 - web page
 - email (eventually protected, I don't know how to do it)
 - Bibliographic references
 - Required R packages
 + Commentaries
- in english
- and in any other languages

 I'm open to any suggestion.

 Romain.

 Le 18.02.2005 14:33, Sander Oom a écrit :

 Dear R users,

 Following some of the recent questions and discussions about the R
 plotting abilities, it occurred to me again that it would be very
 valuable to have an R graph gallery.

 Eric Lecoutre made a very nice example in:
 http://www.stat.ucl.ac.be/ISpersonnel/lecoutre/stats/fichiers/_gallery.pdf


 It would be very useful to many beginners, but probably also
 advanced users of R, to have an overview of R graph types with
 graphical examples  and associated R code.

 In order to facilitate the evolution of a large gallery, some sort
 of wiki environment might be most suitable, thus providing access to
 all users, but with limited maintenance costs for the provider.

 Do others agree this could be a valuable resource? Would anybody
 have the resources to host such an R graph gallery?

 Yours,

 Sander Oom.

 --
 Romain FRANCOIS : [EMAIL PROTECTED]
 page web : http://addictedtor.free.fr/ (en construction)
 06 18 39 14 69 / 01 46 80 65 60
 ___
 Etudiant en 3eme année
 Institut de Statistique de l'Université de Paris (ISUP)
 Filière Industrie et Services
 http://www.isup.cicrp.jussieu.fr/

 __
 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-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
Eric Lecoutre
UCL /  Institut de Statistique
Voie du Roman Pays, 20
1348 Louvain-la-Neuve
Belgium
tel: (+32)(0)10473050
[EMAIL PROTECTED]
http://www.stat.ucl.ac.be/ISpersonnel/lecoutre
If the statistics are boring, then you've got the wrong numbers. -Edward 
Tufte

__
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] save plot as jpg/gif

2005-02-21 Thread BXC (Bendix Carstensen)
?Devices

 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of Liu, Jane
 Sent: Monday, February 21, 2005 10:14 AM
 To: RHELP
 Subject: [R] save plot as jpg/gif
 
 
 
 I am generating multiple plots and would like to save them as 
 jpg or gif files. Could someone tell me which function I shall use?
 
 Thanks!
 
 __
 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-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] Two-factorial Huynh-Feldt-Test

2005-02-21 Thread Peter Dalgaard
Bela Bauer [EMAIL PROTECTED] writes:

 Peter Dalgaard wrote:
 
  My suspicion would be that it has something to do with calculating the
  correction terms before or after contrast transformations (there must
  be a coordinate-free version of the corrections?), but I can't grok
  the details that easily.
 
 I must admit that I'm not too familiar with the way R handles these
 calculations internally, so I don't quite see what you mean. Could you
 somehow clarify this, possibly by pointing me to relevant
 documentation?

I was thinking of the way SAS does it. This is unusually unclear in
the documentation (you can say many things about SAS, but
underdocumentation is not normally one of them). The point is that the
G-G formula involving on- and off-diagonal terms of the empirical
covariance matrix cannot be expected to work if you're looking at
something other than the simple intercolumn contrasts (and you had a
nested two-way structure in the columns). 

I've been reading up on the original papers by G+G and importantly the
two papers by Box (1954) whose results they are using. As it turns
out, the fundamental approximation is in terms of eigenvalues, and
generalizes neatly to arbitrary sets of contrasts. All the unintuitive
stuff is really about fleshing this out in common-use cases in times
where practitioners would not be expected to carry out an eigenvalue
computation. The interesting bit is now whether an implementation of
the eigenvalue formula gives the same results as SAS gets. I'll get
there... 

 
  However, if you peek over on the R-devel
  list, you will see that I was just about to get serious with
  programming some of this stuff as methods for the mlm class. I think
  you just volunteered to test the code...
 
 
 I'd be happy to do that. I've subscribed to R-devel following your
 last email, but I can't seem to be able to find the thread that you're
 referring to. Could you forward the relevent messages or the code to
 me?
 
https://stat.ethz.ch/pipermail/r-devel/2005-February/032240.html

(No code as yet, it is just an outline)

-- 
   O__   Peter Dalgaard Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics 2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark  Ph: (+45) 35327918
~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907

__
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] save plot as jpg/gif

2005-02-21 Thread Prof Brian Ripley
On Mon, 21 Feb 2005, Liu, Jane wrote:
I am generating multiple plots and would like to save them as jpg or gif
files. Could someone tell me which function I shall use?
jpeg() or bitmap()
R does not support GIF files because of the patent difficulties until 
recently (and possibly still, although the US, European and Japanese 
patents have expired: http://cloanto.com/users/mcb/19950127giflzw.html) 
and a preference for PNG (see png()) which can easily be converted to gifs 
if needed.

--
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595
__
R-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] Sorting a matrix on two columns

2005-02-21 Thread Rau, Roland
Hi Glen,

 
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Jones, Glen R

If a matrix with 5 columns has been defined and the first two columns
need to be sorted in ascending order, how can this be achieved whilst
ensuring the 
other 3 columns data are in relative position to the sorted columns?


does the following example-code help you?
mymatrix should resemble the structure of your (original) matrix.
mymatrix2 is the new, sorted matrix.

mymatrix - matrix(runif(80), ncol=5)
mymatrix[,1] - sample(c(1,2), size=length(mymatrix[,1]), replace=TRUE)
mymatrix

mymatrix2 - mymatrix[order(mymatrix[,1],mymatrix[,2]),]
mymatrix2



Best,
Roland


+
This mail has been sent through the MPI for Demographic Rese...{{dropped}}

__
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] Hosting a R Graph Gallery?

2005-02-21 Thread Philippe Grosjean
Hello,
Just to add a word to what Eric said. I think a graph gallery for R 
would be a very nice initiative. Of course, the easiest way would be a 
series of HTML of WiKi pages, with downloadable example R code. However, 
if someone volunteers to start and maintain a 'GraphGallery' R package, 
it would be much better. This way, example code could be run simply with:
 example(agraph)

Definitely, the weakness of the R-help system is that it does not allow 
pictures. Thus you have to actually run the examples to see the results. 
However, one could imagine a very simple function making thumbnails of 
all graphs in the gallery, using par(mfrow=...) and running all examples.

The complex format for graph galleries proposed by Eric, which is 
embedded in the development version of SciViews is probably not suitable 
for a wider use. A Graph Gallery for R should be better independent from 
any complement to R itself, like SciViews.

However, there are several good ideas in the format proposed by Eric 
(well, some debugging is still required), and the idea is to have a 
graph gallery that could be expanded to a GUI graph gallery, like in 
S-PLUS, that is, calling a particular graph could possibly display a 
dialog box where fields for parameters (x, y, line color, title, ...). 
Remember that SciViews is a GUI for R ;-) All this oculd be done with 
the tcltk package.

Anyway, the most important is to collect the material together. Then, 
more ambitous ways of providing code and example to R users could be 
build later...

I think that Paul Murrell, among other certainly has some good ideas, 
because he is preparing a book about R graphics 
(http://www.stat.auckland.ac.nz/~paul/RGraphics/rgraphics.html) and his 
is, after all, the grid gourou!

Best,
Philippe Grosjean
..°}))
 ) ) ) ) )
( ( ( ( (Prof. Philippe Grosjean
 ) ) ) ) )
( ( ( ( (Numerical Ecology of Aquatic Systems
 ) ) ) ) )   Mons-Hainaut University, Pentagone (3D08)
( ( ( ( (Academie Universitaire Wallonie-Bruxelles
 ) ) ) ) )   8, av du Champ de Mars, 7000 Mons, Belgium
( ( ( ( (
 ) ) ) ) )   phone: + 32.65.37.34.97, fax: + 32.65.37.30.54
( ( ( ( (email: [EMAIL PROTECTED]
 ) ) ) ) )
( ( ( ( (web:   http://www.umh.ac.be/~econum
 ) ) ) ) )  http://www.sciviews.org
( ( ( ( (
..
Eric Lecoutre wrote:
Hi,
About any graph gallery:
Philippe Grojean and me did have made some work. Our goal was to add a 
clip library to the SciViews project that would offer access to a graph 
gallery. I was workiong on the production of the gallery, where as 
Philippe is still working on his GUI API. One of the goal is to have 
automatic wizards to make easier the creation of a graphic.

Here was our approach and some thoughts:
- We should propose a format for a description file. Here are some 
elements that should be gathered for each graphic function:
- Name of the function (*)
- Name of the produced graphic (*)
- Description of the graphic (*)
- Number of variables (univariate / bivariate / multivariate...)
- Types of variables
- Sample code (sample graph) (*)
- Package (*)
The (*) are some information already available in Rd files (except maybe 
sample graph).

- If someone deos something, I think it would be useful to ensure that 
all is reusable. We should focus on describing graphics. Then, for 
example, SciViews could use the information to create a usable graph 
gallery.

If someone is interested, I ahve put in the following archive all my 
current code:
http://www.stat.ucl.ac.be/ISpersonnel/lecoutre/R/svGraphGallery.zip

There is no explanation but I would provide comments and help to any 
volonteer (basically, there is a file  .ggs with some descriptions as 
stated before and some R code to that produce HTML files).

The result (the current gallery) is there. It is aimed to be something 
like 300 pixels large. At final step, graph would be clickable with a 
wizard.

http://www.stat.ucl.ac.be/ISpersonnel/lecoutre/R/svGraphGallery/dock/svGallery.html 


Eric
At 08:46 21/02/2005, Robert Cunningham wrote:
I too have often though a R-gallery would be useful.
It seems to me that a Wiki-style page with a database backend would be
the best bet.
It also seems to be that the best place to start is a complete image
gallery produced from all the examples in R base, then in packages in
CRAN. In this context the graphicsQC package
(http://www.stat.auckland.ac.nz/~paul/R/graphicsQC_0.4.tar.g) of Paul
Murrell seems useful.
Cheers,
Robert Cunningham

Romain Francois [EMAIL PROTECTED] writes:
 Hello Sander,

 That's a good idea and i am up to it.

 Right now i am in an exam period, so it's not really the better time,
 give me a couple of weeks and i will come up with a specific format of
 R files to submit to me that i could post-process to generate html
 documents.
 To my mind, those html 

Re: [R] Hosting a R Graph Gallery?

2005-02-21 Thread Shigeru Mase
Mere reference. There is already a wiki-based R graphics library at

http://www.okada.jp.org/RWiki/index.php?%A5%B0%A5%E9%A5%D5%A5%A3%A5%C3%A5%AF%A5%B9%BB%B2%B9%CD%BC%C2%CE%E3%BD%B8

Of course, almost all pages are in Japanese and most r-users would feel
difficult to visit (and post an example graphics) a Japanese site :-).
This graphics library pages have been very useful for Japanese R users
to see excellent and diverse graphics capabilities of R. I am looking
forward to the proposed library in near future. From our experience, a
wiki site is an excellent base for such library.

Shigeru Mase


Eric Lecoutre wrote:
 
 Hi,
 
 About any graph gallery:
 Philippe Grojean and me did have made some work. Our goal was to add a 
 clip library to the SciViews project that would offer access to a graph 
 gallery. I was workiong on the production of the gallery, where as 
 Philippe is still working on his GUI API. One of the goal is to have 
 automatic wizards to make easier the creation of a graphic.
 
 Here was our approach and some thoughts:
 
 - We should propose a format for a description file. Here are some 
 elements that should be gathered for each graphic function:
 - Name of the function (*)
 - Name of the produced graphic (*)
 - Description of the graphic (*)
 - Number of variables (univariate / bivariate / multivariate...)
 - Types of variables
 - Sample code (sample graph) (*)
 - Package (*)
 The (*) are some information already available in Rd files (except maybe 
 sample graph).
 
 - If someone deos something, I think it would be useful to ensure that 
 all is reusable. We should focus on describing graphics. Then, for 
 example, SciViews could use the information to create a usable graph 
 gallery.
 
 If someone is interested, I ahve put in the following archive all my 
 current code:
 http://www.stat.ucl.ac.be/ISpersonnel/lecoutre/R/svGraphGallery.zip
 
 There is no explanation but I would provide comments and help to any 
 volonteer (basically, there is a file  .ggs with some descriptions as 
 stated before and some R code to that produce HTML files).
 
 The result (the current gallery) is there. It is aimed to be something 
 like 300 pixels large. At final step, graph would be clickable with a 
 wizard.
 
 http://www.stat.ucl.ac.be/ISpersonnel/lecoutre/R/svGraphGallery/dock/svGallery.html
  
 
 
 
 
 Eric

__
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] Two-factorial Huynh-Feldt-Test

2005-02-21 Thread Bela Bauer
Peter Dalgaard wrote:
Bela Bauer [EMAIL PROTECTED] writes:
My suspicion would be that it has something to do with calculating the
correction terms before or after contrast transformations (there must
be a coordinate-free version of the corrections?), but I can't grok
the details that easily.
It turns out now that the error is caused by a completely different 
problem: I had a small mistake in my code, which caused an error in the 
calculation of the cell means for the covariance matrix. I fixed it and 
now I'm getting the same H-F and G-G values as SAS. Sorry for the 
confusion...

I'm still looking for an efficient way to print the new summary. Is 
there any easy way to tell the summary or print functions about the 
corrected degrees of freedom?

However, if you peek over on the R-devel
list, you will see that I was just about to get serious with
programming some of this stuff as methods for the mlm class. I think
you just volunteered to test the code...
I'd be happy to do that. I've subscribed to R-devel following your
last email, but I can't seem to be able to find the thread that you're
referring to. Could you forward the relevent messages or the code to
me?
 
https://stat.ethz.ch/pipermail/r-devel/2005-February/032240.html

(No code as yet, it is just an outline)
Well, if you're interested in my (corrected) code, I'll be happy to 
forward it to you. I'll also try to follow the development in R-devel 
and I'll be happy to test the code once it's ready.

Thanks again
Bela
__
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] character occurence within a string

2005-02-21 Thread Marc Mamin
Hello,

I'm looking for a function that counts the occurences of a given character 
within a string.

f('|','ab|c|d') = 2


More precisely, I need to complete a vector of strings to ensure that all 
elements have the same count of a separator:

a|b|c
a
|a|b|c|d

=

a|b|c||
a
|a|b|c|d

I guess that scan makes use of an internal function that would do the job...


Thanks,

Marc Mamin

__
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] character occurence within a string

2005-02-21 Thread Prof Brian Ripley
Here are two ways for one string, both easily vectorized:
1) sum(charToRaw(x) == charToRaw(|))
2) sum(strsplit(x, )[[1]] == |)
In R-devel the first looks for bytes and the second for characters, and in 
UTF-8 locale there is a difference.

On Mon, 21 Feb 2005, Marc Mamin wrote:
Hello,
I'm looking for a function that counts the occurences of a given 
character within a string.

f('|','ab|c|d') = 2
More precisely, I need to complete a vector of strings to ensure that 
all elements have the same count of a separator:

a|b|c
a
|a|b|c|d
=
a|b|c||
a
|a|b|c|d
I guess that scan makes use of an internal function that would do the job...
No, it works on an internal buffer.
--
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595
__
R-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] character occurence within a string

2005-02-21 Thread Dimitris Rizopoulos
a simple solution is:
vec.strings - c(ab|c|d, a|b|c, a, |a|b|c|d)
f - function(pat, vec.strings) sapply(strsplit(vec.strings, pat, 
fixed=TRUE), length)-1
f(|, vec.strings)

but probably there are better proposals.
Best,
Dimitris

Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/16/336899
Fax: +32/16/337015
Web: http://www.med.kuleuven.ac.be/biostat/
http://www.student.kuleuven.ac.be/~m0390867/dimitris.htm
- Original Message - 
From: Marc Mamin [EMAIL PROTECTED]
To: R-help@stat.math.ethz.ch
Sent: Monday, February 21, 2005 12:35 PM
Subject: [R] character occurence within a string


Hello,
I'm looking for a function that counts the occurences of a given 
character within a string.

f('|','ab|c|d') = 2
More precisely, I need to complete a vector of strings to ensure 
that all elements have the same count of a separator:

a|b|c
a
|a|b|c|d
=
a|b|c||
a
|a|b|c|d
I guess that scan makes use of an internal function that would do 
the job...

Thanks,
Marc Mamin
__
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-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] Compare rows of two matrices

2005-02-21 Thread TEMPL Matthias
Hello,

#I have two matrices, eg.:

y -  matrix( c(20,  NA,  NA,  45,  50,  19,  32, 101,  10,  22,  NA,  NA,  80, 
 49,  61, 190), ncol=4 )
x -  matrix( c(20,  NA,  NA,  NA,  50,  19,  32, 101,  10,  22,  NA,  NA,  80, 
 49,  61, 190), ncol=4 )

#Whereas x contains all NA´s from y plus some additional NA´s.
#I want to find the index of these additional NA´s. I think, there must be a 
very easy way to do this.

#Here are the indices of NA´s in x and y:
l1 - which(is.na(x), arr.ind=TRUE)
l2 - which(is.na(y), arr.ind=TRUE)

# l1
# [,1] [,2]
#[1,]21
#[2,]31
#[3,]41
#[4,]33
#[5,]43

# l2
# row col
#[1,]   2   1
#[2,]   3   1
#[3,]   3   3
#[4,]   4   3

#Now I want to find a matrix, which includes the values of l1, without the rows 
of l2, 
#which has equal entities (the index of the additional NA´S).
#In this example the result should be row 3 of l1 with the values 4 and 1.
#The following code works, but I think there must be a much more elegant way to 
do this.

l3 - l1
l3 - cbind( l1, rep(0, nrow(l1)) )
num - 1
   
for( i in 1:nrow(l1) ){
  for( j in 1:nrow(l2) ){
if( l1[i,1] == l2[j,1]  l1[i,2] == l2[j,2]){
  l3[i,3] - 1
}
  }
}

l4 - l3[l3[,3]==0, c(1,2)]

# l4
#row col 
#  4   1  

I have often such problems like this and I assume, that other people have 
similar tasks.
My question is: Does anybody know a function in one package, which compares 
rows of two matrices like this or have anybody an idea to do this in a much 
more elegant way? 

Thank you very much,
Matthias

__
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] rw2001 RMA in GeenSpring Error in sigToEnv

2005-02-21 Thread Liu, Xin
Dear all,

What I use is the latest version of R: rw2001. And I got the following error 
message when I run RMA in GeneSpring:

Error in sigToEnv(signature, fdef) : Trying to get slot signature from an 
object of a basic class (NULL) with no slots
In addition: Warning message: 
Incompatible phenoData object. Created a new one.
 in: read.affybatch(filenames = files)

Which information I should provide furthur or the latest version of R has some 
bugs?
Thanks a lot!

Xin LIU

This e-mail is from ArraDx Ltd

The e-mail and any files transmitted with it are confidentia...{{dropped}}

__
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] its plot with pch-argument

2005-02-21 Thread Gabor Grothendieck
Mkinen Jussi Jussi.Makinen at valtiokonttori.fi writes:

: 
: Hi mighty R-gurus and other enthusiastics,
: 
: I just encountered this:
: 
: library(its)
: x - its(sort(rnorm(10)), as.POSIXct(Sys.time() + 1:10))
: plot(x, type = p, pch = c(rep(A, 5), rep(B, 5)))
: 
: Am I missing something if I expect that all the points labeled as 'A' should 
be below all those labeled as 'B'? 
: 

Try this in place of your last line:

   plot(x, type = p, pch = letters)

From that output it seems that it is erroneously plotting the first 
point twice and the last point twice.This suggests the following
workaround:

   plot(x, type = p, pch = c(rep(A, 5+1), rep(B, 5+1)))

Another possibility is to use the zoo package to plot it:

   library(zoo)
   plot(as.zoo(x), type = p, pch = list(c(rep(A, 5), rep(B, 5

__
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] Compare rows of two matrices

2005-02-21 Thread R user
 y -  matrix( c(20,  NA,  NA,  45,  50,  19,  32, 101,  10,  22,  NA,  NA,  
 80,  49,  61, 190), ncol=4 )
 x -  matrix( c(20,  NA,  NA,  NA,  50,  19,  32, 101,  10,  22,  NA,  NA,  
 80,  49,  61, 190), ncol=4 )
 
 #Whereas x contains all NA´s from y plus some additional NA´s.
 #I want to find the index of these additional NA´s. I think, there must be a 
 very easy way to do this.


How about this:

  is.na(x)  !is.na(y)


Jonne.

__
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] Compare rows of two matrices

2005-02-21 Thread Dimitris Rizopoulos
maybe something like this:
which(is.na(y)!=is.na(x), arr.ind=TRUE)
I hope it helps.
Best,
Dimitris

Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/16/336899
Fax: +32/16/337015
Web: http://www.med.kuleuven.ac.be/biostat/
http://www.student.kuleuven.ac.be/~m0390867/dimitris.htm
- Original Message - 
From: TEMPL Matthias [EMAIL PROTECTED]
To: r-help@stat.math.ethz.ch
Sent: Monday, February 21, 2005 3:48 PM
Subject: [R] Compare rows of two matrices


Hello,
#I have two matrices, eg.:
y -  matrix( c(20,  NA,  NA,  45,  50,  19,  32, 101,  10,  22, 
NA,  NA,  80,  49,  61, 190), ncol=4 )
x -  matrix( c(20,  NA,  NA,  NA,  50,  19,  32, 101,  10,  22, 
NA,  NA,  80,  49,  61, 190), ncol=4 )

#Whereas x contains all NA´s from y plus some additional NA´s.
#I want to find the index of these additional NA´s. I think, there 
must be a very easy way to do this.

#Here are the indices of NA´s in x and y:
l1 - which(is.na(x), arr.ind=TRUE)
l2 - which(is.na(y), arr.ind=TRUE)
# l1
# [,1] [,2]
#[1,]21
#[2,]31
#[3,]41
#[4,]33
#[5,]43
# l2
# row col
#[1,]   2   1
#[2,]   3   1
#[3,]   3   3
#[4,]   4   3
#Now I want to find a matrix, which includes the values of l1, 
without the rows of l2,
#which has equal entities (the index of the additional NA´S).
#In this example the result should be row 3 of l1 with the values 4 
and 1.
#The following code works, but I think there must be a much more 
elegant way to do this.

l3 - l1
l3 - cbind( l1, rep(0, nrow(l1)) )
num - 1
for( i in 1:nrow(l1) ){
 for( j in 1:nrow(l2) ){
   if( l1[i,1] == l2[j,1]  l1[i,2] == l2[j,2]){
 l3[i,3] - 1
   }
 }
}
l4 - l3[l3[,3]==0, c(1,2)]
# l4
#row col
#  4   1
I have often such problems like this and I assume, that other people 
have similar tasks.
My question is: Does anybody know a function in one package, which 
compares rows of two matrices like this or have anybody an idea to 
do this in a much more elegant way?

Thank you very much,
Matthias
__
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-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] Compare rows of two matrices

2005-02-21 Thread Liaw, Andy
Here's one way:

 idx - which(! paste(l1, collapse=:) %in% paste(l2, collpase=:))
 l1[idx,]
row col 
  2   1 

Andy

 From:  TEMPL Matthias
 
 Hello,
 
 #I have two matrices, eg.:
 
 y -  matrix( c(20,  NA,  NA,  45,  50,  19,  32, 101,  10,  
 22,  NA,  NA,  80,  49,  61, 190), ncol=4 )
 x -  matrix( c(20,  NA,  NA,  NA,  50,  19,  32, 101,  10,  
 22,  NA,  NA,  80,  49,  61, 190), ncol=4 )
 
 #Whereas x contains all NA´s from y plus some additional NA´s.
 #I want to find the index of these additional NA´s. I think, 
 there must be a very easy way to do this.
 
 #Here are the indices of NA´s in x and y:
 l1 - which(is.na(x), arr.ind=TRUE)
 l2 - which(is.na(y), arr.ind=TRUE)
 
 # l1
 # [,1] [,2]
 #[1,]21
 #[2,]31
 #[3,]41
 #[4,]33
 #[5,]43
 
 # l2
 # row col
 #[1,]   2   1
 #[2,]   3   1
 #[3,]   3   3
 #[4,]   4   3
 
 #Now I want to find a matrix, which includes the values of 
 l1, without the rows of l2, 
 #which has equal entities (the index of the additional NA´S).
 #In this example the result should be row 3 of l1 with the 
 values 4 and 1.
 #The following code works, but I think there must be a much 
 more elegant way to do this.
 
 l3 - l1
 l3 - cbind( l1, rep(0, nrow(l1)) )
 num - 1

 for( i in 1:nrow(l1) ){
   for( j in 1:nrow(l2) ){
 if( l1[i,1] == l2[j,1]  l1[i,2] == l2[j,2]){
   l3[i,3] - 1
 }
   }
 }
 
 l4 - l3[l3[,3]==0, c(1,2)]
 
 # l4
 #row col 
 #  4   1  
 
 I have often such problems like this and I assume, that other 
 people have similar tasks.
 My question is: Does anybody know a function in one package, 
 which compares rows of two matrices like this or have anybody 
 an idea to do this in a much more elegant way? 
 
 Thank you very much,
 Matthias
 
 __
 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-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] Compare rows of two matrices

2005-02-21 Thread TEMPL Matthias
Ohh. Now I begin to see. It´s really simple and elegant!
Thank you very much!!!
Matthias


 maybe something like this:
 
 which(is.na(y)!=is.na(x), arr.ind=TRUE)
 
 I hope it helps.
 
 Best,
 Dimitris
 
 
 Dimitris Rizopoulos
 Ph.D. Student
 Biostatistical Centre
 School of Public Health
 Catholic University of Leuven
 
 Address: Kapucijnenvoer 35, Leuven, Belgium
 Tel: +32/16/336899
 Fax: +32/16/337015
 Web: http://www.med.kuleuven.ac.be/biostat/
  http://www.student.kuleuven.ac.be/~m0390867/dimitris.htm
 
-
 How about this:
 
   is.na(x)  !is.na(y)
 
 
 Jonne.
 
-
 
 - Original Message - 
 From: TEMPL Matthias [EMAIL PROTECTED]
 To: r-help@stat.math.ethz.ch
 Sent: Monday, February 21, 2005 3:48 PM
 Subject: [R] Compare rows of two matrices
 
 
  Hello,
 
  #I have two matrices, eg.:
 
  y -  matrix( c(20,  NA,  NA,  45,  50,  19,  32, 101,  10,  22,
  NA,  NA,  80,  49,  61, 190), ncol=4 )
  x -  matrix( c(20,  NA,  NA,  NA,  50,  19,  32, 101,  10,  22, 
  NA,  NA,  80,  49,  61, 190), ncol=4 )
 
  #Whereas x contains all NA´s from y plus some additional 
 NA´s. #I want 
  to find the index of these additional NA´s. I think, there 
 must be a 
  very easy way to do this.
 
  #Here are the indices of NA´s in x and y:
  l1 - which(is.na(x), arr.ind=TRUE)
  l2 - which(is.na(y), arr.ind=TRUE)
 
  # l1
  # [,1] [,2]
  #[1,]21
  #[2,]31
  #[3,]41
  #[4,]33
  #[5,]43
 
  # l2
  # row col
  #[1,]   2   1
  #[2,]   3   1
  #[3,]   3   3
  #[4,]   4   3
 
  #Now I want to find a matrix, which includes the values of l1,
  without the rows of l2,
  #which has equal entities (the index of the additional NA´S).
  #In this example the result should be row 3 of l1 with the values 4 
  and 1.
  #The following code works, but I think there must be a much more 
  elegant way to do this.
 
  l3 - l1
  l3 - cbind( l1, rep(0, nrow(l1)) )
  num - 1
 
  for( i in 1:nrow(l1) ){
   for( j in 1:nrow(l2) ){
 if( l1[i,1] == l2[j,1]  l1[i,2] == l2[j,2]){
   l3[i,3] - 1
 }
   }
  }
 
  l4 - l3[l3[,3]==0, c(1,2)]
 
  # l4
  #row col
  #  4   1
 
  I have often such problems like this and I assume, that other people
  have similar tasks.
  My question is: Does anybody know a function in one package, which 
  compares rows of two matrices like this or have anybody an idea to 
  do this in a much more elegant way?
 
  Thank you very much,
  Matthias
 
  __
  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-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] What file did R read?

2005-02-21 Thread BXC (Bendix Carstensen)
When I run in BATCH mode I use a script (win2000):

c:\stat\r\%R_VERS%\bin\Rcmd BATCH -q --no-restore --no-save %1

Now I want to be able to print the filename of the program, i.e.
the value if the %1 argument, in the .Rout file. 

(Basically I want to write a piece of code in .First() which 
prints date and time and program run, so I need to get to the 
value of %1. Currently I let the operating system print the value 
of %1 to a file, and then read the contents of this file.
Clumsy, it works, but tricky to port to another machine.)

The commandArgs() does NOT capture the name of the input file.

Is it impossible to recover this filename from within R?

Bendix Carstensen
--
Bendix Carstensen
Senior Statistician
Steno Diabetes Center
Niels Steensens Vej 2
DK-2820 Gentofte
Denmark
tel: +45 44 43 87 38
mob: +45 30 75 87 38
fax: +45 44 43 07 06
[EMAIL PROTECTED]
www.biostat.ku.dk/~bxc

__
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] Compare rows of two matrices

2005-02-21 Thread Adaikalavan Ramasamy
Here is an another way

   count - is.na(x) + is.na(y)
   which( count == 1, arr.ind=TRUE )

'count' gives you the number of missing values at for each row and
column. Then you can find out how many occurances of both missing, none
missing and one missing. 
 


On Mon, 2005-02-21 at 15:48 +0100, TEMPL Matthias wrote:
 Hello,
 
 #I have two matrices, eg.:
 
 y -  matrix( c(20,  NA,  NA,  45,  50,  19,  32, 101,  10,  22,  NA,  NA,  
 80,  49,  61, 190), ncol=4 )
 x -  matrix( c(20,  NA,  NA,  NA,  50,  19,  32, 101,  10,  22,  NA,  NA,  
 80,  49,  61, 190), ncol=4 )
 
 #Whereas x contains all NAs from y plus some additional NAs.
 #I want to find the index of these additional NAs. I think, there must be a 
 very easy way to do this.
 
 #Here are the indices of NAs in x and y:
 l1 - which(is.na(x), arr.ind=TRUE)
 l2 - which(is.na(y), arr.ind=TRUE)
 
 # l1
 # [,1] [,2]
 #[1,]21
 #[2,]31
 #[3,]41
 #[4,]33
 #[5,]43
 
 # l2
 # row col
 #[1,]   2   1
 #[2,]   3   1
 #[3,]   3   3
 #[4,]   4   3
 
 #Now I want to find a matrix, which includes the values of l1, without the 
 rows of l2, 
 #which has equal entities (the index of the additional NAS).
 #In this example the result should be row 3 of l1 with the values 4 and 1.
 #The following code works, but I think there must be a much more elegant way 
 to do this.
 
 l3 - l1
 l3 - cbind( l1, rep(0, nrow(l1)) )
 num - 1

 for( i in 1:nrow(l1) ){
   for( j in 1:nrow(l2) ){
 if( l1[i,1] == l2[j,1]  l1[i,2] == l2[j,2]){
   l3[i,3] - 1
 }
   }
 }
 
 l4 - l3[l3[,3]==0, c(1,2)]
 
 # l4
 #row col 
 #  4   1  
 
 I have often such problems like this and I assume, that other people have 
 similar tasks.
 My question is: Does anybody know a function in one package, which compares 
 rows of two matrices like this or have anybody an idea to do this in a much 
 more elegant way? 
 
 Thank you very much,
 Matthias
 
 __
 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-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] rw2001 RMA in GeenSpring Error in sigToEnv

2005-02-21 Thread Duncan Murdoch
On Mon, 21 Feb 2005 14:57:13 -, Liu, Xin [EMAIL PROTECTED]
wrote :

Dear all,

What I use is the latest version of R: rw2001. And I got the following error 
message when I run RMA in GeneSpring:

Error in sigToEnv(signature, fdef) : Trying to get slot signature from an 
object of a basic class (NULL) with no slots
In addition: Warning message: 
Incompatible phenoData object. Created a new one.
 in: read.affybatch(filenames = files)

Which information I should provide furthur or the latest version of R has some 
bugs?
Thanks a lot!

Xin LIU

That looks like a bug in GeneSpring, or at least an incompatibility
with the latest version of R.  You want to contact its authors.  

Duncan Murdoch

__
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] What file did R read?

2005-02-21 Thread Gabor Grothendieck


A different workaround that avoids generating a file
would be to set an environment variable in your script:

set infile=%1

and then access infile using Sys.getenv within R.


Date:   Mon, 21 Feb 2005 16:38:57 +0100 
From:   BXC (Bendix Carstensen) [EMAIL PROTECTED]
To:   r-help@stat.math.ethz.ch 
Subject:   [R] What file did R read? 

 
When I run in BATCH mode I use a script (win2000):

c:\stat\r\%R_VERS%\bin\Rcmd BATCH -q --no-restore --no-save %1

Now I want to be able to print the filename of the program, i.e.
the value if the %1 argument, in the .Rout file. 

(Basically I want to write a piece of code in .First() which 
prints date and time and program run, so I need to get to the 
value of %1. Currently I let the operating system print the value 
of %1 to a file, and then read the contents of this file.
Clumsy, it works, but tricky to port to another machine.)

The commandArgs() does NOT capture the name of the input file.

Is it impossible to recover this filename from within R?

Bendix Carstensen

__
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] rw2001 RMA in GeenSpring Error in sigToEnv

2005-02-21 Thread Adaikalavan Ramasamy
The sigToEnv error has been reported several times on the BioConductor
mailing list in this month. See :

https://stat.ethz.ch/pipermail/bioconductor/2005-February/007632.html
https://stat.ethz.ch/pipermail/bioconductor/2005-February/007674.html
https://stat.ethz.ch/pipermail/bioconductor/2005-February/007691.html
https://stat.ethz.ch/pipermail/bioconductor/2005-February/007730.html

There have not been much discussion on this. Either the problem was
solved by something simple such as upgrading to the latest version or
the authors are busy trying to find a fix. In any case, it would be
better to consult the authors or the BioConductor mailing list first.

Regards, Adai



On Mon, 2005-02-21 at 16:12 +, Duncan Murdoch wrote:
 On Mon, 21 Feb 2005 14:57:13 -, Liu, Xin [EMAIL PROTECTED]
 wrote :
 
 Dear all,
 
 What I use is the latest version of R: rw2001. And I got the following error 
 message when I run RMA in GeneSpring:
 
 Error in sigToEnv(signature, fdef) : Trying to get slot signature from an 
 object of a basic class (NULL) with no slots
 In addition: Warning message: 
 Incompatible phenoData object. Created a new one.
  in: read.affybatch(filenames = files)
 
 Which information I should provide furthur or the latest version of R has 
 some bugs?
 Thanks a lot!
 
 Xin LIU
 
 That looks like a bug in GeneSpring, or at least an incompatibility
 with the latest version of R.  You want to contact its authors.  
 
 Duncan Murdoch
 
 __
 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-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] 49 histograms on one page

2005-02-21 Thread Christian Hennig
Hi,

I want to do something like this:

par(mfrow=c(7,7))
for (i in 1:49)
  hist(RATDACOM[SUBJNO==i],breaks=0.5+(0:6),
   main=,xlab=,ylab=,xaxt=n,yaxt=n)

(Don't think about what RATDACOM and SUBJNO are.)

I get an error 
Error in plot.new() : Figure margins too large.

36 histograms with mfrow=c(6,6) work.
But the 36 histograms are then so small that I wonder why 49 do not fit.
It seems that though I have main=,xlab=,ylab=,xaxt=n,yaxt=n the
area reserved for axes and labels is almost as large as it would be if I
would print a single histogram. The histogram itself only gets the remaining
space, which is very small (I could draw 36*4 histograms of this size on a
single page and the margins between them would still be OK).

So the question is:
How do I tell R to print the essential histogram area without main, labs and
axes large enough that it looks well but small enough that 49 fit on one
page? (If I would draw them by hand, no problem...)

Best,
Christian


***
Christian Hennig
Fachbereich Mathematik-SPST/ZMS, Universitaet Hamburg
[EMAIL PROTECTED], http://www.math.uni-hamburg.de/home/hennig/
From 1 April 2005: Department of Statistical Science, UCL, London
###
ich empfehle www.boag-online.de

__
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] 49 histograms on one page

2005-02-21 Thread Liaw, Andy
You may want to set par(mar, oma) to something small, or start the device
(which one are you using?) with large enough dimension, or both.

Andy

 From: Christian Hennig
 
 Hi,
 
 I want to do something like this:
 
 par(mfrow=c(7,7))
 for (i in 1:49)
   hist(RATDACOM[SUBJNO==i],breaks=0.5+(0:6),
main=,xlab=,ylab=,xaxt=n,yaxt=n)
 
 (Don't think about what RATDACOM and SUBJNO are.)
 
 I get an error 
 Error in plot.new() : Figure margins too large.
 
 36 histograms with mfrow=c(6,6) work.
 But the 36 histograms are then so small that I wonder why 49 
 do not fit.
 It seems that though I have 
 main=,xlab=,ylab=,xaxt=n,yaxt=n the
 area reserved for axes and labels is almost as large as it 
 would be if I
 would print a single histogram. The histogram itself only 
 gets the remaining
 space, which is very small (I could draw 36*4 histograms of 
 this size on a
 single page and the margins between them would still be OK).
 
 So the question is:
 How do I tell R to print the essential histogram area without 
 main, labs and
 axes large enough that it looks well but small enough that 49 
 fit on one
 page? (If I would draw them by hand, no problem...)
 
 Best,
 Christian
 
 
 **
 *
 Christian Hennig
 Fachbereich Mathematik-SPST/ZMS, Universitaet Hamburg
 [EMAIL PROTECTED], 
 http://www.math.uni-hamburg.de/home/hennig/
 From 1 April 
 2005: Department of Statistical Science, UCL, London
 ##
 #
 ich empfehle www.boag-online.de
 
 __
 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-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] 49 histograms on one page

2005-02-21 Thread Uwe Ligges
Christian Hennig wrote:
Hi,
I want to do something like this:
par(mfrow=c(7,7))
for (i in 1:49)
  hist(RATDACOM[SUBJNO==i],breaks=0.5+(0:6),
   main=,xlab=,ylab=,xaxt=n,yaxt=n)
(Don't think about what RATDACOM and SUBJNO are.)
I get an error 
Error in plot.new() : Figure margins too large.

36 histograms with mfrow=c(6,6) work.
But the 36 histograms are then so small that I wonder why 49 do not fit.
It seems that though I have main=,xlab=,ylab=,xaxt=n,yaxt=n the
area reserved for axes and labels is almost as large as it would be if I
would print a single histogram. The histogram itself only gets the remaining
space, which is very small (I could draw 36*4 histograms of this size on a
single page and the margins between them would still be OK).
So the question is:
How do I tell R to print the essential histogram area without main, labs and
axes large enough that it looks well but small enough that 49 fit on one
page? (If I would draw them by hand, no problem...)
Christian,
set par(mar = ) very small
Uwe
Best,
Christian
***
Christian Hennig
Fachbereich Mathematik-SPST/ZMS, Universitaet Hamburg
[EMAIL PROTECTED], http://www.math.uni-hamburg.de/home/hennig/
From 1 April 2005: Department of Statistical Science, UCL, London
###
ich empfehle www.boag-online.de
__
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-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


solved: [R] 49 histograms on one page

2005-02-21 Thread Christian Hennig

The first try with mar=c(1,1,1,1) does the job!

Thanks,
Christian

On Mon, 21 Feb 2005, Liaw, Andy wrote:

 You may want to set par(mar, oma) to something small, or start the device
 (which one are you using?) with large enough dimension, or both.
 
 Andy
 
  From: Christian Hennig
  
  Hi,
  
  I want to do something like this:
  
  par(mfrow=c(7,7))
  for (i in 1:49)
hist(RATDACOM[SUBJNO==i],breaks=0.5+(0:6),
 main=,xlab=,ylab=,xaxt=n,yaxt=n)
  
  (Don't think about what RATDACOM and SUBJNO are.)
  
  I get an error 
  Error in plot.new() : Figure margins too large.
  
  36 histograms with mfrow=c(6,6) work.
  But the 36 histograms are then so small that I wonder why 49 
  do not fit.
  It seems that though I have 
  main=,xlab=,ylab=,xaxt=n,yaxt=n the
  area reserved for axes and labels is almost as large as it 
  would be if I
  would print a single histogram. The histogram itself only 
  gets the remaining
  space, which is very small (I could draw 36*4 histograms of 
  this size on a
  single page and the margins between them would still be OK).
  
  So the question is:
  How do I tell R to print the essential histogram area without 
  main, labs and
  axes large enough that it looks well but small enough that 49 
  fit on one
  page? (If I would draw them by hand, no problem...)
  
  Best,
  Christian
  
  
  **
  *
  Christian Hennig
  Fachbereich Mathematik-SPST/ZMS, Universitaet Hamburg
  [EMAIL PROTECTED], 
  http://www.math.uni-hamburg.de/home/hennig/
  From 1 April 
  2005: Department of Statistical Science, UCL, London
  ##
  #
  ich empfehle www.boag-online.de
  
  __
  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
  
  
 
 
 --
 Notice:  This e-mail message, together with any attachment...{{dropped}}

__
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] 49 histograms on one page

2005-02-21 Thread Sundar Dorai-Raj

Christian Hennig wrote:
Hi,
I want to do something like this:
par(mfrow=c(7,7))
for (i in 1:49)
  hist(RATDACOM[SUBJNO==i],breaks=0.5+(0:6),
   main=,xlab=,ylab=,xaxt=n,yaxt=n)
(Don't think about what RATDACOM and SUBJNO are.)
I get an error 
Error in plot.new() : Figure margins too large.

36 histograms with mfrow=c(6,6) work.
But the 36 histograms are then so small that I wonder why 49 do not fit.
It seems that though I have main=,xlab=,ylab=,xaxt=n,yaxt=n the
area reserved for axes and labels is almost as large as it would be if I
would print a single histogram. The histogram itself only gets the remaining
space, which is very small (I could draw 36*4 histograms of this size on a
single page and the margins between them would still be OK).
So the question is:
How do I tell R to print the essential histogram area without main, labs and
axes large enough that it looks well but small enough that 49 fit on one
page? (If I would draw them by hand, no problem...)
Best,
Christian

You may want to look at ?histogram in package:lattice.
set.seed(1)
m - 100
n - 49
RATDACOM - rnorm(m * n)
SUBJNO - rep(seq(n), each = m)
histogram(~ RATDACOM | SUBJNO,
  layout = c(7, 7),
  strip = FALSE)
--sundar
__
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] power.anova.test for interaction effects

2005-02-21 Thread Andrew Kniss
This question will probably get me in trouble on theoretical grounds, but I
will pose it anyway.

The situation:
I recently ran a field study looking for differences in sugarbeet cultivar
tolerance to a specific herbicide.  The study was set up so that 37
cultivars were treated with 4 different applications of the herbicide (37*4
factorial).  In doing so, we found that the interaction effect was highly
insignificant (ndf=108, ddf=144, F=0.28, p=1.).  Now my problem is
this... the study takes up an enormous amount of time, energy, and money (as
you could guess with 37 cultivars in a field study).  We need to determine
weather it is worth the effort to repeat the study this summer (practically,
it is not, but our funding source would like a more concrete demonstration).

I decided to try using power.anova.test just as a starting point to see what
our power was.  My question is: is this valid to do on an interaction term?
If I use power.anova.test with on the interaction term, this is what I get:

~  power.anova.test(groups=(37*4), n=3, between.var=12.06,
~+  within.var=21.23, sig.level=0.05)
~
~ Balanced one-way analysis of variance power calculation 
~
~ groups = 148
~  n = 3
~between.var = 12.06
~ within.var = 21.23
~  sig.level = 0.05
~  power = 1
~
~ NOTE: n is number in each group 


This would imply that given the variability we observed with 3 replications,
we almost certainly would have found differences if they existed.  But given
what I have read on power analysis, a high p-value and wide confidence
intervals nearly always suggest inadequate sample size. (Our 90% confidence
intervals differed from the estimates by as much as 28%, when a 10%
difference would be significant from a practical perspective.) 

So is this a valid approach? Or does the power.anova.test fall apart if
using an interaction effect? 

Thank you in advance for any help or references you are willing to point me
to.
Best regards,
Andrew Kniss
Assistant Research Scientist
University of Wyoming
Department of Plant Sciences
1000 E. University Ave.
Laramie, WY  82071  USA

[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] 49 histograms on one page

2005-02-21 Thread Rob Steele
The pdf format works well for large numbers of plots on a single page.  
You can use a viewer like Acrobat Reader to zoom in to the areas of 
interest.  Ideally you can arrange the plots in a meaningful order, 
maybe where both their horizontal and vertical position convey information.

If you want something you can actually print or read without zooming in 
and if you can live with a slightly more abstract view of your data you 
might try putting multiple box plots in a single graph.  Something like:

n = 1000
m = 49
data = data.frame(x = rnorm(n), y = trunc(runif(n, min = 1, max = m + 1)))
splits = split(data$x, data$y)
o = order(sapply(splits, median), decreasing = TRUE)
boxplot(splits[o], horizontal = TRUE)
__
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] Treatment-Contrast Interactions

2005-02-21 Thread Lorin Hochstein
Peter Dalgaard wrote:
Lorin Hochstein [EMAIL PROTECTED] writes:
 

I'd like to understand this approach as well, but I can't reproduce my
results using se.contrast. In particular, I get the same standard
error even though I tried to use different contrasts:
 c1 - c(1,-1)[A]*c(1,-1,0)[B]
 c2 - c(1,-1)[A]*c(1,0,-1)[B]
 c3 - c(1,-1)[A]*c(0,1,-1)[B]
 se.contrast(fit, as.matrix(c1))
Contrast 1
 14.24547
 se.contrast(fit,as.matrix(c2))
Contrast 1
 14.24547
 se.contrast(fit,as.matrix(c3))
Contrast 1
 14.24547
   

They could well _be_ the same if the design is balanced...

Hmmm... One of my problems is that I don't know how to interpret the 
output of se.contrast.

Here's my example again.
 score - c(12, 8,10, 6, 8, 4,
  10,12, 8, 6,10,14,
   9, 7, 9, 5,11,12,
   7,13, 9, 9, 5,11,
   8, 7, 3, 8,12,10,
  13,14,19, 9,16,14)
 n - 6
 A - gl(2,3*n,labels=c(a1,a2))
 B - rep(gl(3,n,labels=c(b1,b2,b3)),2)
 contrasts(B) - c(1,-1,0)
 fit - aov(score~A*B)
 summary(fit, split=list(B=1:2), expand.split = T)
   Df  Sum Sq Mean Sq F value   Pr(F)  
A1  18.778  18.778  2.2208 0.146606  
B2  62.000  31.000  3.6662 0.037629 *
 B: C1  1   1.500   1.500  0.1774 0.676621  
 B: C2  1  60.500  60.500  7.1551 0.011986 *
A:B  2  81.556  40.778  4.8226 0.015274 *
 A:B: C11  13.500  13.500  1.5966 0.216119 # ---
 A:B: C21  68.056  68.056  8.0486 0.008085 **
Residuals   30 253.667   8.456 

What I'm really looking for is that F value that's labelled A:B: C1, 
1.5966 in this case. (I'm not sure what to call this term, AB interaction?)

I thought that it might be possible to use se.contrast to compute this 
(or at least, to get the numerator so that I could compute the F value 
once I had the mean square error of the residuals), but I'm not sure how 
to specify the contrast, and I don't know the relationship between the 
standard error output by se.contrast and the mean square error which 
is the fourth column of the output above.

Lorin
__
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] power.anova.test for interaction effects

2005-02-21 Thread Bob Wheeler
Your F value is so low as to make me suspect your model. Where did the 
144 denominator degrees of freedom come from?

Andrew Kniss wrote:
This question will probably get me in trouble on theoretical grounds, but I
will pose it anyway.
The situation:
I recently ran a field study looking for differences in sugarbeet cultivar
tolerance to a specific herbicide.  The study was set up so that 37
cultivars were treated with 4 different applications of the herbicide (37*4
factorial).  In doing so, we found that the interaction effect was highly
insignificant (ndf=108, ddf=144, F=0.28, p=1.).  Now my problem is
this... the study takes up an enormous amount of time, energy, and money (as
you could guess with 37 cultivars in a field study).  We need to determine
weather it is worth the effort to repeat the study this summer (practically,
it is not, but our funding source would like a more concrete demonstration).
I decided to try using power.anova.test just as a starting point to see what
our power was.  My question is: is this valid to do on an interaction term?
If I use power.anova.test with on the interaction term, this is what I get:
~  power.anova.test(groups=(37*4), n=3, between.var=12.06,
~+  within.var=21.23, sig.level=0.05)
~
~ Balanced one-way analysis of variance power calculation 
~
~ groups = 148
~  n = 3
~between.var = 12.06
~ within.var = 21.23
~  sig.level = 0.05
~  power = 1
~
~ NOTE: n is number in each group 

This would imply that given the variability we observed with 3 replications,
we almost certainly would have found differences if they existed.  But given
what I have read on power analysis, a high p-value and wide confidence
intervals nearly always suggest inadequate sample size. (Our 90% confidence
intervals differed from the estimates by as much as 28%, when a 10%
difference would be significant from a practical perspective.) 

So is this a valid approach? Or does the power.anova.test fall apart if
using an interaction effect? 

Thank you in advance for any help or references you are willing to point me
to.
Best regards,
Andrew Kniss
Assistant Research Scientist
University of Wyoming
Department of Plant Sciences
1000 E. University Ave.
Laramie, WY  82071  USA
[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

--
Bob Wheeler --- http://www.bobwheeler.com/
ECHIP, Inc. ---
Randomness comes in bunches.
__
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] Distribution

2005-02-21 Thread Sean Davis
Srini
You should probably look at ?hist.  If you look at the value section, you 
will see that you can get the information you want from the values returned 
from hist.  If these are microarray probes and intensities, there may be 
specific methods for visualizing the data available from the bioconductor 
project (www.bioconductor.org).

Hope this helps,
Sean
- Original Message - 
From: Srinivas Iyyer [EMAIL PROTECTED]
To: Rhelp r-help@stat.math.ethz.ch
Sent: Monday, February 21, 2005 6:21 PM
Subject: [R] Distribution


Dear group,
apologies for asking a simple question. I have a file
where the data looks like this:
ProbeIntensity
0:0 501.0
1:0 17760.5
2:0 511.0
3:0 18468.3
4:0 199.8
5:0 508.0
6:0 17241.8
7:0 507.5
8:0 17910.0
9:0 482.5
10:0 17480.3
11:0 434.0
12:0 17631.3
13:0 444.8
14:0 17423.0
15:0 505.3
16:0 16693.0
17:0 438.5
18:0 16920.0
19:0 491.3
20:0 16878.0
21:0 486.3
22:0 16582.0
23:0 483.8
24:0 16694.8
25:0 452.3
26:0 16221.5
27:0 438.3
28:0 17119.8
29:0 455.5
30:0 16579.0
31:0 424.5
32:0 16691.3
33:0 472.0
My question is how do I know the distribution of the
intensities. My aim is to find out the number of
intensities or probes that fall in a certain range.
For example 500 probes has intensities ranging from 50
to 150.
300 probes has intensities ranging from 151-250
I have no clue how to do it for 500,000 probes. Can
any one please help doing it in R.
thanks and apologies again
srini
__
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-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] Distribution

2005-02-21 Thread Spencer Graves
 Have you considered qqnorm or hist?  If yes, PLEASE do read 
the posting guide! http://www.R-project.org/posting-guide.html;.  It 
might help you phrase your question so you are more likely to get a 
useful response -- and it might help you get the answer for yourself 
without waiting for someone to reply. 

 hope this helps.  spencer graves
Srinivas Iyyer wrote:
Dear group, 
apologies for asking a simple question. I have a file
where the data looks like this:
ProbeIntensity
0:0	501.0
1:0	17760.5
2:0	511.0
3:0	18468.3
4:0	199.8
5:0	508.0
6:0	17241.8
7:0	507.5
8:0	17910.0
9:0	482.5
10:0	17480.3
11:0	434.0
12:0	17631.3
13:0	444.8
14:0	17423.0
15:0	505.3
16:0	16693.0
17:0	438.5
18:0	16920.0
19:0	491.3
20:0	16878.0
21:0	486.3
22:0	16582.0
23:0	483.8
24:0	16694.8
25:0	452.3
26:0	16221.5
27:0	438.3
28:0	17119.8
29:0	455.5
30:0	16579.0
31:0	424.5
32:0	16691.3
33:0	472.0

My question is how do I know the distribution of the
intensities. My aim is to find out the number of
intensities or probes that fall in a certain range. 

For example 500 probes has intensities ranging from 50
to 150.
300 probes has intensities ranging from 151-250
I have no clue how to do it for 500,000 probes. Can
any one please help doing it in R.
thanks and apologies again
srini
__
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-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] rnorm??

2005-02-21 Thread Scholz, Fritz
I am wondering whether there is a bug in rnorm.
When generating rnorm(100) and counting 
the cases  4 and the cases  (-4) I get rather
unexpectedly low counts for the latter. The problem goes away
when using qnorm(runif(100)).

Fritz Scholz, PhD
Applied Statistics Group
Boeing Phantom Works
[EMAIL PROTECTED]
425-865-3623
Tu/We 206-542-6545 (most likely)

__
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] Distribution

2005-02-21 Thread Liaw, Andy
You can use table(cut(intensity, breaks)), where `intensity' is the vector
of intensity values, and `breaks' are the boundaries of the bins (e.g., c(0,
150, 250,  ...)).

Andy

 From: Srinivas Iyyer
 
 Dear group, 
 apologies for asking a simple question. I have a file
 where the data looks like this:
 ProbeIntensity
 0:0   501.0
 1:0   17760.5
 2:0   511.0
 3:0   18468.3
 4:0   199.8
 5:0   508.0
 6:0   17241.8
 7:0   507.5
 8:0   17910.0
 9:0   482.5
 10:0  17480.3
 11:0  434.0
 12:0  17631.3
 13:0  444.8
 14:0  17423.0
 15:0  505.3
 16:0  16693.0
 17:0  438.5
 18:0  16920.0
 19:0  491.3
 20:0  16878.0
 21:0  486.3
 22:0  16582.0
 23:0  483.8
 24:0  16694.8
 25:0  452.3
 26:0  16221.5
 27:0  438.3
 28:0  17119.8
 29:0  455.5
 30:0  16579.0
 31:0  424.5
 32:0  16691.3
 33:0  472.0
 
 
 My question is how do I know the distribution of the
 intensities. My aim is to find out the number of
 intensities or probes that fall in a certain range. 
 
 For example 500 probes has intensities ranging from 50
 to 150.
 
 300 probes has intensities ranging from 151-250
 
 I have no clue how to do it for 500,000 probes. Can
 any one please help doing it in R.
 
 thanks and apologies again
 
 srini
 
 __
 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-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] power.anova.test for interaction effects

2005-02-21 Thread Andrew Kniss
It's a rather complex model.  A 37*4 factorial (37 cultivars[var]; 4
herbicide treatments[trt]) with three replications[rep] was carried out at
two locations[loc], with  different randomizations within each rep at each
location.

Source   DF   Error Term  MS
Loc   1   Trt*rep(loc)12314
Rep(loc)  4   Trt*rep(loc)1230.5
Trt   3   Trt*rep(loc)64.72
Trt*loc   3   Trt*rep(loc)33.42
Trt*rep(loc) 12   Residual76.78
Var  36   Var*trt*loc 93.91
Var*trt 108   Var*trt*loc 12.06
Var*trt*loc 144   Residual43.09
Residual575   NA  21.23
  

-Original Message-
From: Bob Wheeler [mailto:[EMAIL PROTECTED] 
Sent: Monday, February 21, 2005 4:33 PM
To: [EMAIL PROTECTED]
Cc: r-help@stat.math.ethz.ch
Subject: Re: [R] power.anova.test for interaction effects

Your F value is so low as to make me suspect your model. Where did the 
144 denominator degrees of freedom come from?

Andrew Kniss wrote:

 This question will probably get me in trouble on theoretical grounds, but
I
 will pose it anyway.
 
 The situation:
 I recently ran a field study looking for differences in sugarbeet cultivar
 tolerance to a specific herbicide.  The study was set up so that 37
 cultivars were treated with 4 different applications of the herbicide
(37*4
 factorial).  In doing so, we found that the interaction effect was highly
 insignificant (ndf=108, ddf=144, F=0.28, p=1.).  Now my problem is
 this... the study takes up an enormous amount of time, energy, and money
(as
 you could guess with 37 cultivars in a field study).  We need to determine
 weather it is worth the effort to repeat the study this summer
(practically,
 it is not, but our funding source would like a more concrete
demonstration).
 
 I decided to try using power.anova.test just as a starting point to see
what
 our power was.  My question is: is this valid to do on an interaction
term?
 If I use power.anova.test with on the interaction term, this is what I
get:
 
 ~  power.anova.test(groups=(37*4), n=3, between.var=12.06,
 ~+  within.var=21.23, sig.level=0.05)
 ~
 ~ Balanced one-way analysis of variance power calculation 
 ~
 ~ groups = 148
 ~  n = 3
 ~between.var = 12.06
 ~ within.var = 21.23
 ~  sig.level = 0.05
 ~  power = 1
 ~
 ~ NOTE: n is number in each group 
 
 
 This would imply that given the variability we observed with 3
replications,
 we almost certainly would have found differences if they existed.  But
given
 what I have read on power analysis, a high p-value and wide confidence
 intervals nearly always suggest inadequate sample size. (Our 90%
confidence
 intervals differed from the estimates by as much as 28%, when a 10%
 difference would be significant from a practical perspective.) 
 
 So is this a valid approach? Or does the power.anova.test fall apart if
 using an interaction effect? 
 
 Thank you in advance for any help or references you are willing to point
me
 to.
 Best regards,
 Andrew Kniss
 Assistant Research Scientist
 University of Wyoming
 Department of Plant Sciences
 1000 E. University Ave.
 Laramie, WY  82071  USA
 
 [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
 


-- 
Bob Wheeler --- http://www.bobwheeler.com/
 ECHIP, Inc. ---
Randomness comes in bunches.

__
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] rnorm??

2005-02-21 Thread Liaw, Andy
I don't see anything suspicious (R 2.0.1 on Windows XP Pro, Pentium M):

 set.seed(1)
 res - replicate(50, {x - rnorm(1e6); c(sum(x  -4), sum(x  4))})
 apply(res, 1, summary)
[,1]  [,2]
Min.20.0 21.00
1st Qu. 27.0 30.00
Median  30.0 33.50
Mean30.7 33.74
3rd Qu. 34.0 37.00
Max.42.0 48.00
 pnorm(-4) * 1e6
[1] 31.67124
 res2 - replicate(50, {x - qnorm(runif(1e6)); c(sum(x  -4), sum(x 
4))})
 apply(res2, 1, summary)
 [,1]  [,2]
Min.18.00 19.00
1st Qu. 30.00 27.25
Median  32.00 31.00
Mean32.60 31.38
3rd Qu. 35.75 35.00
Max.47.00 45.00
 RNGkind()
[1] Mersenne-Twister Inversion   

Andy


 From: Scholz, Fritz
 
 I am wondering whether there is a bug in rnorm.
 When generating rnorm(100) and counting 
 the cases  4 and the cases  (-4) I get rather
 unexpectedly low counts for the latter. The problem goes away
 when using qnorm(runif(100)).
 
 Fritz Scholz, PhD
 Applied Statistics Group
 Boeing Phantom Works
 [EMAIL PROTECTED]
 425-865-3623
 Tu/We 206-542-6545 (most likely)
 
 __
 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-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] Categories or clusters for univariate data

2005-02-21 Thread Allen Hathaway
If I have a vector, x, such that
x - c(1,2,3,4,5,8,9,10,11,12,15,16,17,18,19,22,23,24,33,34,35)
if I plot that vector
plot(x)
it is visibly obvious that the data groups or clusters into distinct 
groupings.  The data trends along a more-or-less linear path, and then an 
abrupt jump.  For a trivial case, such as I have given, you can pick out the 
groups or categories visually, and manually derive the upper and lower 
bounds for each group.  My question is, is there a function in R that can do 
the same thing for more complex and subtle groupings in univariate data, and 
provide a statistical basis for the result?

Allen
__
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] Distribution

2005-02-21 Thread Adaikalavan Ramasamy
You can read in the data using read.delim() or read.table(). For
illustration let us generate some artificial data and suppose that you
are interested in equal sized breaks of 5 (you can define your own break
points instead).

   x   - rchisq(50, df=10, ncp=5)
   brk - seq(0, 5*ceiling(max(x)/5), by=5) # increments of size 5
   h   - hist(x, breaks=brk, plot=FALSE)

h$breaks, h$counts will give you the count and break points but I always
have trouble matching which interval the counts belong to.


Another easier way is to use cut() followed by table() where the labels
of cut is helpful.

   table( cut( x, breaks=brk ) )

As a bonus, you can simplify specifying the break points by including
Infinite as the endpoint in cut.

   brk2 - seq(0, max(x), by=5) # increments of size 5
   table( cut( x, breaks=c(brk2, Inf) ) )


Regards, Adai


On Mon, 2005-02-21 at 18:44 -0500, Sean Davis wrote:
 Srini
 
 You should probably look at ?hist.  If you look at the value section, you 
 will see that you can get the information you want from the values returned 
 from hist.  If these are microarray probes and intensities, there may be 
 specific methods for visualizing the data available from the bioconductor 
 project (www.bioconductor.org).
 
 Hope this helps,
 Sean
 
 - Original Message - 
 From: Srinivas Iyyer [EMAIL PROTECTED]
 To: Rhelp r-help@stat.math.ethz.ch
 Sent: Monday, February 21, 2005 6:21 PM
 Subject: [R] Distribution
 
 
  Dear group,
  apologies for asking a simple question. I have a file
  where the data looks like this:
  ProbeIntensity
  0:0 501.0
  1:0 17760.5
  2:0 511.0
  3:0 18468.3
  4:0 199.8
  5:0 508.0
  6:0 17241.8
  7:0 507.5
  8:0 17910.0
  9:0 482.5
  10:0 17480.3
  11:0 434.0
  12:0 17631.3
  13:0 444.8
  14:0 17423.0
  15:0 505.3
  16:0 16693.0
  17:0 438.5
  18:0 16920.0
  19:0 491.3
  20:0 16878.0
  21:0 486.3
  22:0 16582.0
  23:0 483.8
  24:0 16694.8
  25:0 452.3
  26:0 16221.5
  27:0 438.3
  28:0 17119.8
  29:0 455.5
  30:0 16579.0
  31:0 424.5
  32:0 16691.3
  33:0 472.0
 
 
  My question is how do I know the distribution of the
  intensities. My aim is to find out the number of
  intensities or probes that fall in a certain range.
 
  For example 500 probes has intensities ranging from 50
  to 150.
 
  300 probes has intensities ranging from 151-250
 
  I have no clue how to do it for 500,000 probes. Can
  any one please help doing it in R.
 
  thanks and apologies again
 
  srini
 
  __
  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-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-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] rodbc or unixodbc error

2005-02-21 Thread Sebastian Luque
Hi,

I'm trying to establish a connection to a MySQL database, and am using the
rodbc package for it. This is in a GNU/Debian Linux box, with the
corresponding Debian unstable packages. I can login to my MySQL databases
from any shell and directory, so the problem is probably not there. Here's
an example of what I'm doing:

R odbcConnect(test, uid=myusername, pwd=mypassword)
[1] -1
Warning messages: 
1: [RODBC] ERROR: state IM002, code 0, message [unixODBC][Driver Manager]Data 
source name not found, and no default driver specified 
2: ODBC connection failed in: odbcDriverConnect(st, case = case, believeNRows = 
believeNRows)


The error is apparently from unixodbc, and googling for it I found that
somebody solved it by specifying a default driver in a odbc.ini file. Can
somebody please tell whether this is the right approach, and if so, how to
write that specification? I saw that one might do this in a ~/.odbc.ini
(i.e. the user's config file) file.

Best wishes,
-- 
Sebastian Luque

__
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] problems with nonlinear fits using nls

2005-02-21 Thread Corey Bradshaw
Hello colleagues,

 

I am attempting to determine the nonlinear least-squares estimates of
the nonlinear model parameters using nls. I have come across a common
problem that R users have reported when I attempt to fit a particular
3-parameter nonlinear function to my dataset:

 

Error in nls(r ~ tlm(a, N.fix, k, theta), data = tlm.data, start =
list(a = a.st,  : 

step factor 0.000488281 reduced below `minFactor' of 0.000976563

 

Despite modifying minFactor using nls.control, I am unable to counter
the apparent singularity in the model fit. I have also tried changing
the tolerance and start parameter values to no avail. If anyone can
provide a relatively simple solution (perhaps adjusting the gradient,
but I'm not sure how to do this), I would be most appreciative. My
dataset is:

 

 tlm.data

 r N.fix

1  -0.5240708576

2   0.1053605245

3  -0.1743533950

4   0.1941560142

5   0.4870149851

6  -0.5068176083

7  -0.1743533950

8   0.5527898242

9   0.1521918273

10  0.4989911785

11  0.10821358   140

12 -0.83034830   156

13 -0.3074847068

14 -0.2231435550

15  0.0487901640

16 -0.0487901642

17  0.7537718040

18 -0.1251631485

19 -0.3662443975

 

My function is:

 

tlm - function(a,N,k,theta) (a*(1-((N/k)^theta)))

 

The nls fit I've coded is:

 

tlm.fit - try(nls(r~tlm(a,N.fix,k,theta), data=tlm.data,
start=list(a=a.st,k=k.st,theta=1),

trace=TRUE,
control=nls.control(maxiter=6000,tol=1e-05,minFactor=1/1024)))

 

I'm using start values parsed in from another (previous, but not shown)
model fit. In this case, 

 

 a.st

[1] 0.3812922

 k.st

[1] 64.66529

 

I happen to know the true values for the optimised parameters (from
another application), but I can't get nls to reproduce them. They are:

 

a = 2.0466

k = 60.8275

theta = 0.2277

 

Any ideas?

 

Regards,

Corey Bradshaw

 


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


Re: [R] Categories or clusters for univariate data

2005-02-21 Thread Achim Zeileis
On Mon, 21 Feb 2005, Allen Hathaway wrote:

 If I have a vector, x, such that

 x - c(1,2,3,4,5,8,9,10,11,12,15,16,17,18,19,22,23,24,33,34,35)

 if I plot that vector

 plot(x)

 it is visibly obvious that the data groups or clusters into distinct
 groupings.  The data trends along a more-or-less linear path, and then an
 abrupt jump.  For a trivial case, such as I have given, you can pick out the
 groups or categories visually, and manually derive the upper and lower
 bounds for each group.  My question is, is there a function in R that can do
 the same thing for more complex and subtle groupings in univariate data, and
 provide a statistical basis for the result?

Maybe breakpoints() in package strucchange can be of help. It looks for
breaks in linear regression relationships over a certain ordering of the
variables.

For the data above:

## setup index variable
idx - seq(along = x)
## find breaks in linear trend model
library(strucchange)
bp - breakpoints(x ~ idx)

## visualize fitted model
plot(x)
lines(fitted(bp))

See help(breakpoints) for further information and references for the
underlying theory.

hth,
Z

__
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] rnorm??

2005-02-21 Thread Adaikalavan Ramasamy
1) Why do you think there is a bug in rnorm. What is your expected
numbers for cases  4 or cases  -4 ? If you can show your calculations
then maybe we can see if there is an error in how you calculated it or
with R.


2) Please give a reproducible example. It might be low or high in one
instance on a single run but if you do it several times you may not see
a consistent bias. If you do, then there could be a bug. Otherwise it
could be an element of randomness.

B- 10  # increase this if you can 
out1 - matrix( nr=B, nc=2 )
out2 - matrix( nr=B, nc=2 )
thr  - 4

set.seed(1)
for(i in 1:B){
  
  x - rnorm(100)
  out1[ i, 1 ] - mean( x  thr )# empirical upper tail prob
  out1[ i, 2 ] - mean( x  -1*thr ) # empirical lower tail prob

  y - qnorm(runif(100))
  out2[ i, 1 ] - mean( y  thr )
  out2[ i, 2 ] - mean( y  -1*thr )

  rm(x, y); print(i)
}

 out1
 [,1][,2]
 [1,] 3.6e-05 3.7e-05
 [2,] 3.2e-05 2.6e-05
 [3,] 3.2e-05 2.9e-05
 [4,] 3.7e-05 2.8e-05
 [5,] 3.5e-05 2.5e-05
 [6,] 4.3e-05 3.3e-05
 [7,] 3.9e-05 3.0e-05
 [8,] 3.2e-05 4.8e-05
 [9,] 3.0e-05 3.1e-05
[10,] 3.4e-05 3.7e-05

 out2
 [,1][,2]
 [1,] 3.5e-05 2.4e-05
 [2,] 2.4e-05 3.5e-05
 [3,] 4.1e-05 2.6e-05
 [4,] 2.5e-05 3.9e-05
 [5,] 4.1e-05 2.5e-05
 [6,] 4.0e-05 3.1e-05
 [7,] 2.9e-05 2.7e-05
 [8,] 3.1e-05 3.3e-05
 [9,] 3.5e-05 2.5e-05
[10,] 2.7e-05 3.4e-05

The probability of observing any value above 4 or below -4 is pnorm(4,
lower.tail=FALSE) = 3.167124e-05. There does not seem to be anything
suspicious from the run of 10.


3) I think this question might be more appropriate to post this question
to R-devel. Please use an informative subject line. Please read the
posting guide. Thanks.


Regards, Adai



On Mon, 2005-02-21 at 15:45 -0800, Scholz, Fritz wrote:
 I am wondering whether there is a bug in rnorm.
 When generating rnorm(100) and counting 
 the cases  4 and the cases  (-4) I get rather
 unexpectedly low counts for the latter. The problem goes away
 when using qnorm(runif(100)).
 
 Fritz Scholz, PhD
 Applied Statistics Group
 Boeing Phantom Works
 [EMAIL PROTECTED]
 425-865-3623
 Tu/We 206-542-6545 (most likely)
 
 __
 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-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] rodbc or unixodbc error

2005-02-21 Thread Dirk Eddelbuettel

Sebastian,

On 21 February 2005 at 19:18, Sebastian Luque wrote:
| I'm trying to establish a connection to a MySQL database, and am using the
| rodbc package for it. This is in a GNU/Debian Linux box, with the
| corresponding Debian unstable packages. I can login to my MySQL databases
| from any shell and directory, so the problem is probably not there. Here's
| an example of what I'm doing:
| 
| R odbcConnect(test, uid=myusername, pwd=mypassword)
| [1] -1
| Warning messages: 
| 1: [RODBC] ERROR: state IM002, code 0, message [unixODBC][Driver Manager]Data 
source name not found, and no default driver specified 
| 2: ODBC connection failed in: odbcDriverConnect(st, case = case, believeNRows 
= believeNRows)
| 
| 
| The error is apparently from unixodbc, and googling for it I found that
| somebody solved it by specifying a default driver in a odbc.ini file. Can
| somebody please tell whether this is the right approach, and if so, how to
| write that specification? I saw that one might do this in a ~/.odbc.ini
| (i.e. the user's config file) file.

Yes, this is under-documented and thus harder than it should be. I owe my
first working setup many, many years ago to a helpful (private) mail from
Fritz.

So here goes, I just tested it again with PostgresSQL (as I don't currently
keep MySQL running) yet it should carry over. If it fails, let's work on this
off-list.

i)  /etc/odbcinst.ini -- I think these entries may even have been created by
a Debian package but I am not entirely sure.

-
[EMAIL PROTECTED]:~ cat /etc/odbcinst.ini
[PostgreSQL]
Description = PostgreSQL ODBC driver for Linux and Windows
Driver  = /usr/lib/postgresql/lib/psqlodbc.so
Setup   = /usr/lib/odbc/libodbcpsqlS.so
Debug   = 0
CommLog = 1

[MySQL]
Description = MySQL driver
Driver  = /usr/lib/odbc/libmyodbc.so
Setup   = /usr/lib/odbc/libodbcmyS.so
CPTimeout   =
CPReuse =
FileUsage   = 1
-

Make sure you have those files in those places -- and if you only use
MySQL you can probably do without the first set here.

ii) /etc/odbc.ini -- Here is one such entry:

-
[beancounter]
Description = Beancounter DB (Postgresql)
Driver  = Postgresql
Trace   = Yes
TraceFile   = /tmp/beancounter_odbc.log
Database= beancounter
Servername  = localhost
UserName=
Password=
Port= 5432
Protocol= 6.4
ReadOnly= No
RowVersioning   = No
ShowSystemTables= No
ShowOidColumn   = No
FakeOidIndex= No
ConnSettings=
-

The only fields that matter may be Driver, Database, Servername and maybe
Port.  I'm sorry that I don't have a stanza for MySQL in use. An older
one on another computer is 

-
[beancounter_mysql]
Driver   = /usr/lib/libmyodbc.so
Database = beancounter
Servername   = localhost
ReadOnly = 0
-

but I cannot test that one right now.


Hth, Dirk


-- 
Better to have an approximate answer to the right question than a precise 
answer to the wrong question.  --  John Tukey as quoted by John Chambers

__
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] rodbc or unixodbc error

2005-02-21 Thread Dirk Eddelbuettel

PS  iii)  Make sure you connect with dsn, uid and pwd arguments:

 db - odbcConnect(beancounter, uid=edd, pwd=)
 db
RODB Connection 3
Details:
  case=nochange
  DSN=beancounter
  DATABASE=beancounter
  SERVER=basebud
  PORT=5432
  UID=edd
  PWD=
  ReadOnly=No
  Protocol=6.4
  FakeOidIndex=No
  ShowOidColumn=No
  RowVersioning=No
  ShowSystemTables=No
  ConnSettings=
  Fetch=100
  Socket=4096
  UnknownSizes=0
  MaxVarcharSize=254
  MaxLongVarcharSize=8190
  Debug=0
  CommLog=0
  Optimizer=1
  Ksqo=1
  UseDeclareFetch=0
  TextAsLongVarchar=1
  UnknownsAsLongVarchar=0
  BoolsAsChar=1
  Parse=0
  CancelAsFreeStmt=0
  ExtraSysTablePrefixes=dd_
  
  LFConversion=0
  UpdatableCursors=1
  DisallowPremature=0
  TrueIsMinus1=0
  BI=0
  ByteaAsLongVarBinary=0
  UseServerSidePrepare=0

Dirk

-- 
Better to have an approximate answer to the right question than a precise 
answer to the wrong question.  --  John Tukey as quoted by John Chambers

__
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] problems with nonlinear fits using nls

2005-02-21 Thread Gabor Grothendieck
Corey Bradshaw corey.bradshaw at cdu.edu.au writes:
 
: I am attempting to determine the nonlinear least-squares estimates of
: the nonlinear model parameters using nls. I have come across a common
: problem that R users have reported when I attempt to fit a particular
: 3-parameter nonlinear function to my dataset:
: 
: Error in nls(r ~ tlm(a, N.fix, k, theta), data = tlm.data, start =
: list(a = a.st,  : 

Try it with nlm.  I find I often have better luck that with it.

__
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] Categories or clusters for univariate data

2005-02-21 Thread Gabor Grothendieck
Allen Hathaway hathaway at sover.net writes:

: 
: If I have a vector, x, such that
: 
: x - c(1,2,3,4,5,8,9,10,11,12,15,16,17,18,19,22,23,24,33,34,35)
: 
: if I plot that vector
: 
: plot(x)
: 
: it is visibly obvious that the data groups or clusters into distinct 
: groupings.  The data trends along a more-or-less linear path, and then an 
: abrupt jump.  For a trivial case, such as I have given, you can pick out the 
: groups or categories visually, and manually derive the upper and lower 
: bounds for each group.  My question is, is there a function in R that can do 
: the same thing for more complex and subtle groupings in univariate data, and 
: provide a statistical basis for the result?

If the actual data is exactly linear and increasing, as with this example, 
then the breakpoints are at points of positive acceleration, thus

   which(diff(x, diff = 2)0) + 2

gives the indices of the breakpoints.

__
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] Categories or clusters for univariate data

2005-02-21 Thread Mulholland, Tom
x - c(1,2,3,4,5,8,9,10,11,12,15,16,17,18,19,22,23,24,33,34,35)
require(cluster)
pam(x,5)

Medoids:
 [,1]
[1,]3
[2,]   10
[3,]   17
[4,]   23
[5,]   34
Clustering vector:
 [1] 1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 5 5 5
Objective function:
   build swap 
1.285714 1.047619 

Available components:
[1] medoidsclustering objective  isolation  clusinfo   silinfo  
  diss   call   data  

Does this help?


 -Original Message-
 From: Allen Hathaway [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, 22 February 2005 8:48 AM
 To: r-help list
 Subject: [R] Categories or clusters for univariate data
 
 
 If I have a vector, x, such that
 
 x - c(1,2,3,4,5,8,9,10,11,12,15,16,17,18,19,22,23,24,33,34,35)
 
 if I plot that vector
 
 plot(x)
 
 it is visibly obvious that the data groups or clusters 
 into distinct 
 groupings.  The data trends along a more-or-less linear path, 
 and then an 
 abrupt jump.  For a trivial case, such as I have given, you 
 can pick out the 
 groups or categories visually, and manually derive the upper 
 and lower 
 bounds for each group.  My question is, is there a function 
 in R that can do 
 the same thing for more complex and subtle groupings in 
 univariate data, and 
 provide a statistical basis for the result?
 
 Allen
 
 __
 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-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] rodbc or unixodbc error

2005-02-21 Thread Sebastian Luque
Hi Dirk,

That worked beautifully, thanks a lot! I was able to connect to a test
database, save to it (sqlSave), and query it (odbcQuery). Some comments
below for future reference.


Dirk Eddelbuettel [EMAIL PROTECTED] wrote:

[...]

 -
 [EMAIL PROTECTED]:~ cat /etc/odbcinst.ini
 [PostgreSQL]
 Description = PostgreSQL ODBC driver for Linux and Windows
 Driver = /usr/lib/postgresql/lib/psqlodbc.so
 Setup = /usr/lib/odbc/libodbcpsqlS.so
 Debug = 0
 CommLog = 1

 [MySQL]
 Description = MySQL driver
 Driver = /usr/lib/odbc/libmyodbc.so
 Setup = /usr/lib/odbc/libodbcmyS.so
 CPTimeout =
 CPReuse =
 FileUsage = 1
 -

Except for PostgreSQL, this was the default configuration that MySQL or
unixODBC must have entered here during installation.


 ii) /etc/odbc.ini

This file was empty in my system, so adapting your recommendation:

,-[ /etc/odbc.ini (lines: 1 - 7) ]
| [test]
| Driver   = /usr/lib/odbc/libmyodbc.so
| Database = test
| Servername   = localhost
| ReadOnly = 0
| Port = 3306
`-

and followed the same template to include the rest of my databases further
down.

Can the latter go in ~/.odbc.ini as I said before? I hope so, as this
would allow for much easier maintenance.

Thanks again for the helpful reply.

-- 
Sebastian Luque

__
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] rodbc or unixodbc error

2005-02-21 Thread Sebastian Luque
Sebastian Luque [EMAIL PROTECTED] wrote:

[...]

 Can the latter go in ~/.odbc.ini as I said before? I hope so, as this
 would allow for much easier maintenance.

Yes, I just found ODBCConfig, a tool that is supplied with unixodbc for
this sort of manipulations.

Cheers,
-- 
Sebastian Luque

__
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] rodbc or unixodbc error

2005-02-21 Thread Prof Brian Ripley
For future information, this is almost exactly the contents of the README 
file in the RODBC package, which contains further useful hints.

The unixODBC site (www.unixODBC.org/odbcinst.html) has a useful 
tutorial, too.

On Mon, 21 Feb 2005, Sebastian Luque wrote:
Hi Dirk,
That worked beautifully, thanks a lot! I was able to connect to a test
database, save to it (sqlSave), and query it (odbcQuery). Some comments
below for future reference.
Dirk Eddelbuettel [EMAIL PROTECTED] wrote:
[...]
-
[EMAIL PROTECTED]:~ cat /etc/odbcinst.ini
[PostgreSQL]
Description = PostgreSQL ODBC driver for Linux and Windows
Driver = /usr/lib/postgresql/lib/psqlodbc.so
Setup = /usr/lib/odbc/libodbcpsqlS.so
Debug = 0
CommLog = 1
[MySQL]
Description = MySQL driver
Driver = /usr/lib/odbc/libmyodbc.so
Setup = /usr/lib/odbc/libodbcmyS.so
CPTimeout =
CPReuse =
FileUsage = 1
-
Except for PostgreSQL, this was the default configuration that MySQL or
unixODBC must have entered here during installation.

ii) /etc/odbc.ini
This file was empty in my system, so adapting your recommendation:
,-[ /etc/odbc.ini (lines: 1 - 7) ]
| [test]
| Driver   = /usr/lib/odbc/libmyodbc.so
| Database = test
| Servername   = localhost
| ReadOnly = 0
| Port = 3306
`-
and followed the same template to include the rest of my databases further
down.
Can the latter go in ~/.odbc.ini as I said before? I hope so, as this
would allow for much easier maintenance.
Thanks again for the helpful reply.
--
Sebastian Luque
__
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
--
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595
__
R-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