Re: [R] regular expressions : extracting numbers

2007-07-30 Thread Romain Francois
Bonjour David,

What about one of these :

R gsub( [^[:digit:]], , x )

or using perl regular expressions:

R gsub( \\D, , x, perl = T )

Cheers,

Romain

GOUACHE David wrote:
 Hello all,

 I have a vector of character strings, in which I have letters, numbers, and 
 symbols. What I wish to do is obtain a vector of the same length with just 
 the numbers.
 A quick example -

 extract of the original vector :
 lema, rb 2% rb 2% rb 3% rb 4% rb 3% rb 2%,mineuse rb rb rb 
 12 rb rj 30% rb rb rb 25% rb rb rb rj, rb

 and the type of thing I wish to end up with :
 2 2 3 4 3 2   12  30   25

 or, instead of , NA would be acceptable (actually it would almost be better 
 for me)

 Anyways, I've been battling with gsub() and things of the sort, but I'm 
 drowning in the regular expressions, despite a few hours of looking at Perl 
 tutorials...
 So if anyone can help me out, it would be greatly appreciated!!

 In advance, thanks very much.

 David Gouache
 Arvalis - Institut du Végétal
 Station de La Minière
 78280 Guyancourt
 Tel: 01.30.12.96.22 / Port: 06.86.08.94.3


-- 
Mango Solutions
data analysis that delivers

Tel:  +44(0) 1249 467 467
Fax:  +44(0) 1249 467 468
Mob:  +44(0) 7813 526 123

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


Re: [R] R file via SSH

2007-07-13 Thread Romain Francois
Hi,

Again, screen was described in the April issue of R News.
Augmenting R with Unix Tools by Andrew Robinson.

@ARTICLE{Rnews:Robinson:2007,
  AUTHOR = {Andrew Robinson},
  TITLE = {Augmenting {R} with {Unix} Tools},
  JOURNAL = {R News},
  YEAR = 2007,
  VOLUME = 7,
  NUMBER = 1,
  PAGES = {30--33},
  MONTH = {April},
  URL = {http://CRAN.R-project.org/doc/Rnews/},
  PDF = {http://CRAN.R-project.org/doc/Rnews/Rnews_2007-1.pdf}
}

Cheers,

Romain

Martin Becker wrote:
 You may find screen useful, see e.g.

   http://tolstoy.newcastle.edu.au/R/e2/help/07/02/10824.html

 for a short description how to use it with R (reattaching works via 
 screen -r). (Maybe your sysadmin has to install screen first, it's a 
 unix tool.)
 KR

   Martin

 [EMAIL PROTECTED] wrote:
   
 Goodmorning everybody,
 I need to run an R program via SSH. Usually I open R, I run the 
 program and I stay logged-in, waiting for the output. As a matter of 
 fact, if I close the connection with SSH I loose the calculations and 
 the output of my R program. What command I have to use in order to 
 preseve the calculations and the output without staying logged-in a SSH 
 connection?
 thanks in advance

 Marialucia


 
 TISCALI TANDEM FREE
 Telefono e Adsl 4 MB da € 22.95 al mese. Stacchi Telecom!
 GRATIS modem, segreteria e seconda linea telefonica!   
 http://abbonati.tiscali.it/adsl/prodotti/tc/tandemfree_tel/

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

 

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


-- 
Mango Solutions
data analysis that delivers

Tel:  +44(0) 1249 467 467
Fax:  +44(0) 1249 467 468
Mob:  +44(0) 7813 526 123

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


Re: [R] eMail results out of R

2007-07-12 Thread Romain Francois
Hi,

There is a paper in the April 2007 issue of R News that might be of help 
here.
http://##cran mirror##/doc/Rnews/Rnews_2007-1.pdf

Romain

Duncan Murdoch wrote:
 On 7/12/2007 9:52 AM, [EMAIL PROTECTED] wrote:
   
 Hi everyone,

 I did my homework and read the posting guideline :-)

 I want to eMail the results of a computing automatically. So I get the 
 results (the parameters of a garch process) and I want to eMail them to 
 another person. How can I do that?
 


 This will depend on the system you're using.  If the command emailit 
 would work from the command line on your system, then

 system(emailit)

 should work from within R.  Writing that command is the hard part, of 
 course.

 Duncan Murdoch
   
-- 
Mango Solutions
data analysis that delivers

Tel:  +44(0) 1249 467 467
Fax:  +44(0) 1249 467 468
Mob:  +44(0) 7813 526 123

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


Re: [R] compare 2 vectors

2007-06-28 Thread Romain Francois
Christophe Pallier wrote:
 On 6/28/07, João Fadista [EMAIL PROTECTED] wrote:
   
 I would like to take out the values from one vector that are equal to the
 values in another vector.

 Example:
 a - c(1,2,3,4,5,6,7,8,9)
 b - c(3,10,20,5,6)
 b_noRepeats = c(10,20)


 
  b[!(b %in% intersect(a,b))]

 See ?intersect
   
Hi,

There is also a pretty useful operator %w/o% in the help page of %in%. see :

  ?`%in%`
  a - c(1,2,3,4,5,6,7,8,9)
  b - c(3,10,20,5,6)
  b %w/o% a
[1] 10 20

Cheers,

Romain

-- 
Mango Solutions
data analysis that delivers

Tel:  +44(0) 1249 467 467
Fax:  +44(0) 1249 467 468
Mob:  +44(0) 7813 526 123

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


Re: [R] recover history after crash in RGui

2007-06-26 Thread Romain Francois
Sigbert Klinke wrote:
 Hi, is there any possibility to recover the history of executed R code 
 in the RGui when it has crashed?

 Thanks in advance

   Sigbert Klinke
   
Hello,

It might be too much of an overkill, but one possible thing is to use 
?taskCallbackManager to save the history after each high level call. 
Something like:

 h - taskCallbackManager()
 h$add(function(expr, value, ok, visible) {
savehistory()
return(TRUE)
  }, name = historyHandler)

Cheers,

Romain

-- 
Mango Solutions
data analysis that delivers

Tel:  +44(0) 1249 467 467
Fax:  +44(0) 1249 467 468
Mob:  +44(0) 7813 526 123

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


Re: [R] extract elements

2007-06-20 Thread Romain Francois
Manuele Pesenti wrote:
 Dear R users,
 just another little question... are there other ways, I mean more easy to 
 write, to obtain the same result I got with:

 data[95:length(dati[,1]), ]

 where data is a data frame

 to extract the last elements starting from a fixed position?

 thank you very much

 best regards
   Manuele PEsenti
   
Hello,

tail can do it:

R tail( data, -95)

Cheers,

Romain

-- 
Mango Solutions
data analysis that delivers

Tel:  +44(0) 1249 467 467
Fax:  +44(0) 1249 467 468
Mob:  +44(0) 7813 526 123

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


Re: [R] extract elements

2007-06-20 Thread Romain Francois
Romain Francois wrote:
 Manuele Pesenti wrote:
 Dear R users,
 just another little question... are there other ways, I mean more 
 easy to write, to obtain the same result I got with:

 data[95:length(dati[,1]), ]

 where data is a data frame

 to extract the last elements starting from a fixed position?

 thank you very much

 best regards
 Manuele PEsenti
   
 Hello,

 tail can do it:

 R tail( data, -95)

 Cheers,

 Romain

Oops, almost, should be :
R tail( data, -94)

What about a `start` argument in tail ? That'd be a bit more 
user-friendly, ...

Cheers,

Romain



-- 
Mango Solutions
data analysis that delivers

Tel:  +44(0) 1249 467 467
Fax:  +44(0) 1249 467 468
Mob:  +44(0) 7813 526 123

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


Re: [R] plot only x- and y-axis with origin, no box()

2007-06-19 Thread Romain Francois
Hello,

You are looking for the box function, and its bty argument. For example, 
this one will do the trick.

R box( bty = L)

?par gives more information on the potential values for bty.

Cheers,

Romain


Talloen, Willem [PRDBE] wrote:
 hi all,

 I'm trying for quite some time to have an x- and y-axis, but no entire box.

   
 plot(..,axes=F)
 axis(1)
 axis(2)
 
 Gives this, but their axes do not go to the origin.
 Quite a number of people find this gap between the two axes disturbing.
 Has anyone an idea how to let these axes go to the origin?

 thank you in advance
   
-- 
Mango Solutions
data analysis that delivers

Tel:  +44(0) 1249 467 467
Fax:  +44(0) 1249 467 468
Mob:  +44(0) 7813 526 123

R training course for the Pharmaceutical Industry
1st  - 3rd  October. Basel, Switzerland
http://www.mango-solutions.com/services/rtraining/r_pharma.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
and provide commented, minimal, self-contained, reproducible code.


Re: [R] R News, volume 7, issue 1 is now available

2007-04-25 Thread Romain Francois
Earl F. Glynn wrote:
 Torsten Hothorn [EMAIL PROTECTED] wrote in message 
 news:[EMAIL PROTECTED]
   
 The October 2006 issue of R News is now available on CRAN under the
 Documentation/Newsletter link.
 

 Direct links are useful:

 R News
 http://cran.r-project.org/doc/Rnews/

 April 2007 Issue:
 http://cran.r-project.org/doc/Rnews/Rnews_2007-1.pdf

 efg
   
... And maybe the TOC:

Editorial

Viewing Binary Files with the hexView Package
FlexMix: An R Package for Finite Mixture Modelling
Using R to Perform the AMMI Analysis on Agriculture Variety Trials
Inferences for Ratios of Normal Means
Working with Unknown Values
A New Package for Fitting Random Effect Models
Augmenting R with Unix Tools
POT: Modelling Peaks Over a Threshold
Backtests

Review of John Verzani’s Book Using R for Introductory Statistics
DSC 2007
New Journal: Annals of Applied Statistics
Forthcoming Events: useR! 2007
Changes in R 2.5.0
Changes on CRAN
R Foundation News
R News Referees 2006


-- 
Mango Solutions
data analysis that delivers

Tel:  +44(0) 1249 467 467
Fax:  +44(0) 1249 467 468
Mob:  +44(0) 7813 526 123

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


[R] R Graphics training course - Basel - 21.22.23 may 2007

2007-04-05 Thread Romain Francois
Mango Solutions are pleased to announce the above 3 days R course in
Basel as part of our schedule for Q2 2007.

---
 R Graphics   -21th - 23rd May 2007 (Basel)
---


* Who Should Attend ?

This course is suitable for people with a basic working knowledge of
the R language, who want to take advantage of the full graphical
capabilities of R.


* Course Goals

-  Review the basic concepts of the R language
-  Understand the R Graphics Systems
-  Create meaningful graphics
-  Enable attendees to customize graphics


* Course Outline

1.  Refresh the basics of the R language
2.  R functions
3.  Overview of the R graphics systems
4.  Traditional Graphics
5.  Lattice Graphics
6.  Grid Graphics
7.  Beyond R Graphics: interactivity, 3D, ...


* Presenter Information

Romain Francois is a R consultant at Mango Solutions.
He has worked with R for 5 years, and is active in the R community.
Romain is also responsible for the R Graphics Gallery [1] and software
initiatives such as the R Search Sidebar for Firefox [2].


* Registration

Should you want to book a place on this course or have any questions
please contact [EMAIL PROTECTED]

Should your organization have more than 3 possible attendees why not
talk to us about hosting a customized and focused course delivered at
your premises? Details of further courses in alternative locations are
available at http://www.mango-solutions.com/services/training.html






[1] R Graphics Gallery:
   http://addictedtor.free.fr/graphiques/

[2] Search Sidebar extension for Firefox:
   http://addictedtor.free.fr/rsitesearch

-- 
Mango Solutions
data analysis that delivers

Tel:  +44(0) 1249 467 467
Fax:  +44(0) 1249 467 468
Mob:  +44(0) 7813 526 123

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


Re: [R] Wikibooks

2007-03-30 Thread Romain Francois
Alberto Monteiro wrote:
 Philippe Grosjean wrote:
   
 As other have pointed out, the main reason for the lack of success 
 of the R Wiki is that the mailing lists, particularly R-Help, are 
 sooo successful. However, I continue to consider that the mailing 
 list is suboptimal in two cases: (1) when text is not enough to 
 express the idea, and (2) for frequent questions that would 
 certainly deserve a good compilation on a wiki page and a 
 redirection to it everytime the question is asked.

 
 I think there's one case where the mailing list is non-optimal:
 finding examples. This is where a wiki would be great.

 Say I don't know (and I can't understand the help) how to
 use the rnorm function. If I do RSiteSearch(rnorm), I
 will get too much useless information. OTOH, an ideal wikipedia
 would have a page http://www.r-wiki.org/rnorm, where I could
 find examples, learn the theory, browse the source code, and 
 have links to similar functions. OK, maybe that's too much, I
 would be happy just to have some examples :-)
   
Hi,

Do you mean something like (it fullfills basically all your requirements) :

R rnorm # get the code
R ?rnorm   # get the help page

The wiki already has a similar thing, for example for rnorm, you can go to:
http://wiki.r-project.org/rwiki/doku.php?id=rdoc:stats:Normal

There has been (recently and less recently) some discussions on the
r-sig-wiki list about why sometimes you get ~~RDOC~~ instead of the
documentation page, it is still a work in progress.

The only tricky bit is how do I know that I have to go to stats:normal,
well you can ask that to R, for example using that small function :

wikiHelp - function( ... , sarcasm = TRUE ){
if(  length(hp - help(...) )  0 ){
  hp - tail( strsplit(hp[1], /)[[1]], 3 )
  wikiPage -
sprintf(http://wiki.r-project.org/rwiki/doku.php?id=rdoc:%s:%s;,
hp[1],  hp[3])
   cat(the following wiki page will be displayed in your browser:,
 wikiPage,
  Please feel free to add information if you have
some,  , sep = \n)
  if( sarcasm) cat(  except if you are an evil person\n)
   browseURL(wikiPage)
} else print( hp )
  }

R wikiHelp( rnorm )
R wikiHelp( tkWidgets )
R wikiHelp( seq )
R wikiHelp( fewqfrwasaqwetgqwtr) # no such page exists



 Also, RSiteSearching is dangerous, because if someone replies
 in an ignorant or malicous way (let's be creative: someone asks
 how can I open the file CONFIG.SYS, and an evil person replies 
 with file.remove(CONFIG.SYS)), then this wrong answer may
 be accessed by newbies. A wikipedia _may_ have wrong answers,
 but these are (hopefully) ephemeral.
   
Are there many people willing to just blindly copy anything and expect
the good result to be returned ?
I don't think there are many evil person around
 BTW, is it too hard to include the wiki in RSiteSearch?
   

The wiki has its own search engine already, so you can go there and use
it. I guess you can search for search there and get info on how to
search .
If you are using a Gecko based browser (firefox, flock, ...) you might
want to check that extension that would search the wiki pages for you as
well as the results from the R site search:
http://addictedtor.free.fr/rsitesearch/

HTH,

Romain

 Alberto Monteiro
-- 
Mango Solutions
data analysis that delivers

Tel:  +44(0) 1249 467 467
Fax:  +44(0) 1249 467 468
Mob:  +44(0) 7813 526 123

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


Re: [R] abs(U) 0 where U is a vector?

2007-03-14 Thread Romain Francois
Benjamin Dickgiesser wrote:
 Hi,

 I am looking for a way to compare if every element of a vector is  0.

 i.e.
 while(abs(U)  0)
 {

 ..
 }

 is there a function for this or do I have to write one?

 I'd appreciate your help!

 Benjamin
   
Hi,

If I understand you correctly, you are not far, is this what you want :

while(all(abs(U)  0)){
   ...
}


Cheers,

Romain

-- 
Mango Solutions
data analysis that delivers

Tel:  +44(0) 1249 467 467
Fax:  +44(0) 1249 467 468
Mob:  +44(0) 7813 526 123

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


Re: [R] R for copying and pasting selected image files?

2007-03-12 Thread Romain Francois
Kim Milferstedt wrote:
 Hello,

 I would like to use R to process a list of text strings. The text 
 strings are filenames, encoding experimental settings. Based on the 
 information in there I'd like to select certain files and copy only 
 the selected files to another directory.

 The files are images and there is no need, actually no desire, to 
 open them. Is there a way to use R for copying and pasting files with 
 any file extension to another directory without opening them?

 Thanks already for any help,

 Kim

 __

 Kim Milferstedt
 University of Illinois at Urbana-Champaign
 Department of Civil and Environmental Engineering
 4125 Newmark Civil Engineering Laboratory
 205 North Mathews Avenue MC-250
 Urbana, IL 61801
 USA
 phone: (001) 217 333-9663
 fax: (001) 217 333-6968
 email: [EMAIL PROTECTED]
 http://cee.uiuc.edu/research/morgenroth
   
Hi Kim,

Try to have a look at :

R apropos(copy)
R ?file.copy

Cheers,

Romain

-- 
Mango Solutions
data analysis that delivers

Tel:  +44(0) 1249 467 467
Fax:  +44(0) 1249 467 468
Mob:  +44(0) 7813 526 123

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


[R] R Introduction Course - LONDON

2007-02-21 Thread Romain Francois

Mango Solutions are pleased to announce the above course in London as
part of our schedule for Q1 2007.

---
 Introduction to R and R Programming - 26th-28th March 2007
---

* Who Should Attend ?

This is a course suitable for beginners and improvers in the R language
and is ideal for people wanting an all round introduction to R

* Course Goals

- To allow attendees to understand the technology behind the R package
- Improve attendees programming style and confidence
- To enable users to access a wide range of available functionality
- To enable attendees to program in R within their own environment
- To understand how to embed R routines within other applications

* Course Outline

1. Introduction to the R language and the R community
2. The R Environment
3. R data objects
4. Using R functions
5. The apply family of functions
6. Writing R functions
7. Standard Graphics
9. Statistical Analysis

Should your organization have more than 3 possible attendees why not
talk to us about hosting a customized and focused course delivered at
your premises? Details of further courses in alternative locations are
available at http://www.mango-solutions.com/services/training.html

More details about this course :
http://www.mango-solutions.com/services/rtraining/r_intro.html

Should you want to book a place on this course or have any questions
please contact [EMAIL PROTECTED]


Cheers,

Romain Francois

--
Mango Solutions
Tel +44 (0)1249 467 467
Mob +44 (0)7813 526 123
Fax +44 (0)1249 467 468

data analysis that delivers

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


Re: [R] R in Industry

2007-02-07 Thread Romain Francois
Kuhn, Max wrote:
 As someone who has (reluctantly) sent job postings to R Help, I think
 that a SIG would be a good idea.

 Max 
   
Hi all,

My personnal experience also shows that it is difficult to find a job 
where R is a key component, find R related material, or find companies 
that would do commercial support for R or R consulting. (BTW, we [1] do).

A R-sig-job list has been proposed on the past, and I still think it is 
a good idea. An other point is that if it is too hard finding material 
using the regular tools (google, ...), let's just not use them, last 
week a new R-focused search engine [2] was created, let's just make sure 
it searches on the right places. Alternatively, the R wiki [3] can be 
(and is already) use to advertise for jobs [4].

[1] http://www.mango-solutions.com
[2] http://www.rseek.org
[3] http://wiki.r-project.org
[4] http://wiki.r-project.org?id=links:jobs

Cheers,

Romain

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On Behalf Of Doran, Harold
 Sent: Tuesday, February 06, 2007 2:08 PM
 To: R-help@stat.math.ethz.ch
 Subject: [R] R in Industry

 The other day, CNN had a story on working at Google. Out of curiosity, I
 went to the Google employment web site (I'm not looking, but just
 curious). In perusing their job posts for statisticians, preference is
 given to those who use R and python. Other languages, S-Plus and
 something called SAS were listed as lower priorities.

 When I started using Python, I noted they have a portion of the web site
 with job postings. CRAN does not have something similar, but think it
 might be useful. I think R is becoming more widely used in industry and
 I wonder if helping it move along a bit, the maintainer of CRAN could
 create a section of the web site devoted to jobs where R is a
 requirement.

 Hence, we could have our own little monster.com kind of thing going
 on. Of the multitude of ways the gospel can be spread, this is small.
 But, I think every small step forward is good.

 Anyone think this is useful? 

 Harold
   

-- 
Mango Solutions
Tel  +44 1249 467 467
Fax  +44 1249 467 468
Mob  +44 7813 526 123
data analysis that delivers

R Site Search extension for firefox
http://addictedtor.free.fr/rsitesearch

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


[R] R Training Course in Paris

2007-01-08 Thread Romain Francois
Mango Solutions are pleased to announce the above course in Paris as
part of our schedule for Q1 2007.

---
Introduction to R and R Programming - 12th February 2008-14th February
---

(Please find a french version of this announcement from
http://www.mango-solutions.com/services/rtraining/r_paris_training_07_french.html)

* Who Should Attend ?

This is a course suitable for beginners and improvers in the R language
and is ideal for people wanting an all round introduction to R

* Course Goals

- To allow attendees to understand the technology behind the R package
- Improve attendees programming style and confidence
- To enable users to access a wide range of available functionality
- To enable attendees to program in R within their own environment
- To understand how to embed R routines within other applications

* Course Outline

1. Introduction to the R language and the R community
2. The R Environment
3. R data objects
4. Using R functions
5. The apply family of functions
6. Writing R functions
7. Standard Graphics
8. Advanced Graphics
9. R Statistics
10. R Applications


The cost of these courses is €1800 for commercial attendees and €850 for
academic attendees. A €100 discount will be offered to members of the R
Foundation (http://www.r-project.org/foundation/main.html).

Should your organization have more than 3 possible attendees why not
talk to us about hosting a customized and focused course delivered at
your premises? Details of further courses in alternative locations are
available at http://www.mango-solutions.com/services/training.html

More details about this course :
- in french :
http://www.mango-solutions.com/services/rtraining/r_paris_training_07_french.html
- in english :
http://www.mango-solutions.com/services/rtraining/r_paris_training_07.html

Should you want to book a place on this course or have any questions
please contact [EMAIL PROTECTED]


Cordialement,

Romain Francois

--
Mango Solutions
Tel +44 (0)1249 467 467
Mob +44 (0)7813 526 123
Fax +44 (0)1249 467 468

data analysis that delivers

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


Re: [R] R Training Course in Paris

2007-01-08 Thread Romain Francois
Romain Francois wrote:
 Mango Solutions are pleased to announce the above course in Paris as
 part of our schedule for Q1 2007.

 ---
 Introduction to R and R Programming - 12th February 2008-14th February
 ---
   
Small typo, the correct date is : 12th February 2007-14th February.

Cheers,

Romain

 (Please find a french version of this announcement from
 http://www.mango-solutions.com/services/rtraining/r_paris_training_07_french.html)

 * Who Should Attend ?

 This is a course suitable for beginners and improvers in the R language
 and is ideal for people wanting an all round introduction to R

 * Course Goals

 - To allow attendees to understand the technology behind the R package
 - Improve attendees programming style and confidence
 - To enable users to access a wide range of available functionality
 - To enable attendees to program in R within their own environment
 - To understand how to embed R routines within other applications

 * Course Outline

 1. Introduction to the R language and the R community
 2. The R Environment
 3. R data objects
 4. Using R functions
 5. The apply family of functions
 6. Writing R functions
 7. Standard Graphics
 8. Advanced Graphics
 9. R Statistics
 10. R Applications


 The cost of these courses is €1800 for commercial attendees and €850 for
 academic attendees. A €100 discount will be offered to members of the R
 Foundation (http://www.r-project.org/foundation/main.html).

 Should your organization have more than 3 possible attendees why not
 talk to us about hosting a customized and focused course delivered at
 your premises? Details of further courses in alternative locations are
 available at http://www.mango-solutions.com/services/training.html

 More details about this course :
 - in french :
 http://www.mango-solutions.com/services/rtraining/r_paris_training_07_french.html
 - in english :
 http://www.mango-solutions.com/services/rtraining/r_paris_training_07.html

 Should you want to book a place on this course or have any questions
 please contact [EMAIL PROTECTED]


 Cordialement,

 Romain Francois
   
-- 
Mango Solutions
Tel  +44 1249 467 467
Fax  +44 1249 467 468
Mob  +44 7813 526 123
data analysis that delivers

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


[R] JOB: R/S programmers at Mango Solutions (UK)

2006-12-08 Thread Romain Francois
Hello,

Due to the continued growth of Mango Solutions, we are now inviting
applications for the following positions:

* Senior R/S Programmer:
http://www.mango-solutions.com/company/jobuk13.html

* R/S Programmer:
http://www.mango-solutions.com/company/jobuk14.html

To view all available positions at Mango Solutions, visit the Careers page
at http://www.mango-solutions.com/company/careers.html


Kind regards,

Romain.

*mangosolutions*
data analysis that delivers

-- 
Mango Solutions
Tel  +44 1249 467 467
Fax  +44 1249 467 468
Mob  +44 7813 526 123
data analysis that delivers

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


Re: [R] comma delimiter comma in text

2006-11-29 Thread Romain Francois
Alexander Nervedi wrote:
 Hi

 I have data like

 1, A, 24, The Red House
 2, A, 25, King's Home, by the Sea
 ...

 I'd like to read this in as three variables. I first tried

 temp -read.csv(addresses, sep = , ) it worked but line 2 was broken 
 after King's Home, and by the Sea as placed in another line. and so i 
 eneded up with more number of rows than in the data. when i tried
 temp -read.csv(addresses, sep = , , flush = TRUE) i got things 
 right number of rows, but column 3 was truncated till the 3rd comma.

 Is there a way i can specify to R that King's Home, by the Sea is 
 one word?

 u r pal, al
Hi,

If you know that the guilty column will be the last one, you can 
always try to make up your own read function using readLines :

do.call( rbind,
   lapply( strsplit(readLines(data.txt), , ), function(x) {
  gsub(^[[:space:]]|[[:space:]]$, ,# 
just removing leading and trailing spaces
   c( head(x,3), paste(tail(x, -3), collapse=,)))
   } )
)


Cheers,

Romain

-- 
Mango Solutions
Tel  +44 1249 467 467
Fax  +44 1249 467 468
Mob  +44 7813 526 123
data analysis that delivers

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


Re: [R] String question

2006-11-29 Thread Romain Francois
Carmen Meier wrote:
 Hi to all
 I would to determinate whether bits is a binary code and I would to find 
 out the which bit is set to 1

 bits -00110110
 I found to detect whether there are only numbers
 all.digits(bits)
 but is there any function to detect whether there are only 0 and 1 in 
 the string

 And how could I get the f.e the third bit from the right hand side

 With regards Carmen
   
Hi,

R nc - nchar(bits)
R substring(bits,1:nc,1:nc) == 1
R which( substring(bits,1:nc,1:nc) == 1  )


Cheers,

Romain

-- 
Mango Solutions
Tel  +44 1249 467 467
Fax  +44 1249 467 468
Mob  +44 7813 526 123
data analysis that delivers

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


[R] Mango Solutions Announces R Public Training Course in Paris

2006-11-22 Thread Romain Francois
Mango Solutions are pleased to announce the above course in Paris as 
part of our schedule for Q1 2007.

---
Introduction to R and R Programming - 12th February 2008-14th February
---

(Please find a french version of this announcement from 
http://www.mango-solutions.com/services/rtraining/r_paris_training_07_french.html)

* Who Should Attend ?

This is a course suitable for beginners and improvers in the R language 
and is ideal for people wanting an all round introduction to R

* Course Goals

- To allow attendees to understand the technology behind the R package
- Improve attendees programming style and confidence
- To enable users to access a wide range of available functionality
- To enable attendees to program in R within their own environment
- To understand how to embed R routines within other applications

* Course Outline

1. Introduction to the R language and the R community
2. The R Environment
3. R data objects
4. Using R functions
5. The apply family of functions
6. Writing R functions
7. Standard Graphics
8. Advanced Graphics
9. R Statistics
10. R Applications


The cost of these courses is €1800 for commercial attendees and €850 for 
academic attendees. A €100 discount will be offered to members of the R 
Foundation (http://www.r-project.org/foundation/main.html).

Should your organization have more than 3 possible attendees why not 
talk to us about hosting a customized and focused course delivered at 
your premises? Details of further courses in alternative locations are 
available at http://www.mango-solutions.com/services/training.html

More details about this course :
- in french : 
http://www.mango-solutions.com/services/rtraining/r_paris_training_07_french.html
- in english : 
http://www.mango-solutions.com/services/rtraining/r_paris_training_07.html

Should you want to book a place on this course or have any questions 
please contact [EMAIL PROTECTED]


Cordialement,

Romain Francois

--
Mango Solutions
Tel +44 (0)1249 467 467
Mob +44 (0)7813 526 123
Fax +44 (0)1249 467 468

data analysis that delivers

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


Re: [R] advanced plotting

2006-11-09 Thread Romain Francois
downunder wrote:
 !urgent! Hi all. I am facing a problem plotting a indicatormatrix to
 visualize the pattern. Matrix consist from 1's and  0's. 

  for example x - matrix(c(0,0,1,0, 1,1,1,1, 0,0,0,1, 1,0,1,1), nrow = 4,
 ncol=4)
  an i want to have a plot like

   | .
   | . . . .
   |   .
   |  .  . .  
   |___

   I thinking of somethink like a for loop, which creates a data point
 whenever a data point in x[i,j]=1. Anybody  
  can give me a hint or has an idea how to do this thanks in advance for
 every help. Lars
   
   
?image

-- 
*mangosolutions*
/data analysis that delivers/

Tel   +44 1249 467 467
Fax   +44 1249 467 468

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


Re: [R] Creating Movies with R

2006-09-26 Thread Romain Francois
J.R. Lockwood wrote:
 An alternative that I've used a few times is the jpg() function to
 create the sequence of images, and then converting these to an mpeg
 movie using mencoder distributed with mplayer.  This works on both
 windows and linux.  I have a pretty self-contained example file
 written up that I can send to anyone who is interested.  Oddly, the
 most challenging part was creating a sequence of file names that would
 be correctly ordered - for this I use:

 lex - function(N){
   ## produce vector of N lexicograpically ordered strings
   ndig - nchar(N)
   substr(formatC((1:N)/10^ndig,digits=ndig,format=f),3,1000)
 }
   
Hi,

Or you could have asked the `filename` argument of `jpeg` to do the job 
for you, ie :
filename = something%04d as documented in ?jpeg

jpeg(filename = something%04.jpg, onefile = FALSE)
for(i in 1:10){
  plot(i)
}

Cheers,

Romain

PS : For those who have ideas of movies, I once started a website R 
Movies Gallery as a little sister of R Graph(ics) Gallery ... you may 
want to send me code to populate the website, or populate the wiki with 
such examples. The idea is not to produce pretty science fiction type 
movies with R, but use R abilities to create some useful animation that 
could highlight some statistical concepts such as the LCT, ...
Plus, there's a place where grid could show its full power.

 On Fri, 22 Sep 2006, Jeffrey Horner wrote:

   
 Date: Fri, 22 Sep 2006 13:46:52 -0500
 From: Jeffrey Horner [EMAIL PROTECTED]
 To: Lorenzo Isella [EMAIL PROTECTED], r-help@stat.math.ethz.ch
 Subject: Re: [R] Creating Movies with R

 If you run R on Linux, then you can run the ImageMagick command called 
 convert. I place this in an R function to use a sequence of PNG plots as 
 movie frames:

 make.mov.plotcol3d - function(){
  unlink(plotcol3d.mpg)
  system(convert -delay 10 plotcol3d*.png plotcol3d.mpg)
 }

 Examples can be seen here:

 http://biostat.mc.vanderbilt.edu/JrhRgbColorSpace

 Look for the 'Download Movie' links.

 Cheers,

 Jeff

 Lorenzo Isella wrote:
 
 Dear All,

 I'd like to know if it is possible to create animations with R.
 To be specific, I attach a code I am using for my research to plot
 some analytical results in 3D using the lattice package. It is not
 necessary to go through the code.
 Simply, it plots some 3D density profiles at two different times
 selected by the user.
 I wonder if it is possible to use the data generated for different
 times to create something like an .avi file.

 Here is the script:

 rm(list=ls())
 library(lattice)

 # I start defining the analytical functions needed to get the density
 as a function of time

 expect_position - function(t,lam1,lam2,pos_ini,vel_ini)
 {1/(lam1-lam2)*(lam1*exp(lam2*t)-lam2*exp(lam1*t))*pos_ini+
 1/(lam1-lam2)*(exp(lam1*t)-exp(lam2*t))*vel_ini
 }

 sigma_pos-function(t,q,lam1,lam2)
 {
 q/(lam1-lam2)^2*(
 (exp(2*lam1*t)-1)/(2*lam1)-2/(lam1+lam2)*(exp(lam1*t+lam2*t)-1) +
 (exp(2*lam2*t)-1)/(2*lam2) )
 }

 rho_x-function(x,expect_position,sigma_pos)
 {
 1/sqrt(2*pi*sigma_pos)*exp(-1/2*(x-expect_position)^2/sigma_pos)
 }

  Now the physical parameters
 tau-0.1
 beta-1/tau
 St-tau ### since I am in dimensionless units and tau is already in
 units of 1/|alpha|
 D=2e-2
 q-2*beta^2*D
 ### Now the grid in space and time
 time-5  # time extent
 tsteps-501 # time steps
 newtime-seq(0,time,len=tsteps)
  Now the things specific for the dynamics along x
 lam1- -beta/2*(1+sqrt(1+4*St))
 lam2- -beta/2*(1-sqrt(1+4*St))
 xmin- -0.5
 xmax-0.5
 x0-0.1
 vx0-x0
 nx-101 ## grid intervals along x
 newx-seq(xmin,xmax,len=nx) # grid along x

 # M1 - do.call(g, c(list(x = newx), mypar))


 mypar-c(q,lam1,lam2)
 sig_xx-do.call(sigma_pos,c(list(t=newtime),mypar))
 mypar-c(lam1,lam2,x0,vx0)
 exp_x-do.call(expect_position,c(list(t=newtime),mypar))

 #rho_x-function(x,expect_position,sigma_pos)

 #NB: at t=0, the density blows up, since I have a delta as the initial 
 state!
 # At any t0, instead, the result is finite.
 #for this reason I now redefine time by getting rid of the istant t=0
 to work out
 # the density


 rho_x_t-matrix(ncol=nx,nrow=tsteps-1)
 for (i in 2:tsteps)
 {mypar-c(exp_x[i],sig_xx[i])
 myrho_x-do.call(rho_x,c(list(x=newx),mypar))
 rho_x_t[ i-1, ]-myrho_x
 }

 ### Now I also define a scaled density

 rho_x_t_scaled-matrix(ncol=nx,nrow=tsteps-1)
 for (i in 2:tsteps)
 {mypar-c(exp_x[i],sig_xx[i])
 myrho_x-do.call(rho_x,c(list(x=newx),mypar))
 rho_x_t_scaled[ i-1, ]-myrho_x/max(myrho_x)
 }

 ###Now I deal with the dynamics along y

 lam1- -beta/2*(1+sqrt(1-4*St))
 lam2- -beta/2*(1-sqrt(1-4*St))
 ymin- 0
 ymax- 1
 y0-ymax
 vy0- -y0

 mypar-c(q,lam1,lam2)
 sig_yy-do.call(sigma_pos,c(list(t=newtime),mypar))
 mypar-c(lam1,lam2,y0,vy0)
 exp_y-do.call(expect_position,c(list(t=newtime),mypar))


 # now I introduce the function giving the density along y: this has to
 include the BC of zero
 # density at wall

 rho_y-function(y,expect_position,sigma_pos)
 {
 

Re: [R] Comment blocks in R programs

2006-09-20 Thread Romain Francois
Gabor Grothendieck wrote:
 Try this:

 if (FALSE) {
 ... whatever ...
 }
   

Problem is,
... whatever ...
must be syntactically correct to use that trick.

Why not using a text editor that does rectangular selection or 
commenting several lines at a time, there are many out there to propose 
that kind of feature.

Cheers,

Romain


 On 9/20/06, Joe Byers [EMAIL PROTECTED] wrote:
   
 All,

 Is there a way to add comment blocks in an R script other than using #
 at the beginning of each line?  Or, is there anything like ndocs for C++
 and the markup for Java that can generate documentation?

 This may be a bad question, but I have searched R documentation and
 can't seem to find an Answer.  I have also looked at the R package
 documentation mark up docs for help files but that was more than I wanted.


 thank you for you help.
 Joe
 

-- 
*mangosolutions*
/data analysis that delivers/

Tel   +44 1249 467 467
Fax   +44 1249 467 468

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


Re: [R] Histogram of data with categorical varialbe

2006-09-15 Thread Romain Francois
Alexandre Depire wrote:
 Hello,
 I have the following data:
 Km Sex
 250 1
 300 2
 290 2
 600 1
 450 2
 650 1
 .

 I would like to obtain one histogram where the data (or the part) of each
 sex is visible, it is like cumulative histogram or spinogram.
 To be more comprehensible, i would like to know if the following graph is
 obtainable easily in R. It is the first graph on page 5 in the following
 document http://jasp.ism.ac.jp/~nakanoj/workshop04/TalkII.pdf
   
Something like :

d - data.frame( x = rnorm(100), sex = sample(c(1,2), replace=TRUE, 
size=100))
out - hist(d$x, col=gray)
hist(d$x[d$sex==2], col=red, add=T, breaks=out$breaks)
legend(topleft, c(male,female) , fill=c(gray,red))
box()


Cheers,

Romain

-- 
*mangosolutions*
/data analysis that delivers/

Tel   +44 1249 467 467
Fax   +44 1249 467 468

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


Re: [R] functions and strings

2006-09-13 Thread Romain Francois
Robin Hankin wrote:
 Hi

 If

 string - xyz
 f - function(x){1 + sin(cos(x)) + exp(x^2)}

 How do I manipulate string and f() to give the string

 1 + sin(cos(xyz)) + exp(xyz^2)

 ?
   
Hi,

Here what i'll do :

f - function(x){
  sprintf(1 + sin(cos(%s)) + exp(%s^2), x, x)
}

Cheers,

Romai


 --
 Robin Hankin
 Uncertainty Analyst
 National Oceanography Centre, Southampton
 European Way, Southampton SO14 3ZH, UK
   tel  023-8059-7743

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



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


Re: [R] Firefox extension fo R Site Search

2006-08-30 Thread Romain Francois
Robert Mcfadden a écrit :
 May be it's not a bug, but I tried to search for the package rpanel and I
 was not find. At the r-project's site that package is available.
 How to explain it?
 Rob   
   
Hi Rob,

If it's not there : http://finzi.psych.upenn.edu/R/library/
it's not on the extension

Cheers,

Romain

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


Re: [R] Firefox extension fo R Site Search

2006-08-29 Thread Romain Francois
ecatchpole a écrit :
 Romain Francois wrote on 08/28/2006 04:23 PM:
   
 =
 Search for your R routines directly from Firefox!
   http://addictedtor.free.fr/rsitesearch
 =
   
 
 When I try to search I get the Firefox error

 TypeError: document.getElementById(currentPackage + : +
 currentHelpPage) has no properties

 Help!  (Screen shot emailed separately to Romain.)

 Ted
Hi Ted,

Good catch. I'll fix it today.
Did you try to search for something ?

BTW, I'll set up a page in the developers section of the wiki to discuss 
(problems with) this project. To appear soon.

Cheers,

Romain

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


Re: [R] spectral clustering

2006-08-29 Thread Romain Francois
Nair, Murlidharan T a écrit :
 Is there a function in R  that does spectral clustering?  

 Thanks ../Murli
   

 ** PLEASE do read the posting guide 
 http://www.R-project.org/posting-guide.html **
Hi,

You would get a faster answer asking to RSiteSearch rather than this list.

Romain

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


[R] Firefox extension fo R Site Search

2006-08-28 Thread Romain Francois
Dear useRs,

=
Search for your R routines directly from Firefox!
  http://addictedtor.free.fr/rsitesearch
=

Mango Solutions, providers of R and S-Plus consulting, application 
development and training, are happy to announce the first release of the 
R Site Search extension for Mozilla Firefox. This extension enables you 
to search from Jonathan Baron's R Site Search 
(http://search.r-project.org) in a convenient way.

It will enable you to conveniently browse or search the content of the 
packages listed in Jon's server.
Browsing is arranged in a 'package/documentation file' tree. Each hit is 
accompanied with a small icon which highlights the type of found object. 
This is useful as you can quickly find which page is refers to a 
dataset, clustering, time series etc...

Searching builds a new tree transparently on http://search.r-project.org 
and it shows only the relevant pages which may be viewed from the tree 
itself. Additionally the extension handles filters on the package names. 
Some examples are given on the homepage but I'm sure there are already 
regex-friendly people around with more ideas!


Comments, Feedbacks, Contributions, ... are always more than welcome.

Cheers,

Romain
[EMAIL PROTECTED]

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


Re: [R] screen resolution effects on graphics

2006-08-28 Thread Romain Francois
Prof Brian Ripley a écrit :
 On Mon, 28 Aug 2006, Charles Annis, P.E. wrote:

   
 Greetings, R-Citizens:

 I have the good fortune of working with a 19 1280 X 1024 pixel monitor.  My
 

 (Similar to our student lab has used for many years.)

   
 R-code produces nice-looking graphics on this machine but the same code
 results in crowded plots on an older machine with 800 X 600 resolution.  In
 hindsight this seems obvious, but I didn't anticipate it.
 

 It is not obvious to me: I have never experienced it.  What OS and 
 graphics device is this?

 Almost all of R's graphics is independent of the screen resolution (the 
 exception being the bitmapped devices such as jpeg), with things sized in 
 inches or points. My machines are 1600x1200 (apart from 1280x800 on my 
 laptop), so I meet a considerable reduction when using a computer 
 projector, and my plots do not look crowded.

 However, one issue is when the OS has a seriously incorrect setting for 
 the screen resolution and so does not give the sizes asked for by R.  We 
 have seen that on both Linux and Windows, and the windows() device has 
 arguments to set the correct values.  (On X11 you should be able to set 
 this in Xconfig files.)

 If this is Windows, check carefully the description of the initial screen 
 size in ?windows.  That can have unexpected effects on physically small 
 screens.

 At one time the X11() device was set up to assume 75dpi unless the 
 reported resolution was 100+/-0.5dpi.  My then monitor reported 99.2 dpi 
 and so things came out at 3/4 of the intended size.  We fixed that quite a 
 while back.

   
 My code will be used on machines with varying graphics (and memory)
 capacity.  Is there a way I can check the native resolution of the machine
 so that I can make adjustments to my code for the possible limitations of
 the machine running it?
 

 Only via C code, which is how R does it.
Hi,

Javascript knows, can we ask him ?

I mean, if I do that in R :

a - tempfile()
cat('htmlscript type=text/javascript document.write(screen.width) 
;  /script/html', file=a)
browseURL(a)

I get 1920 in my browser's window. Can R read it ?

Romain

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


Re: [R] R Site Search directly from Firefox's address bar

2006-08-18 Thread Romain Francois
Le 17.08.2006 20:56, Adrian Dusa a écrit :
 On Thursday 17 August 2006 21:41, Peter Dalgaard wrote:
   
 [...]
 Breaks the feature that you get to www.r-project.org just by typing
 r, though...
 

It breaks also every usage of the google feeling lucky default behaviour 
which is really useful I think.
There are R related firefox search plugins on mycroft. Find more info on 
that on the wiki :
http://wiki.r-project.org/rwiki/doku.php?id=tips:misc:firefox-search-plugins

You just have to type (*) [Ctrl]+[K] to go to the search textbox (and 
maybe [Alt]+[Up])
instead of [Ctrl]+[L] that leads to the location textbox
and if you do it with the mouse, it's not too far away neither

Cheers,

Romain


(*) the keyboard shortcuts may not be these one on your configuration

 Oh, this is very simple to fix. I created a bookmark named R with the above 
 location and assigned it a keyword r.
 Now, everytime I type r in the address bar it takes me to www.r-project.org
 :)
- 
+---+
| Romain FRANCOIS   |
| R Graph Gallery : http://addictedtor.free.fr/graphiques   |
`---+

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


Re: [R] Making R script to run in a console

2006-08-14 Thread Romain Francois
Le 14.08.2006 19:12, Ronaldo Reis-Jr. a écrit :
 Hi,

 is possible to make a R script to run under a console without open the R 
 environment?

 Something like this example.R

 #!/usr/bin/R

 function(name=Put here your name) {
 print(name)
 }

 In a console I make
 ./example.R name=Ronaldo Reis Júnior
 then program print my name.

 It is possible?

 Thanks
 Ronaldo
   
Hi,

take a look at that wiki page : 
http://wiki.r-project.org/rwiki/doku.php?id=developers:rinterp

Cheers,

Romain

-- 
+---+
| Romain FRANCOIS   |
| R Graph Gallery : http://addictedtor.free.fr/graphiques   |
`---+

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


Re: [R] R-sig-foo searching, was : High breakdown/efficiency statistics -- was RE: Rosner's test

2006-07-07 Thread Romain Francois
Le 23.06.2006 10:42, Martin Maechler a écrit :
 {BTW: Did you know that to *search* mailing list archives of
   such R-SIG-foo mailing lists, you can use google very
   efficiently by prepending the mailing list name and 'site:stat.ethz.ch'?
   e.g., use google search on
   R-SIG-robust site:stat.ethz.ch lmrob
 }
   
Great idea, with a little bonus for the gnome mini-commander lovers (the 
other folks can just ignore this), a new macro :

expression :  |^rs-(.*):(.*)$|
command : gnome-open http://www.google.fr/search?q=R-SIG-\1 \2 
site:stat.ethz.ch

Now you can type
  rs-robust:lmrob
on your gnome mini commander applet

Cheers,

Romain

-- 
visit the R Graph Gallery : http://addictedtor.free.fr/graphiques
mixmod 1.7 is released : http://www-math.univ-fcomte.fr/mixmod/index.php
+---+
| Romain FRANCOIS - http://francoisromain.free.fr   |
| Doctorant INRIA Futurs / EDF  |
+---+

__
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] making matrix monotonous

2006-06-07 Thread Romain Francois
Le 07.06.2006 11:20, [EMAIL PROTECTED] a écrit :
 Spencer Graves a écrit :

   
   I agree it would be great to sort the variables in a correlation 
 matrix to make it easier to read and see patterns.  I don't know any 
 functions for doing that.  If it were my problem, I might order the 
 variables by their first principal component.  There may also be some 
 cluster analysis way to do that, but I don't know it well enough to say.
   Hope this helps.
   Spencer Graves
 

 Thanks for your answer Spencer.

 Here is a first result of a very simple and naive approach.
 http://7d4.com/r/

 Of course, there is no assumption the sorting is optimal,
 but on this little example it helps the matrix being
 more readable.

 Vincent
   
Hello Vincent,

Ahhh, the double for loop, the semicolon, the return call. you still 
believe in R code looking like C don't you.
Try this one :

matrix.sort2 - function(M, fun = function(m) colSums(abs(m)) ){
  M[or - order(fun(M) , decreasing=T), or]
}

Romain

-- 
visit the R Graph Gallery : http://addictedtor.free.fr/graphiques
mixmod 1.7 is released : http://www-math.univ-fcomte.fr/mixmod/index.php
+---+
| Romain FRANCOIS - http://francoisromain.free.fr   |
| Doctorant INRIA Futurs / EDF  |
+---+

__
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] multiple plots with par mfg

2006-05-23 Thread Romain Francois
Hi,

An other possibility might be to use two devices and use dev.set to go 
from one to another :

x11() # the first device (may be windows() or quartz() depending on you OS)
plot(1,1, col=blue) # blue plot
x11() # the second
plot(1.2,1.2, col=red) # red plot
points(1.1,1.1) # appears to bottom left of red point

dev.set(dev.prev()) # switch plots
points(1.1,1.1)

Le 23.05.2006 17:54, Yan Wong a écrit :
 On 23 May 2006, at 15:57, Greg Snow wrote:

   
 The best thing to do is to create the first plot, add everything to  
 the
 first plot that you need to, then go on to the 2nd plot, etc.
 

 Yes, I realise that. The problem is that the data are being simulated  
 on the fly, and I wish to display multiple plots which are updated as  
 the simulation progresses. So I do need to return to each plot on  
 every generation of the simulation.

   
 If you
 really need to go back to the first plot to add things after plotting
 the 2nd plot then here are a couple of ideas:

 Look at the examples for the cnvrt.coords function in the  
 TeachingDemos
 package (my quick test showed they work with layout as well as
 par(mfrow=...)).

 The other option is when you use par(mfg) to go back to a previous  
 plot
 you also need to reset the usr coordinates, for example:
 

 Aha. I didn't realise that the usr coordinates could be stored and  
 reset using par.

   
 Hope this helps,
 

 I think that's exactly what I need. Thank you very much.

 Yan

 __
 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


   


-- 
visit the R Graph Gallery : http://addictedtor.free.fr/graphiques
mixmod 1.7 is released : http://www-math.univ-fcomte.fr/mixmod/index.php
+---+
| Romain FRANCOIS - http://francoisromain.free.fr   |
| Doctorant INRIA Futurs / EDF  |
+---+

__
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] choosing a mirror

2006-05-22 Thread Romain Francois
Le 22.05.2006 19:57, Erin Hodgess a écrit :
 Dear R People:

 Is there a way to select a mirror from the command line
 instead of via a menu, please?

 I tried chooseCRANmirror but to no avail.

 Thanks in advance.

 R version 2.3.0 Windows.
   

See repos in ?options

-- 
visit the R Graph Gallery : http://addictedtor.free.fr/graphiques
mixmod 1.7 is released : http://www-math.univ-fcomte.fr/mixmod/index.php
+---+
| Romain FRANCOIS - http://francoisromain.free.fr   |
| Doctorant INRIA Futurs / EDF  |
+---+

__
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] multiple plots in a function()

2006-05-21 Thread Romain Francois
Le 20.05.2006 17:33, [EMAIL PROTECTED] a écrit :
 Sorry for again asking the same question, but I am still not successfull, 
 also after using grid-package, as recommended previously:

 I want to write a function() which generates a graphical output and can be 
 used in a loop to produce several results with a layout like in 
  
 par(mfrow=c(5,5))
 for ( i in 1:10){
   plot(1:10)
 } 

 Here is the (experimental) code: 


 myfunction - function(){
   vp1 - viewport(x=0.1, y=.7, w=.8, h=.2, just=left, name=vp1)
   vp2 - viewport(x=.1, y=.5, w=.8, h=.2, just=left, name=vp2)
   pushViewport(vp1)
   grid.rect(gp=gpar(col=grey))
   grid.text(vp1)
   grid.xaxis(main=FALSE)
   upViewport()
   pushViewport(vp2)
   grid.rect(gp=gpar(col=grey))
   grid.text(vp2)
   grid.xaxis()
 }


 And the following loop:


 par(mfrow=c(5,5))
 for (i in 1:10) {
grid.newpage()  # when ommitting this line, the following plots will 
 be plotted as childrens of the afore generated parent
myfunction()
 }


 In conclusion, every myfunction() result overwrites the output of the 
 previous output and is not plotted side by side as intended.

 What to change?

   
Hi,

RSiteSearch('layout grid')

leads to ?grid.layout


 Thanks a lot, Dirk

 Dr.med. D. Weismann
 Schwerpunkt Endokrinologie/Diabetologie
 Medizinische Klinik und Poliklinik I
 Universität Würzburg
 Josef-Schneider-Str. 2
 97080 Würzburg
 email: [EMAIL PROTECTED]
 Telefon: 0931/201-1
   

-- 
visit the R Graph Gallery : http://addictedtor.free.fr/graphiques
mixmod 1.7 is released : http://www-math.univ-fcomte.fr/mixmod/index.php
+---+
| Romain FRANCOIS - http://francoisromain.free.fr   |
| Doctorant INRIA Futurs / EDF  |
+---+

__
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] iraq statistics - Realllly OT

2006-05-19 Thread Romain Francois
Le 19.05.2006 13:54, Gabor Grothendieck a écrit :
 I came across this one:

 http://www.nysun.com/article/32787

 which says that the violent death rate in Iraq (which presumably
 includes violent deaths from the war) is lower than the violent
 death rate in major American cities.

 Does anyone have any insights from statistics on how to
 interpret this?
   
Is Mr Bush collecting the data ?

BTW :  How about a Parisian jaunt? N. Too many riots.
Come on ! That's ridiculous !

-- 
visit the R Graph Gallery : http://addictedtor.free.fr/graphiques
mixmod 1.7 is released : http://www-math.univ-fcomte.fr/mixmod/index.php
+---+
| Romain FRANCOIS - http://francoisromain.free.fr   |
| Doctorant INRIA Futurs / EDF  |
+---+

__
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] Memoire defaillante

2006-04-28 Thread Romain Francois
Le 28.04.2006 09:51, anthony BOND a écrit :
 Bonjour,
 je travaille actuellement sur le logiciel R et mets en place des procédures 
 d'analyse de données :
 sur des procédures de classification employant la commande dist(), je 
 rencontre des problèmes de memoire : avec des data.frame d'environ 100 000 
 lignes j'obtiens le message d'erreur suivant :
  
 Error : cannot allocate vector of size 668 481 330 
  
 Ou une autre erreur souvent affichée :
  
 Reached total allocation of 510 Mb : see help(memory.size)
  
 J'ai donc lu les aides sur R, visité les sites concernés : et notamment 
 certaines options configurées pouvant être augmentées : max-mem-size = N  
 aucun changement !
  
 Y a t il quelqun qui peut me dire clairement et concrètement ce qu on peut 
 faire pour remédier à ce problème ??!!! et non pas m'envoyer vers un lien que 
 j'ai déjà du visiter et qui ne pas apporté de réponse 
  
 Merci d'avance !!!
   
Hi,

Clearly you didn't check that page : 
http://www.R-project.org/posting-guide.html which asks you to post in 
english[1] in that list.
You haven't told us you OS neither. That can make a difference in memory 
management.

Your data is pretty big to be handled by dist, your distance matrix 
would be of dimension 100 000 times 100 000.
You might want to use ?clara Clustering Large Applications.

BTW, I think you should check your keyboard. It is stuck to extensive 
ponctuation !!?!!,..!!,???

Romain

[1] If you really cannot write in english, consider that (young) forum: 
http://forums.cirad.fr/logiciel-R/index.php

-- 
visit the R Graph Gallery : http://addictedtor.free.fr/graphiques
mixmod 1.7 is released : http://www-math.univ-fcomte.fr/mixmod/index.php
+---+
| Romain FRANCOIS - http://francoisromain.free.fr   |
| Doctorant INRIA Futurs / EDF  |
+---+

__
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] plot cdf

2006-04-27 Thread Romain Francois
Le 27.04.2006 18:06, Martin Maechler a écrit :
 ronggui == ronggui  [EMAIL PROTECTED]
 on Thu, 27 Apr 2006 19:27:04 +0800 writes:
 

 ronggui I think curve is one option.  for example , I can
 ronggui use curve(pnorm,-5,5) to plot the normal cdf.

 ronggui use ?curve to get the usage.

 Or Luck might mean the *empirical* cdf, and then
 plot(ecdf(..))  
 solves it;  type
 example(ecdf)
 to see a few examples -- maybe after first saying  
par(ask = TRUE)

 Martin Maechler, ETH Zurich
   
About that, i think it would be useful to add an option 'ask' in 
'example', maybe with a default to TRUE in interactive mode

Romain


-- 
visit the R Graph Gallery : http://addictedtor.free.fr/graphiques
mixmod 1.7 is released : http://www-math.univ-fcomte.fr/mixmod/index.php
+---+
| Romain FRANCOIS - http://francoisromain.free.fr   |
| Doctorant INRIA Futurs / EDF  |
+---+

__
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] www.r-project.org

2006-04-26 Thread Romain Francois
Hi,

To sum up :
* yes, the R website is operationnal. There is no reason whatsoever to 
change its content.
* no javascript, no flash, no chartjunk !!
* rework the style, start wih the css file(s)
* stop with those frames, and use css to place some kind of fake frames
* maybe store the name of your CRAN in a cookie

What about
- place somewhere a div called 'Focus on a package' where we could have 
a short presentation of a package, etc ... or for a CRAN task view (to 
do that, php would be great, but we can do I don't know perl scripts to 
generate static html pages)
- a direct link to download R, which will redirect to the appropriate 
CRAN thanks to cookies
- Propose the Table of Contents of the last volume of R news.
- reduce the ratio (size of the head page graphic) / (information 
directly accesible)
- move search, task views, and documentation from cran to www


Romain



 From roger bos :
 After all, the r-help list doesn't even like HTML in email, so it may 
 not like too many fancy stuff on their website either.
html in email is evil. html in a website is normal.


 From Jon Baron :
 The only thing I might change is to replace the frames with some
 sort of CSS-based positioning.  HOWEVER, the new version of
 Internet Explorer may totally destroy the usefulness of CSS, so
 maybe it is better to leave things as they are for now.
What ! IE is not the only browser, and so not the better. Despite is 
dominant position, i don't think all website will abandon doing css  
because microsoft is not able to make its browser understand it.



-- 
visit the R Graph Gallery : http://addictedtor.free.fr/graphiques
mixmod 1.7 is released : http://www-math.univ-fcomte.fr/mixmod/index.php
+---+
| Romain FRANCOIS - http://francoisromain.free.fr   |
| Doctorant INRIA Futurs / EDF  |
+---+

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

2006-04-26 Thread Romain Francois
Hi,

Consider the code :

g - function(){
  print(.x)
 .x - 3
}

f - function(){
  environment(g) - environment()
  .x - 2
  g()
  .x
}

  f()
[1] 2
[1] 2


I would like f() to return 3. How can I do that ? Am I completely out of 
place ?
Doing that, I want to avoid to pass .x as a parameter in f, because in 
real life .x is pretty big and g() is called over and over in a loop.

Thanks

Romain

-- 
visit the R Graph Gallery : http://addictedtor.free.fr/graphiques
mixmod 1.7 is released : http://www-math.univ-fcomte.fr/mixmod/index.php
+---+
| Romain FRANCOIS - http://francoisromain.free.fr   |
| Doctorant INRIA Futurs / EDF  |
+---+

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

2006-04-26 Thread Romain Francois
Le 26.04.2006 11:02, Peter Dalgaard a écrit :
 Romain Francois [EMAIL PROTECTED] writes:

   
 Hi,

 Consider the code :

 g - function(){
   print(.x)
  .x - 3
 }

 f - function(){
   environment(g) - environment()
   .x - 2
   g()
   .x
 }

   f()
 [1] 2
 [1] 2


 I would like f() to return 3. How can I do that ? Am I completely out of 
 place ?
 Doing that, I want to avoid to pass .x as a parameter in f, because in 
 real life .x is pretty big and g() is called over and over in a loop.
 

 If you want to assign into the environment of g, you'll need - ,
 otherwise you  assign to a local variable. 

 Another possibility involves assign(..., parent.frame()) 
   
Oh yes,
sorry for posting. I knew that.

-- 
visit the R Graph Gallery : http://addictedtor.free.fr/graphiques
mixmod 1.7 is released : http://www-math.univ-fcomte.fr/mixmod/index.php
+---+
| Romain FRANCOIS - http://francoisromain.free.fr   |
| Doctorant INRIA Futurs / EDF  |
+---+

__
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] www.r-project.org

2006-04-26 Thread Romain Francois
Le 26.04.2006 12:14, Prof Brian Ripley a écrit :
 The webmasters have not AFAICS replied in this thread, and perhaps you 
 should wait for them.

 In particular, making cran.r-project.org an autodirector to the 
 nearest mirror and replacing frames have I believe already been agreed 
 and just need resources to implement (and first www. and 
 cran.r-project.org are being moved to new hardware at a different 
 physical site).

 Please remember that as always R has very limited human resources and 
 is the web site a high priority within those resources? (I don't judge 
 it so.)

Absolutely. This is so not a priority for the core team.
You are doing a wonderful job improving R, and I do not want in any case 
divert you from that.

But, some people (like me) don't have the same abilities in R 
programming, but can (to some extent) contribute efforts in designing 
web pages.
 
 You will find discussion of frames vs css in the archives.
I'm on my way ...

-- 
visit the R Graph Gallery : http://addictedtor.free.fr/graphiques
mixmod 1.7 is released : http://www-math.univ-fcomte.fr/mixmod/index.php
+---+
| Romain FRANCOIS - http://francoisromain.free.fr   |
| Doctorant INRIA Futurs / EDF  |
+---+

__
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] About regression and plot

2006-04-26 Thread Romain Francois
Le 26.04.2006 15:16, Daniel Yang a écrit :
 Dear R-help,

 This is my first R day.  I want to ask some more beginner's questions.

 Q1. How can I obtain the covariance matrix for parameter estimates of a 
 multiple regression?  I checked ?lm but didn't get the information.

 Q2. How can I see the old graphs in the graph window?

 Q3. Can R plot animated graph?  For example, I want to see the dynamic change 
 of a 2D graph during a time period.

 Thanks in advance!
 Yung-jui Yang
   
Welcome here,

You might want to learn R a few days, read the docs, etc .. and then 
come back with questions.
That's how you will get the most of R.

R2 :
you can't, but you can open more than one graph at a time, with 
?windows, or ?x11 or send a graphic to a file : ?pdf, ?png, ...
Or you reexecute the commands

R3 :
For a live animation :
x - rnorm(100)
for(i in 1:100){
  plot(1:i, x[1:i], xlim=c(0,100), ylim=range(x), type=l)
  Sys.sleep(.1)
}

You may want to save each graphic in a file and then build an animation 
using convert (from ImageMagick) or whatever tools you have.

In R :

png('gr_%04d.png', width=600, height=400)
x - rnorm(100)
for(i in 1:100){
  plot(1:i, x[1:i], xlim=c(0,100), ylim=range(x), type=l)
}
dev.off()

 From a shell :
$ convert *.png out.gif

See also :
http://pinard.progiciels-bpi.ca/plaisirs/animations/index.html
http://dirk.eddelbuettel.com/code/rquantlib-rgl.html

Romain

-- 
visit the R Graph Gallery : http://addictedtor.free.fr/graphiques
mixmod 1.7 is released : http://www-math.univ-fcomte.fr/mixmod/index.php
+---+
| Romain FRANCOIS - http://francoisromain.free.fr   |
| Doctorant INRIA Futurs / EDF  |
+---+

__
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] www.r-project.org

2006-04-25 Thread Romain Francois
Dear R users and developpers,

My question is adressed to both of you, so I choose R-help to post it.

Are there any plans to jazz up the main R website : http://www.r-project.org
The look it have now is the same for a long time and kind of sad 
compared to other statistical package's website. Of course, the 
comparison is not fair, since companies are paying web designers to draw 
lollipop websites ...

My first idea was to organize some kind of web designing contest.
But, I had a small talk with Friedrich Leisch about that, who said that 
I shouldn't expect too many competitors.
So, what about creating a small team, create a home page project and 
then propose it to the core team.
It goes without saying it : The core team has the final word.

What do you think ? Who would like to play ?

Romain

-- 
visit the R Graph Gallery : http://addictedtor.free.fr/graphiques
mixmod 1.7 is released : http://www-math.univ-fcomte.fr/mixmod/index.php
+---+
| Romain FRANCOIS - http://francoisromain.free.fr   |
| Doctorant INRIA Futurs / EDF  |
+---+

__
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] Histogram to compare two datasets

2006-04-21 Thread Romain Francois
Le 21.04.2006 10:48, Johan van Niekerk a écrit :
 Dear All,

 I am trying to create a histogram-like plot for comparing two datasets - 
 For each interval, I want it to draw 2 bars - one for representing the 
 number of values in each dataset for that interval.

 I have looked at the help for the hist() function and also for the 
 histogram() function that is part of the lattice package, and neither 
 seem to support multiple datasets.

 Could someone please point me in the right direction?

 Kind regards,
 Johan van Niekerk
   
Look there :
http://addictedtor.free.fr/graphiques/search.php?q=histogram


-- 
visit the R Graph Gallery : http://addictedtor.free.fr/graphiques
mixmod 1.7 is released : http://www-math.univ-fcomte.fr/mixmod/index.php
+---+
| Romain FRANCOIS - http://francoisromain.free.fr   |
| Doctorant INRIA Futurs / EDF  |
+---+

__
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] creating empty cells with table()

2006-04-19 Thread Romain Francois
Le 19.04.2006 15:21, Owen, Jason a écrit :
 Hello,

 Suppose I simulate 20 observations from the Poisson distribution
 with lambda = 4.  I can summarize these values using table() and
 then feed that to barplot() for a graph.

 Problem: if there are empty categories (e.g. 0) or empty categories
 within the range of the data (e.g. observations for 6, 7, 9), barplot()
 does not include the empty cells in the x-axis of the plot.  Is there
 any way to specify table() to have specific categories (in the above
 example, probably 0:12) so that zeroes are included?

 Thanks,

 Jason
   
Hi,

What about using ?factor with its levels argument :

x - rpois(30, lambda=4)
table(factor(x,levels=0:12))

Romain

-- 
visit the R Graph Gallery : http://addictedtor.free.fr/graphiques
mixmod 1.7 is released : http://www-math.univ-fcomte.fr/mixmod/index.php
+---+
| Romain FRANCOIS - http://francoisromain.free.fr   |
| Doctorant INRIA Futurs / EDF  |
+---+

__
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] hist-data without plot

2006-03-20 Thread Romain Francois
Le 20.03.2006 14:23, Gottfried Gruber a écrit :
 hello,

 i need the data from hist() but i do not want the plot.
 e.g.
 z=hist(data)$counts  #returns absolute  frequency

 but when i execute this command the plot occurs also. is it possible to 
 suppress the plot?

 many thanks,
 best regards gg
   
Hi,

Have you at least read the help page of hist (you are supposed to)
?hist
If you did, do it again and you'll be able to answer your question

Romain

-- 
visit the R Graph Gallery : http://addictedtor.free.fr/graphiques
Discover the R Movies Gallery : http://addictedtor.free.fr/movies
+---+
| Romain FRANCOIS - http://francoisromain.free.fr   |
| Doctorant INRIA Futurs / EDF  |
+---+

__
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] (OT) about the posting guide

2006-03-20 Thread Romain Francois
Hi,

I don't blame anybody (i'm guilty too), but have we forget the section
'Responding to other post' in the posting guide.

The recent thread 'hist-data without plot' is a good example of a very 
simple question, isn't it ?
The poster got responses in 33, 35, 35, 36, 37 and 40 minutes (according 
to my thunderbird)

The probability for that to happen is quite small :
R prod(punif(c(40, 37, 35, 36, 35, 33) / 60, min=0, max=4))
[1] 1.127059e-05

I am on my way to a fresh reading of the posting guide.

Best regards,

Romain
*
*

-- 
visit the R Graph Gallery : http://addictedtor.free.fr/graphiques
Discover the R Movies Gallery : http://addictedtor.free.fr/movies
+---+
| Romain FRANCOIS - http://francoisromain.free.fr   |
| Doctorant INRIA Futurs / EDF  |
+---+

__
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] how to make a contour plot in R?

2006-03-13 Thread Romain Francois
Le 13.03.2006 15:58, Arnau Mir Torres a écrit :
 Hello.

 I am an nxn data frame in the variable frame.
 I want to make a contour plot with it. That is, I want to plot a square 
 of dimensions [1,n]x[1,n] with the  gray level of square [i,i+1]x[j,j+1] 
 equal to frame[i,j].

 How can I make it?

 Thanks,

 Arnau.
   
Hi,

it feels that you want to use ?image with a grey level palette :
R z - matrix(runif(100), nc=10)
R image(z, col=gray(0:10/10))

Also, check ?palette, ?colorRampPalette and the links therein.

HTH

-- 
visit the R Graph Gallery : http://addictedtor.free.fr/graphiques
Discover the R Movies Gallery : http://addictedtor.free.fr/movies
+---+
| Romain FRANCOIS - http://francoisromain.free.fr   |
| Doctorant INRIA Futurs / EDF  |
+---+

__
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] coloring leaves in a hclust or dendrogram plot [solved]

2006-03-11 Thread Romain Francois
Le 11.03.2006 15:56, Gabor Grothendieck a écrit :
 Where does one find A2Rplot that is called in that example?

 A2R does not appear to be on CRAN.  I did find this:

   http://addictedtor.free.fr/Download/A2R.zip

 which is a zip file containing some R code but it is not a package,
 which the line library(A2R) seems to need, and it does not include
 A2Rplot in any case.
   
(...)

Hi Gabor and all,

the package A2R is really highly experimental now and i don't have much 
time to improve it to such an extent that it would be possible to commit 
it to CRAN. For now on, the source of the package is there : 
http://addictedtor.free.fr/packages/A2R/
For people that can't build it, it is possible to source the files from 
here :
http://addictedtor.free.fr/packages/A2R/lastVersion/R/

Plus, i am (slowly) preparing an rgg package, so the content of A2R will 
probably go there

Romain

-- 
visit the R Graph Gallery : http://addictedtor.free.fr/graphiques
Discover the R Movies Gallery : http://addictedtor.free.fr/movies
+---+
| Romain FRANCOIS - http://francoisromain.free.fr   |
| Doctorant INRIA Futurs / EDF  |
+---+

__
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] 'less' for R?

2006-03-08 Thread Romain Francois
Le 08.03.2006 18:03, Federico Calboli a écrit :
 Hi All,

 is there an equivalent of the Unix command 'less' (or 'more'), so I can
 look at what's inside a data.frame or a matrix without having it printed
 out on console?

 I am using R on Debian Linux and Mac OS 10.4.5

 Cheers,

 F
   
Hi,

A cheap way is to use the unix command :
 less - function(a){
write.table(a, quote=F, file=/tmp/dataframe.txt)
system(less /tmp/dataframe.txt)
}
 less(iris)
Romain

-- 
visit the R Graph Gallery : http://addictedtor.free.fr/graphiques
Discover the R Movies Gallery : http://addictedtor.free.fr/movies
+---+
| Romain FRANCOIS - http://francoisromain.free.fr   |
| Doctorant INRIA Futurs / EDF  |
+---+

__
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] Plotting FAQ?

2006-03-03 Thread Romain Francois
Le 03.03.2006 13:13, Dan Bolser a écrit :
 Hi,

 Since I started to make some 'final' plots of my data I found that I 
 have tons of questions related to 'the little things'. Rather than 
 bother the list with all the questions (ahem), or search the archives 
 for similar questions and translate the context, I would like to find a 
 FAQ for plotting in particular (and R programming in general). I know 
 for sure (searching the list) that my questions have been answered many 
 times and in many different contexts, however, I can't find any list of 
 generic (best) solutions to common problems.

 For example, (a bit on the 'details' side, but...)

 How do I make my y axis labels / names appear horizontally?

 How do I put a plot within a plot?

 How do I scale the legend text in barplot(...,legend=T)?

 How do I generate a legend just like barplot(...,legend=T) using legend()?

 How do I give my axis labels a bit more space? (Shift the left/bottom of 
 the plotting area right/up from the left/bottom of the device area)?


 These questions spring to mind because they are problems I am trying to 
 deal with, I am sure you could imagine loads of more basic plotting 
 questions.

 An FAQ is a great place to archive all the best community knowledge 
 about what library is good for what functionality and what 'tips  
 tricks' have the coolest code.

 Where should I look?

 Thanks for any help,
 Dan.
Hi,

That kind of QA could find a space in the R wiki. Volunteers ?
http://www.sciviews.org/_rgui/wiki/doku.php (the address will change though)

Romain

-- 
visit the R Graph Gallery : http://addictedtor.free.fr/graphiques
Discover the R Movies Gallery : http://addictedtor.free.fr/movies
+---+
| Romain FRANCOIS - http://francoisromain.free.fr   |
| Doctorant INRIA Futurs / EDF  |
+---+

__
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] LaTeX in R graph

2006-02-28 Thread Romain Francois
Le 28.02.2006 10:27, [EMAIL PROTECTED] a écrit :
 Hello,
 I would like to know if it is possible to insert LaTeX typesetting in R 
 output.
 I want to obtain a graph with LaTeX label in order to incorporate it as
 postscript or pdf,

 x-seq(0,1,length=100)
 y-x*x
 plot(x,y,xlab=$X$,ylab=$X^2$)
   
Bonjour Alexandre,

There is already a mechanism in R to insert mathematical annotations in 
graphics, see
?plotmath

x-seq(0,1,length=100)
y-x*x
plot(x,y,xlab=expression(X),ylab=expression(X^2))


But this is not really LaTeX.

What about creating you graphic with no labels, and then use the LaTeX 
package eso-pic to put your labels where you like with the command 
\AddToShipoutPicture*
Maybe somebody has done something to wrap it all.

Romain


-- 
visit the R Graph Gallery : http://addictedtor.free.fr/graphiques
Discover the R Movies Gallery : http://addictedtor.free.fr/movies
+---+
| Romain FRANCOIS - http://francoisromain.free.fr   |
| Doctorant INRIA Futurs / EDF  |
+---+

__
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] 2 barplots in the same graph

2006-02-24 Thread Romain Francois
Le 24.02.2006 11:17, jia ding a écrit :
 Thanks All!

 I combine your answers and post the code here again, if later somebody need
 it.

 Actually, what I want is:
   
 x1
 
 [1]  1  2 10
   
 x2
 
 [1] -3  5 -8
   
 barplot(x1,col=white,border=red)
 barplot(x2,col=white,border=green,add=T)
 
 So that, the two plots even share the same x-axis.

 But, It comes another question: 
 barplot(x2,col=white,border=green,add=T), because there are 2 numbers
 are negative, some part of the bar is missing. Is there any automatic
 function to make the axes fit very well for both bars?

   
R barplot(x1,col=white,border=red, ylim=range(c(x1,x2)))
 And, suppose I want to add another command: axis(1, 0:20) to draw x-axis. I
 notice it  increase like: 0,1,2,3,...20; how can I make it 0,5,15,20?

   
before doing axis(1, 0:20) have you tried to do
R 0:20

So,

R axis(1, (0:4)*5)
or
R axis(1, c(0,5, 10, 15, 20))
or
R axis(1, seq(0,20, by=5))

it's up to you. There are probably other solutions as well
 Thanks!

   
You're welcome

Romain

-- 
visit the R Graph Gallery : http://addictedtor.free.fr/graphiques
Discover the R Movies Gallery : http://addictedtor.free.fr/movies
+---+
| Romain FRANCOIS - http://francoisromain.free.fr   |
| Doctorant INRIA Futurs / EDF  |
+---+

__
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] 2 barplots in the same graph

2006-02-24 Thread Romain Francois
Le 24.02.2006 11:58, jia ding a écrit :
 Hi,
 Would you pls try  these?

  x1-c(1,2,10)
  x2-c(-3,5,-8)
  barplot(x1,col=white,border=red,ylim=range(c(x1,x2)))
  barplot(x2,col=white,border=green,ylim=range(c(x1,x2)),add=T)
  axis(1, 0:3)
  box()

ylim is not needed on the second call.


 Q1, on x-axis 1,2,3 is not shown at the middle position of the bars. 
 e.g for first bar, 1 is tend to right ; while third bar, 3 is tend 
 to left.

Use the outputs from barplot :

out - barplot(x1,col=white,border=red,ylim=extendrange(c(x1,x2)))
out
axis(1, out[,1], sprintf('bar %d', 1:3))

 Q2, once box(), then bars are cut again.

You can use extendrange instead of range, ie :

barplot(x1,col=white,border=red,ylim=extendrange(c(x1,x2)))

 Q3, when y-axis is 0, I want to draw a parallel line to  x-axis:
   I tried lines(c(0,5),c(0,0)) ; is there any other way to do it?

abline(h=0)

 Thanks.

 Nina
Also, try :
?barplot
http://addictedtor.free.fr/graphiques/search.php?q=barplot

Romain

-- 
visit the R Graph Gallery : http://addictedtor.free.fr/graphiques
Discover the R Movies Gallery : http://addictedtor.free.fr/movies
+---+
| Romain FRANCOIS - http://francoisromain.free.fr   |
| Doctorant INRIA Futurs / EDF  |
+---+

__
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] How can one use R-code and R-functions within C-Code?

2006-02-22 Thread Romain Francois
Le 22.02.2006 13:25, [EMAIL PROTECTED] a écrit :
 Dear everyone,

 the following problem: Our group has written a lengthy program in c++, to 
 which we would like to add some additional features. Because we are not sure 
 if those features are actually useful, we would prefer to take a quick and 
 dirty approach just to try them out. The additional feature is that in every 
 iteration of the algorithm membership-probabilities should by calculated by a 
 multinomial logit or probit model. We have tried to get C/C++ code for this, 
 but sadly neither me nor my collegue succeded in obtaining C-code for 
 something, which has certainly already be programmed in C several times. 

 But we know, that R functions like multinom exist, which could do the job. 
 This is why we would like to use R-Code and R-functions within or C++ program 
 if this is possible. So I have actually two questions: Is it feasible to use 
 R-code and R-functions like multinom within a c++ program? And if so, what 
 is the best way to implement this (how to get data from C into the R 
 functions, how to execute the R functions within C++, how to transfer the 
 results back to c++)?

 Moritz

 Moritz Marienfeld
   

Hi,

For a quick (and pretty not dirty) approach, try Rserve : 
http://rosuda.org/Rserve/

Romain

-- 
visit the R Graph Gallery : http://addictedtor.free.fr/graphiques
Discover the R Movies Gallery : http://addictedtor.free.fr/movies
+---+
| Romain FRANCOIS - http://francoisromain.free.fr   |
| Doctorant INRIA Futurs / EDF  |
+---+

__
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] Plotting contour filled.contour in one graph

2006-02-12 Thread Romain Francois
Le 13.02.2006 05:12, Abd Rahman Kassim a écrit :
 Dear All,

 I have a question on overlaying a filled.contour (e.g. on soil properties 
 data) and contour (by elevation) in one graph. Both have the same z matrix 
 dimension. I'm able to overlay both graph, but the plots dimension did not 
 overlap well on the same plots. How can I have both filled.contour and 
 contour on the same graph? The commands that I have written are as follows:

 filled.contour(0:15,0:10,t(matrix(Total.C,nrow=11,ncol=16)))
 contour(0:15,0:10,as.matrix(elev),add=T)

 Thanks for anay assistance.

 Regards.


 Abd Rahman Kassim
 Forest Research Institute Malaysia
 Kepong 52109
 Selangor, MALAYSIA
   
Hi,

The trick is to use the argument plot.axes of filled.contour
There are examples of that in ?filled.contour

See also : http://addictedtor.free.fr/graphiques/RGraphGallery.php?graph=128

Romain

-- 
visit the R Graph Gallery : http://addictedtor.free.fr/graphiques
mixmod 1.7 is released : http://www-math.univ-fcomte.fr/mixmod/index.php
+---+
| Romain FRANCOIS - http://francoisromain.free.fr   |
| Doctorant INRIA Futurs / EDF  |
+---+

__
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] Plotting contour filled.contour in one graph

2006-02-12 Thread Romain Francois
Le 12.02.2006 18:20, Spencer Graves a écrit :
 Hi Michael and Gabor:

 (...)

 MICHAEL:  The Addicted to R web site with it's R Graph Gallery are 
 pretty.  Is a companion package downloadable from CRAN
Not yet. That's something i've wanted to do in a long time (since the
beginning I think), but ...
 , or are they 
 still looking for volunteers to create the necessary help files, etc.?
   
Anyone with ideas could volonteer something. Recently, i've done
something so that users can make comments about specified regions of a
graphic. See graph 29 for a first use of that toy, move the mouse on top
of the graphic, you should see it .. . (I hope that works ok with
several browsers, because javascript is involved)

A little sister of the R Graph Gallery could be a movie gallery created
with R. For example :
* illustration of the CLT
* convergence of the EM algorithm (there is an example here :
http://addictedtor.free.fr/misc/smalEM.avi )
* kernel density estimation varying the bandwidth
* etc 

Let me know if you feel like you want to help doing something

Romain

-- 
visit the R Graph Gallery : http://addictedtor.free.fr/graphiques
mixmod 1.7 is released : http://www-math.univ-fcomte.fr/mixmod/index.php
+---+
| Romain FRANCOIS - http://francoisromain.free.fr   |
| Doctorant INRIA Futurs / EDF  |
+---+

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

2006-02-11 Thread Romain Francois
Le 11.02.2006 19:44, [EMAIL PROTECTED] a écrit :
 Hi all,
 I have a basic question. how can i visualize two or more density curves on
 the same plot?

 ex:
 x1-runif(100,10,80)
 x2-runif(100,1,100)
 kernelgraf-density(x1,kernel = gaussian, width= 20)
 plot(kernelgraf, xlab=Probability, xlim=c(0,100), ylim=c(0,.1),
 col=rgb(0,1,0), main=)
 kernelgraf-density(x2,kernel = gaussian, width= 20)
 points(kernelgraf, xlab=Probability, xlim=c(0,100), ylim=c(0,.1),
 col=rgb(0,0,1), main=)

 here i am using plot + points, but i do not like the graphical output for
 points.
   
You are almost there, replace your last command by :

points(kernelgraf, type=l, col=blue)

Romain

PS : Maybe a function points.density setting type=l would be a good 
thing ?
 can anybody help me?

 thanks in advance

 Roberto Furlan
 University of Turin
   

-- 
visit the R Graph Gallery : http://addictedtor.free.fr/graphiques
mixmod 1.7 is released : http://www-math.univ-fcomte.fr/mixmod/index.php
+---+
| Romain FRANCOIS - http://francoisromain.free.fr   |
| Doctorant INRIA Futurs / EDF  |
+---+

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

2006-02-11 Thread Romain Francois
Le 11.02.2006 19:59, Duncan Murdoch a écrit :
 Romain Francois wrote:
 Le 11.02.2006 19:44, [EMAIL PROTECTED] a écrit :

 Hi all,
 I have a basic question. how can i visualize two or more density 
 curves on
 the same plot?

 ex:
 x1-runif(100,10,80)
 x2-runif(100,1,100)
 kernelgraf-density(x1,kernel = gaussian, width= 20)
 plot(kernelgraf, xlab=Probability, xlim=c(0,100), ylim=c(0,.1),
 col=rgb(0,1,0), main=)
 kernelgraf-density(x2,kernel = gaussian, width= 20)
 points(kernelgraf, xlab=Probability, xlim=c(0,100), ylim=c(0,.1),
 col=rgb(0,0,1), main=)

 here i am using plot + points, but i do not like the graphical 
 output for
 points.
  

 You are almost there, replace your last command by :

 points(kernelgraf, type=l, col=blue)

 Romain

 PS : Maybe a function points.density setting type=l would be a good 
 thing ?

 Or maybe use

 lines(kernelgraf, type=l, col=blue)

 As I always say, when you want lines, use lines().

 Duncan Murdoch
You are right Duncan,

I wish there was a coffea() function in R

;-)


-- 
visit the R Graph Gallery : http://addictedtor.free.fr/graphiques
mixmod 1.7 is released : http://www-math.univ-fcomte.fr/mixmod/index.php
+---+
| Romain FRANCOIS - http://francoisromain.free.fr   |
| Doctorant INRIA Futurs / EDF  |
+---+

__
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] echo output to screen

2006-02-09 Thread Romain Francois
Le 09.02.2006 10:09, Chun-Ying Lee a écrit :

On Thu, 09 Feb 2006 10:02:49 +0100, Uwe Ligges wrote
  

Chun-Ying Lee wrote:


Hi all,
 
  I want to echo output to screen before next step, 
like the following when i type library(pkname),


  

library(pkname)


a few description about the package



  



how should I do to get this?
  

?cat



I know the use of cat

but I mean that the description appear automatically
when I type library(pkname)
  

Hi,

Your question was not too clear about that.
See Writing R extensions.
?.First.lib if you don't have a NAMESPACE
?.onLoad if you do

Romain

-- 
visit the R Graph Gallery : http://addictedtor.free.fr/graphiques
mixmod 1.7 is released : http://www-math.univ-fcomte.fr/mixmod/index.php
+---+
| Romain FRANCOIS - http://francoisromain.free.fr   |
| Doctorant INRIA Futurs / EDF  |
+---+

__
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] Tranferring R results to word prosessors

2006-02-09 Thread Romain Francois
Le 09.02.2006 15:41, Tom Backer Johnsen a écrit :

I have just started looking at R, and are getting more and more irritated 
at myself for not having done that before.

However, one of the things I have not found in the documentation is some 
way of preparing output from R for convenient formatting into something 
like MS Word.  An example:  If you use summary(lm()) you get nice 
output.  However, if you try to paste that output into the word processor, 
all the text elements are separated by blanks, and that is not optimal for 
the creation of a table (in the word processing sense).

Is there an option to generate tab-separated output in R ? That would solve 
the problem.

Tom
  

Hi ,

One way could be to output in html format from R (with the R2HTML 
package) and then read back the html from your word processor

Romain

-- 
visit the R Graph Gallery : http://addictedtor.free.fr/graphiques
mixmod 1.7 is released : http://www-math.univ-fcomte.fr/mixmod/index.php
+---+
| Romain FRANCOIS - http://francoisromain.free.fr   |
| Doctorant INRIA Futurs / EDF  |
+---+

__
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] difference between rnorm(1000, 0, 1) and running rnorm(500, 0, 1) twice

2006-02-08 Thread Romain Francois
Le 08.02.2006 04:21, Taka Matzmoto a écrit :

Hi R users

This looks a simple question

Is there any difference between between rnorm(1000,0,1) and running 
rnorm(500,0,1) twice in terms of outcome ?

TM
  

Not here :

R set.seed(1)
R x - rnorm(1000, 0, 1)
R set.seed(1)
R y - rnorm(500, 0, 1)
R z - rnorm(500, 0, 1)
R all(x == c(y,z))
[1] TRUE

Romain

-- 
visit the R Graph Gallery : http://addictedtor.free.fr/graphiques
mixmod 1.7 is released : http://www-math.univ-fcomte.fr/mixmod/index.php
+---+
| Romain FRANCOIS - http://francoisromain.free.fr   |
| Doctorant INRIA Futurs / EDF  |
+---+

__
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] Cluster Analysis

2006-02-05 Thread Romain Francois
Le 05.02.2006 17:50, John Janmaat a écrit :

Hello,

I'm trying some cluster analysis, using the hclust command.  I am looking for 
some help in selecting the 'best' number of clusters.  Some software reports 
pseudo-F and pseudo-T^2 statistics, for each cluster merge.  Is there any way 
to generate such statistics simply in R?

Thanks,

John.

Dr. John Janmaat   Tel: 902-585-1461
Department of EconomicsFax: 902-585-1461
Acadia University, Email: [EMAIL PROTECTED]
Wolfville, Nova Scotia, Canada.Web: ace.acadiau.ca/~jjanmaat/
B4P 1H5
  

Hi,

The package fpc have things like that.

Romain

-- 
visit the R Graph Gallery : http://addictedtor.free.fr/graphiques
mixmod 1.7 is released : http://www-math.univ-fcomte.fr/mixmod/index.php
+---+
| Romain FRANCOIS - http://francoisromain.free.fr   |
| Doctorant INRIA Futurs / EDF  |
+---+

__
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] help with read.table() function

2006-01-29 Thread Romain Francois
Le 29.01.2006 16:26, oliver wee a écrit :

hello, I have just started using R for doing a project
in time series...

unfortunately, I am having trouble using the
read.table function for use in reading my data set.

This is what I'm getting:
I inputted:
data -
read.table(D:/Oliver/Professional/Studies/Time Series
Analysis/spdc2693.data, header = TRUE)

I got:
Error in file(file, r) : unable to open connection
In addition: Warning message:
cannot open file 'D:/Oliver/Professional/Studies/Time
Series Analysis/spdc2693.data', reason 'No such file
or directory'

as I am just a novice programmer, I really would
appreciate help from you guys. Is there a need to
setpath in R, like in java or something like that...

I am using the windows version btw. 

I have also tried to put the file in the work
directory of R, so that I only typed 
data - read.table(spdc2693.data, header = TRUE)
Again, it won't work, with the same error message.

I would appreciate any help. thanks again.
  

Hi, try :

read.table(file.choose(), header=TRUE)

and go to your file.
Also, you can look a ?setwd, ?getwd

Romain

-- 
visit the R Graph Gallery : http://addictedtor.free.fr/graphiques
mixmod 1.7 is released : http://www-math.univ-fcomte.fr/mixmod/index.php
+---+
| Romain FRANCOIS - http://francoisromain.free.fr   |
| Doctorant INRIA Futurs / EDF  |
+---+

__
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] R and Eclipse?

2006-01-24 Thread Romain Francois
Le 24.01.2006 13:16, Peter Dalgaard a écrit :

Christian Schulz [EMAIL PROTECTED] writes:

  

http://www.walware.de/;jsessionid=F31C76BA1E592CDA2C82456CFA37C4FD?mainURL=/rplugin.zip



You mean

http://www.walware.de/goto/statet

However, last I checked that one, it didn't work with Fedora's
Eclipse (Windows only?), and everything was provided as class files,
no source available. So I gave up on it. 
  

Hi,

I'm running it with no problem with Fedora 3 and Eclipse 3.1.
Installation is quite simple with the eclipse update feature

Maybe you use gcj instead of sun java ?

Romain

-- 
visit the R Graph Gallery : http://addictedtor.free.fr/graphiques
mixmod 1.7 is released : http://www-math.univ-fcomte.fr/mixmod/index.php
+---+
| Romain FRANCOIS - http://francoisromain.free.fr   |
| Doctorant INRIA Futurs / EDF  |
+---+

__
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] R Commenting Style

2006-01-19 Thread Romain Francois
Le 19.01.2006 11:19, Paul Roebuck a écrit :

I seem to remember reading somewhere about some style
guide regarding R the number of comment characters (#)
prior to the comment meaning something.

Anyone know to what I'm referring? Where?
  

Hi,

If you edit your R code with eclipse + statET plugin 
(http://www.walware.de/goto/statet)
you can associate task tags to your comments, ie :
# TODO : bla bla
# FIXME : replace that for loop by some vectorized incantation
# BUG :
... you can create new task tags according to your taste ...

so that the comments are managed by a separate window. Pretty useful.

Romain


-- 
visit the R Graph Gallery : http://addictedtor.free.fr/graphiques
mixmod 1.7 is released : http://www-math.univ-fcomte.fr/mixmod/index.php
+---+
| Romain FRANCOIS - http://francoisromain.free.fr   |
| Doctorant INRIA Futurs / EDF  |
+---+

__
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] dendrogram branches with different lty

2005-12-16 Thread Romain Francois
Hi Patrick,

You may want to try out my (highly experimental, so not on CRAN) package 
A2R.
http://addictedtor.free.fr/packages/A2R/A2R_0.0-3.tar.gz
2 dendro's are displayed on RGG, check 
http://addictedtor.free.fr/graphiques/search.php?q=dendrogram

You might also be interrested in Appendix B of Paul Murrel's book :
http://www.stat.auckland.ac.nz/~paul/RGraphics/rgraphics.html

Romain

Le 16.12.2005 17:40, Patrick Kuss a écrit :

Dear r-list,

I am trying to visually seperate the two main clusters of a dendrogram.
The idea is to use:

'edgePar=list(lty=3)' for 'dend1[[1]]' and
'edgePar=list(lty=1)' for 'dend1[[2]]'

I have not found a way to solve this. Any suggestions?

Patrick

hc - hclust(dist(USArrests), ave)
(dend1 - as.dendrogram(hc))
par(mfrow=c(2,2))
plot(dend1)
plot(dend1[[1]],edgePar=list(lty=3))
plot(dend1[[2]],edgePar=list(lty=1))


--
Patrick Kuss
PhD-student
Institute of Botany
University of Basel
Schönbeinstr. 6
CH-4056 Basel
+41 61 267 2976

-- 
visit the R Graph Gallery : http://addictedtor.free.fr/graphiques
mixmod 1.7 is released : http://www-math.univ-fcomte.fr/mixmod/index.php
+---+
| Romain FRANCOIS - http://francoisromain.free.fr   |
| Doctorant INRIA Futurs / EDF  |
+---+

__
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] superimpose density line over hist

2005-12-14 Thread Romain Francois
Le 14.12.2005 11:54, Martin Maechler a écrit :

Romain == Romain Francois [EMAIL PROTECTED]
on Tue, 13 Dec 2005 15:40:59 +0100 writes:



 

Romain A few comments :
Romain - your code should be reproductible, otherwise it is useless. 
 (that 
Romain recommandation is on the posting guide)

Romain - that question is a top ten question on that list, go to the 
 archive 
Romain and you will find answers. (also posting guide)
Romain BTW, it should be a FAQ and what about an example of overlaying in 
 hist 
Romain help page ?

What about the following one --- do also note the comments though!
  

Great !

set.seed(14)
x - rchisq(100, df = 4)

## Comparing data with a model distribution should be done with qqplot()!
qqplot(x, qchisq(ppoints(x), df = 4)); abline(0,1, col = 2, lty = 2)

## if you really insist on using hist() ... :
hist(x, prob = TRUE, ylim = c(0, 0.2))
curve(dchisq(x, df = 4), col = 2, lty = 2, lwd = 2, add = TRUE)

  

I agree with you about qqplot, but a lot of people like that kind of 
hist-density overlay ...

-- 
visit the R Graph Gallery : http://addictedtor.free.fr/graphiques
mixmod 1.7 is released : http://www-math.univ-fcomte.fr/mixmod/index.php
+---+
| Romain FRANCOIS - http://francoisromain.free.fr   |
| Doctorant INRIA Futurs / EDF  |
+---+

__
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] superimpose density line over hist

2005-12-13 Thread Romain Francois
Le 13.12.2005 14:23, Albert Vilella a écrit :

Hi all,

I'm trying to superimpose a rchisq density line over a histogram with
something like:

hist(alnlength)
lines(density(rchisq(length(alnlength), 4)),col=red)

But the rchisq line won't appear anywhere,

Anyone knows what I am missing here?

Thanks in advance,

Albert.
  

Hi Albert,

A few comments :
- your code should be reproductible, otherwise it is useless. (that 
recommandation is on the posting guide)

- that question is a top ten question on that list, go to the archive 
and you will find answers. (also posting guide)
BTW, it should be a FAQ and what about an example of overlaying in hist 
help page ?

- then if you want to superimpose an histogram and a density curve, they 
should be on the same scale, it is not the case since you missed the 
argument freq in your hist call, it should be :

R hist(alnlength, freq=FALSE)

- Why do you simulate points to draw the density line ? Give a shot at :

R curve(dchisq, df=4, col=red)


- That might interrest you :
http://addictedtor.free.fr/graphiques/search.php?q=hist

Romain

-- 
visit the R Graph Gallery : http://addictedtor.free.fr/graphiques
mixmod 1.7 is released : http://www-math.univ-fcomte.fr/mixmod/index.php
+---+
| Romain FRANCOIS - http://francoisromain.free.fr   |
| Doctorant INRIA Futurs / EDF  |
+---+

__
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] How to make a plot?

2005-12-13 Thread Romain Francois
Le 13.12.2005 14:32, Gabor Grothendieck a écrit :

Does anyone have an idea of how to make a chart in R like the
ones here that use a graphic:

http://bigpicture.typepad.com/comments/images/slide1.gif
  

Hi Gabor,

Here's a first draft.

The following code will produce a pdf (i only found transparancy support 
in pdf devices) which will be converted afterwards into a png file using 
(thanks to imageMagick) :

$ convert output.pdf output.png

Everything is there :
http://addictedtor.free.fr/misc/gabor/
Background image : http://addictedtor.free.fr/misc/gabor/cruise.pnm
Code : http://addictedtor.free.fr/misc/gabor/gabor.R
Pdf output : http://addictedtor.free.fr/misc/gabor/output.pdf
Png output : http://addictedtor.free.fr/misc/gabor/output.png

Romain

Code :
#
require(pixmap)
require(grid)

x - read.pnm('cruise.pnm')

pdf('output.pdf', width=6, height=4, version=1.4)

par(mar=c(0,0,0,0))

plot(x) # base graphics

y - c(6, 6.5, 7, 8, 8.5, 8.2, 10, 9.6, 9.7, 9)
# some data like in the picture you gave


# now the grid stuff

pushViewport(viewport(xscale=c(0,10),
  yscale=c(0,10)))

grid.rect(x=0:9,
  y=0,
  width=1,
  height=y,
  default.units=native,
  gp=gpar(fill=white, alpha=0.7, col=gray, lwd=2),
  just=c(left,bottom))

grid.rect(x=0:9,
  y=y,
  width=1,
  height= unit(1, npc) - unit(y, native) ,
  default.units=native ,
  gp=gpar(fill=white, col=white), just=c(left,bottom))

grid.lines(x=c(0,10), y=c(5, 5), default.units=native, gp=gpar(lwd=2, 
col=white, lty=dotted))
 
grid.lines(x=c(0,10), y=c(10, 10), default.units=native, 
gp=gpar(lwd=2, col=gray, lty=dotted))

popViewport()


dev.off()

#


-- 
visit the R Graph Gallery : http://addictedtor.free.fr/graphiques
mixmod 1.7 is released : http://www-math.univ-fcomte.fr/mixmod/index.php
+---+
| Romain FRANCOIS - http://francoisromain.free.fr   |
| Doctorant INRIA Futurs / EDF  |
+---+

__
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] Ploting graphics using X tints from a color

2005-12-13 Thread Romain Francois
Le 13.12.2005 19:34, Sérgio Nunes a écrit :

Hi,

I'm trying to draw a 2D plot using multiple tints of red. The
(simplified) setup is the following: || year | x | y ||

My idea is that each year is plotted with a different tint of red.
Older year (lightest) - Later year (darkest). I've managed to plot
this with different scales of grays simply by doing:

palette(gray(length(years):0/length(years)))

before the plot and for each year the color used is a different tint of gray.

So, is there any way to do this for any color?
Any tip or advice?

With this, I hope to visualize patterns in my dataset more easily.

Thanks in advance for any help.

Best regards,
Sérgio Nunes
  

Hi,

You want to travel in the RGB space.
See http://addictedtor.free.fr/graphiques/RGraphGallery.php?graph=107

plot(0, xlim=c(0,10), ylim=c(0,1))
pal - rgb(1, 0:10/10,0:10/10)
rect(xleft=0:9, xright=1:10, ytop=1, ybottom=0, col=pal)

Romain

-- 
visit the R Graph Gallery : http://addictedtor.free.fr/graphiques
mixmod 1.7 is released : http://www-math.univ-fcomte.fr/mixmod/index.php
+---+
| Romain FRANCOIS - http://francoisromain.free.fr   |
| Doctorant INRIA Futurs / EDF  |
+---+

__
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] Ploting graphics using X tints from a color

2005-12-13 Thread Romain Francois
Le 13.12.2005 21:40, Romain Francois a écrit :

 Le 13.12.2005 19:34, Sérgio Nunes a écrit :

 Hi,

 I'm trying to draw a 2D plot using multiple tints of red. The
 (simplified) setup is the following: || year | x | y ||

 My idea is that each year is plotted with a different tint of red.
 Older year (lightest) - Later year (darkest). I've managed to plot
 this with different scales of grays simply by doing:

 palette(gray(length(years):0/length(years)))

 before the plot and for each year the color used is a different tint 
 of gray.

 So, is there any way to do this for any color?
 Any tip or advice?

 With this, I hope to visualize patterns in my dataset more easily.

 Thanks in advance for any help.

 Best regards,
 Sérgio Nunes
  

 Hi,

 You want to travel in the RGB space.
 See http://addictedtor.free.fr/graphiques/RGraphGallery.php?graph=107

 plot(0, xlim=c(0,10), ylim=c(0,1))
 pal - rgb(1, 0:10/10,0:10/10)
 rect(xleft=0:9, xright=1:10, ytop=1, ybottom=0, col=pal)

 Romain

Ops !

s - seq(0,1, length=10)
pal - rgb(1, s, s)

is better.
Sorry.

And more generally, see ?colorRampPalette.

f - colorRampPalette(c(royalblue, white))
pal - f(10)

Romain

-- 
visit the R Graph Gallery : http://addictedtor.free.fr/graphiques
mixmod 1.7 is released : http://www-math.univ-fcomte.fr/mixmod/index.php
+---+
| Romain FRANCOIS - http://francoisromain.free.fr   |
| Doctorant INRIA Futurs / EDF  |
+---+

__
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] Commented version of the home page graphics code

2005-12-08 Thread Romain Francois
Le 08.12.2005 18:37, Satsangi, Vivek a écrit :

Folks,
   I was drawn to R, like many others, partly for the opportunity
to draw nice, colorful graphs (occasionally ones with meaning, too :-)
). I am still quite a newbie to R.
As such, I have been trying to understand the code for the graphics on
the home page (the ones from the 2004 contest -- the dendrogram, the
cluster plot with different coloured circles, etc.) I was wondering
whether anyone has a commented version of this code that would help me
understand it a little easier.

-- Vivek Satsangi,
Student, Rochester, NY
  

Hi Vivek,

Maybe you should start with simpler graphics

Eric wrote a little how-to about that graph.
It's in french though ...
http://www.stat.ucl.ac.be/cgi-bin/getdata?FMPRO?-db=didacomment.fp5-format=/dida/comment.htm-Lay=Comment-SortField=id-SortOrder=descend-max=1id=24op=eq-find

Moreover, the code is highlight-ed here which may help you.
http://addictedtor.free.fr/graphiques/graphcode.php?graph=2

BTW, the code we get when cliking on the homepage graphic uses the mva 
package which doesn't exists anymore. Maybe somebody could erase that 
line from http://www.r-project.org/misc/acpclust.R

Romain

-- 
visit the R Graph Gallery : http://addictedtor.free.fr/graphiques
mixmod 1.7 is released : http://www-math.univ-fcomte.fr/mixmod/index.php
+---+
| Romain FRANCOIS - http://francoisromain.free.fr   |
| Doctorant INRIA Futurs / EDF  |
+---+

__
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] computing the variance

2005-12-05 Thread Romain Francois
Le 05.12.2005 09:53, Wang Tian Hua a écrit :

hi,
when i was computing the variance of a simple vector, i found unexpect 
result. not sure whether it is a bug.
  var(c(1,2,3))
[1] 1  #which should be 2/3.
  var(c(1,2,3,4,5))
[1] 2.5 #which should be 10/5=2

it seems to me that the program uses (sample size -1) instead of sample 
size at the denominator. how can i rectify this?

regards,
tianhua
  

These results are expected, it is so not a bug.
 From details section in ?var
The denominator n - 1 is used which gives an unbiased estimator of
 the (co)variance for i.i.d. observations. (.)

If you really want biased variance, work around :

biasedVar - function(x, ...){
  n - length(x)
  (n-1) / n * var(x,...)
}

Romain

-- 
visit the R Graph Gallery : http://addictedtor.free.fr/graphiques
mixmod 1.7 is released : http://www-math.univ-fcomte.fr/mixmod/index.php
+---+
| Romain FRANCOIS - http://francoisromain.free.fr   |
| Doctorant INRIA Futurs / EDF  |
+---+

__
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] new article on R at oreillynet.com

2005-11-21 Thread Romain Francois
Le 19.11.2005 16:47, Kevin Farnham a écrit :

An article I wrote that provides a basic introduction to R has
been published on Oreillynet.com. The article is titled
Analyzing Statistics with GNU/R. Here is the link:

http://www.onlamp.com/pub/a/onlamp/2005/11/17/r_for_statistics.html

Please feel free to post comments or interesting basic R scripts
at the end of the article. 

Kevin Farnham
  

Hi Kevin,

I think you forgot to use dev.off() when producing output graphic files.
For example i don't think the last example before the conclusion works.

Regards,

Romain


-- 
visit the R Graph Gallery : http://addictedtor.free.fr/graphiques
+---+
| Romain FRANCOIS - http://francoisromain.free.fr   |
| Doctorant INRIA Futurs / EDF  |
+---+

__
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] new article on R at oreillynet.com

2005-11-21 Thread Romain Francois
Le 21.11.2005 09:12, Romain Francois a écrit :

Le 19.11.2005 16:47, Kevin Farnham a écrit :

  

An article I wrote that provides a basic introduction to R has
been published on Oreillynet.com. The article is titled
Analyzing Statistics with GNU/R. Here is the link:

http://www.onlamp.com/pub/a/onlamp/2005/11/17/r_for_statistics.html

Please feel free to post comments or interesting basic R scripts
at the end of the article. 

Kevin Farnham
 



Hi Kevin,

I think you forgot to use dev.off() when producing output graphic files.
For example i don't think the last example before the conclusion works.

Regards,

Romain

  

Hi again,

I shouldn't post anything before the third coffea.
That do work (maybe q() close the device) but I would still advise to 
call dev.off().

Romain

-- 
visit the R Graph Gallery : http://addictedtor.free.fr/graphiques
+---+
| Romain FRANCOIS - http://francoisromain.free.fr   |
| Doctorant INRIA Futurs / EDF  |
+---+

__
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] paste argument of a function as a file name

2005-11-10 Thread Romain Francois
Le 10.11.2005 14:28, Luis Ridao Cruz a écrit :

R-help,

I have a function which is exporting the output to a file via
write.table(df, file =  file name.xls )

What I want is to paste the file name (above) by taking the argument to
the function as a file name 

something like this:

MY.function- function(df)
{
...
...
write.table(df,argument.xls)
}
MY.function(argument)


Thank you
  

Hi,

Maybe sprintf or paste.

MY.function- function(df, arg=argument)
{
...
...
write.table(df,paste(arg,.xls,sep=))
# or : 
# write.table(df,sprintf(%s.xls,arg))
}
MY.function(argument)



-- 
visit the R Graph Gallery : http://addictedtor.free.fr/graphiques
+---+
| Romain FRANCOIS - http://francoisromain.free.fr   |
| Doctorant INRIA Futurs / EDF  |
+---+

__
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] x/y coordinates of dendrogram branches

2005-11-02 Thread Romain Francois
Hi Timo,

Here is a quick and dirty recursive function.
##
absi - function(hc, level=length(hc$height), init=TRUE){
  if(init){
.count - 0
.topAbsis - NULL
.heights - NULL
  }
  if(level0) {
.count - .count + 1
return(.count)
  }
  node - hc$merge[level,]
  le - absi(hc, node[1], init=FALSE)
  ri - absi(hc, node[2], init=FALSE)
 
  mid - (le+ri)/2
 
  .topAbsis -  c(.topAbsis, mid)
  .heights - c(.heights, hc$height[level])
 
  invisible(mid)
}
#

R mydata - c(1,2,3,4,5)
R hc - hclust(dist(mydata), method=average)
R absi(hc)
R .topAbsis # those are x-coordinates
[1] 1.500 4.500 3.750 2.625
R .heights  # and y-coordinates
[1] 1.0 1.0 1.5 2.5
R plot(hc)
R points(.topAbsis, .heights, pch=21, bg=2, cex=5)


Is this close to what tou need ?


Romain




Le 02.11.2005 14:51, Timo Becker a écrit :

Dear R-users,

I need some help concerning the plotting of dendrograms for hierarchical 
agglomerative clustering.
The agglomeration niveau of each step should be displayed at the 
branches of the dendrogram.
For this I need the x/y coordinates of the branch-agglomerations of the 
dendrogram.
The y-values are known (the heights of the agglomeration), but how can I 
get the x-values?

  mydata - c(1,2,3,4,5)
  hc - hclust(dist(mydata), method=average)
  hc$height # these are the y-coordinates
[1] 1.0 1.0 1.5 2.5

I experimented with the dendrogram object because it gives the midpoints:

  dend - as.dendrogram(hc)
  attributes(dend[[1]])$midpoint
[1] 0.5

Perhaps I could loop over all possible branches and get the midpoints if 
I knew how to convert them to x-values.
The manual says that midpoint is the numeric horizontal distance of the 
node from the left border (the leftmost leaf) of the
branch (unit 1 between all leaves).
But how do I know which one is the leftmost leaf and what is its 
horizontal value?

Thanks in advance,
Timo

__
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


  



-- 
visit the R Graph Gallery : http://addictedtor.free.fr/graphiques
+---+
| Romain FRANCOIS - http://francoisromain.free.fr   |
| Doctorant INRIA Futurs / EDF  |
+---+

__
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] significant test

2005-10-31 Thread Romain Francois
Le 31.10.2005 13:45, Prof Brian Ripley a écrit :

 On Mon, 31 Oct 2005, Romain Francois wrote:

 Le 31.10.2005 11:22, Robert a écrit :

 I have two groups of data and want to test how the
 mean of one group is significant different from the
 mean of the other group of data.
 which R function can be used?
 Thanks.

 t.test if you assume normality
 wilcox.test otherwise

 Sorry, no.  

*I* should be sorry.
Thanks for the correction.

 The Wilcoxon test does NOT test a difference in means: its null 
 hypothesis is that the two samples came from the same continuous 
 distribution, a much narrower assumption.  (It is sensitive to 
 differences in variances, for example, and is probably closer to 
 testing a difference in medians than means where the shapes of the two 
 samples differ)

 The Welch two-sample t-test does test exactly the null hypothesis 
 stated under normality, and it is pretty insensitive to quite large 
 departures from normality.  It is unlikely (but possible) that means 
 are of primary interest in very-non-normal distributions.



-- 
visit the R Graph Gallery : http://addictedtor.free.fr/graphiques
+---+
| Romain FRANCOIS - http://francoisromain.free.fr   |
| Doctorant INRIA Futurs / EDF  |
+---+

__
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] 3d bar plot

2005-10-28 Thread Romain Francois
Le 28.10.2005 10:07, Jan Wiener a écrit :

Hi,

does anyone has a bar plot function that produces something
like this (I hope attachments work) ?

If not, I simply want to produce 3d bar plots.

Thanks in advance,
Jan
  

Hi,

I didn't get the attachment. Maybe you didn't follow the posting guide 
which tells what attachments are ok.

scatterplot3d can generate somthing close to a 3D barplot.
see :
 http://www.jstatsoft.org/v08/i11/JSSs3d.pdf   page 11
 http://addictedtor.free.fr/graphiques/RGraphGallery.php?graph=116

Romain

-- 
visit the R Graph Gallery : http://addictedtor.free.fr/graphiques
+---+
| Romain FRANCOIS - http://francoisromain.free.fr   |
| Doctorant INRIA Futurs / EDF  |
+---+

__
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] adding sequence for each value in a vector

2005-10-27 Thread Romain Francois
Le 27.10.2005 17:04, Yves Magliulo a écrit :

hi, 

i have a vector like :

x-c(1,15,30,45,60,90,115)

i know that step by step i have always more than 10  

min(diff(x)) =11

i want to add for each value a sequence of value:value+9  
result should be :

1 2 3 4 5 6 7 8 9 10 15 16 17 18 19 20 21 22 23 24 30 31 (...) 39 45 46
(...) 54 60 61 etc..

how can i do this without a loop (i'm sure there is a elegant way like
always with R but i can't find it this time!)

best, 

yves
  

Also :

R rep(x, each=10) + 0:9

-- 
visit the R Graph Gallery : http://addictedtor.free.fr/graphiques
+---+
| Romain FRANCOIS - http://francoisromain.free.fr   |
| Doctorant INRIA Futurs / EDF  |
+---+

__
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] Storing graphics output in PNG format.

2005-10-26 Thread Romain Francois
Le 26.10.2005 14:40, A Ezhil a écrit :

Dear All,

How can I store hist() or any plot output graphics in
PNG format? I tried with bitmap() but not getting the
result. Appreciate your help on fixing this.

Thanks in Advance.

Regrads,
Ezhil
  

Hi,

You should try png then.
?png
BTW, There is a link to png on the bitmap help page, so you were close 
to the target.

Romain

-- 
visit the R Graph Gallery : http://addictedtor.free.fr/graphiques
+---+
| Romain FRANCOIS - http://francoisromain.free.fr   |
| Doctorant INRIA Futurs / EDF  |
+---+

__
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] horizontal violin plots?

2005-10-26 Thread Romain Francois
Le 26.10.2005 14:52, Karin Lagesen a écrit :

I am trying to make horizontal violin plots. I have tried both vioplot
and simple.violinplot, but both of them seem to not be willing to take
the horizontal option. Is this correct, or am I just bungling it
somehow?

For instance, for vioplot (from the example shown, with the horizontal
modification):


  

vioplot(bimodal,uniform,normal, horizontal=TRUE)


Error in median(data) : need numeric data
  


Karin
  

Hello Karin,

the vioplot package only contains one function : vioplot of about only 
150 lines.
It won't be hard to look at that code and add an argument horizontal 
yourself. You just have to replace x by y and vice versa in all the 
lines, rect, ... calls. Maybe you can contribute it afterwards.

Romain

-- 
visit the R Graph Gallery : http://addictedtor.free.fr/graphiques
+---+
| Romain FRANCOIS - http://francoisromain.free.fr   |
| Doctorant INRIA Futurs / EDF  |
+---+

__
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] hclust leaf color

2005-10-26 Thread Romain Francois
Le 26.10.2005 15:17, william ritchie a écrit :

Hello everyone,

I wanted to know if it was possible to change the color of certain leaves in a
hclust object in order to make my graph more readable. I know I can color
certain groups but I would like to enter a vector telling the plot function
which leaves to color in which color.

Thanks in advance,

William.
  

Hi William,

check these on RGG :
http://addictedtor.free.fr/graphiques/RGraphGallery.php?graph=79
http://addictedtor.free.fr/graphiques/RGraphGallery.php?graph=98

Romain

-- 
visit the R Graph Gallery : http://addictedtor.free.fr/graphiques
+---+
| Romain FRANCOIS - http://francoisromain.free.fr   |
| Doctorant INRIA Futurs / EDF  |
+---+

__
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] Can anyone please tell me how to strip the white spaces from a character vector?

2005-10-25 Thread Romain Francois
Le 25.10.2005 14:51, roger bos a écrit :

for example:
  

a$tic[1:10]


[1] AIR  ABCB  ABXA  ACMR  ADCT  ADEX 
[7] ABM  AFCE  AG  ATG 
 Can anyone please tell me how to strip the white spaces from a$tic?
 Thanks,
 Roger
  

gsub(' ','',a$tic)

-- 
visit the R Graph Gallery : http://addictedtor.free.fr/graphiques
+---+
| Romain FRANCOIS - http://francoisromain.free.fr   |
| Doctorant INRIA Futurs / EDF  |
+---+

__
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] Basic: setting resolution and size of an R graphic

2005-10-25 Thread Romain Francois
Le 25.10.2005 14:59, Marc Schwartz a écrit :

If you specifically need the plot to have a dimension measured in
pixels, then you need to use a bitmapped format such as png and specify
the output to be the size you require:

  png(test.png, width = 300, height = 300, ...)
  DoYourPlotHere()
  dev.off()

Do this directly using the png() device, rather than trying to convert
the image format, which almost always introduces noise.

Since you are using a bitmapped format, you will experience the tradeoff
with respect to the image quality (ie. pixelated) as compared to a
vector based format such as PDF or PS.

I would re-verify the requirements for the journal to which you are
submitting the article relative to what they need for image specs. It
seems unusual for a journal to request an image in this fashion, unless
it is a photograph where a jpg format may be preferred or perhaps for
online publication on a web page.

HTH,

Marc Schwartz
  

Hi folks,

I just would like to highlight the argument 'pointsize' of the png 
function.
For graphics in RGG i use pointsize=4 and i'm happy with it.

Romain

On Tue, 2005-10-25 at 08:57 +0200, Dr. med. Peter Robinson wrote:
  

Thanks Marc and Jim for the tips. The PDF file that I create with R looks
about the same as the one you created. However, I need to get the graphic
to be a certain size (300 pixels wide). I have been using the ImageMagick
program to do so for other graphics:

convert test.pdf -resize 300x300 out.pdf

then out.pdf looks rather poor (pixelly). The original image is too big.
ANy ideas?
Thanks a lot,Peter


Am Mo, 24.10.2005, 22:53, schrieb Marc Schwartz (via MN):


On Mon, 2005-10-24 at 22:32 +0200, Dr. med. Peter Robinson wrote:

  

Dear List,


I am sorry if this perhaps a too basic question, but I have not found
an answer in Google or in the R help system. I am trying to use R to do
a very simple analysis of some data (RT-PCR and Western analysis) with a
 T-test and
to plot the results as a histogram with error bars. (I have pasted an
example script at the bottom of this mail). In order to use this for
publication, I would like to adjust the resolution and size of the final
image. However, even using file types such as postscript or pdf that are
vector based, I get rather bad-looking results with


pdf(file=test.pdf) source(script at bottom of mail) dev.off()
  

using either pdf or postscript or jpg devices.


Therefore I would like to ask the list, how to best produce a graphic
from the script below that would fit into one column of a published
article and have a high resolution (as eps, or failing that tiff or
png)? Thanks in advance for any advice,


Peter



Snip of code


What OS are you on?


Running your example on FC4, I get the attached output for a pdf().


I suspect that on your OS, the height and width arguments are not
appropriate by default.

Thus, you may need to adjust your pdf (or postscript) function call to
explicitly specify larger height and width arguments.

Also note that to generate an EPS file, pay attention to the details
section of ?postscript, taking note of the 'onefile', 'horizontal' and
'paper' arguments and settings.


Also, check with your journal to see if they specify dimensions for such
graphics so that you can abide by their specs if provided. If they are
using LaTeX, there are means of specifying and/or adjusting the height
and/or width specs in the code based upon proportions of various measures
(ie. \includegraphics[width=0.9\textwidth]{GraphicsFile.eps} ).


HTH,


Marc Schwartz
  



-- 
visit the R Graph Gallery : http://addictedtor.free.fr/graphiques
+---+
| Romain FRANCOIS - http://francoisromain.free.fr   |
| Doctorant INRIA Futurs / EDF  |
+---+

__
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] forrest plot

2005-10-19 Thread Romain Francois
Le 19.10.2005 13:56, Thomas Schönhoff a écrit :

Hello,

2005/10/19, Michela Ballardini [EMAIL PROTECTED]:
  

Hi,

can you tel me how can I make a Forrest Plot with R?
It is possible and easy or are there a more practical free software available?



Maybe this will help you to find an answer:

http://finzi.psych.upenn.edu/R/library/rmeta/html/metaplot.html


regards
Thomas
  

Hello Thomas,

Pretty interresting. You just pointed to a good candidate for r graph 
gallery.
A 3D plot of that kind can be done with the scatterplot3d package.

See Figure 5 page 14 of :
Ligges, U., and Maechler, M. (2003): Scatterplot3d – an R Package for 
Visualizing Multivariate Data. /Journal of Statistical Software/ 8(11), 
1–20. http://www.jstatsoft.org/

Romain

-- 
visit the R Graph Gallery : http://addictedtor.free.fr/graphiques
 ~ 
~~  Romain FRANCOIS - http://addictedtor.free.fr ~~
Etudiant  ISUP - CS3 - Industrie et Services   
~~http://www.isup.cicrp.jussieu.fr/  ~~
   Stagiaire INRIA Futurs - Equipe SELECT  
~~   http://www.inria.fr/recherche/equipes/select.fr.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] forrest plot

2005-10-19 Thread Romain Francois
Le 19.10.2005 15:11, Romain Francois a écrit :

Le 19.10.2005 13:56, Thomas Schönhoff a écrit :

Hello,

2005/10/19, Michela Ballardini [EMAIL PROTECTED]:

i,

can you tel me how can I make a Forrest Plot with R?
It is possible and easy or are there a more practical free software 
available?
  

Maybe this will help you to find an answer:

http://finzi.psych.upenn.edu/R/library/rmeta/html/metaplot.html


regards
Thomas
 



Hello Thomas,

Pretty interresting. You just pointed to a good candidate for r graph 
gallery.
(..)
  

Included. I just added :
R par(lend=square)
so it is nicer. Maybe a change to make in the function code ?

Romain

-- 
visit the R Graph Gallery : http://addictedtor.free.fr/graphiques
 ~ 
~~  Romain FRANCOIS - http://addictedtor.free.fr ~~
Etudiant  ISUP - CS3 - Industrie et Services   
~~http://www.isup.cicrp.jussieu.fr/  ~~
   Stagiaire INRIA Futurs - Equipe SELECT  
~~   http://www.inria.fr/recherche/equipes/select.fr.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] matching two plots

2005-10-19 Thread Romain Francois
Le 19.10.2005 19:27, Rui Cardoso a écrit :

Hi,

I have a problem about graphics. I would like to plot two graphs: a barplot 
and curve. Here is the code:

  barplot(dpois(0:45,20),xlim=c(0,45),names=0:45)
  curve(dnorm(x,20,sqrt(20)),from=0,to=45,add=T)

Both graphs are drawn in the same figure, however the scale in both graphs 
dooes not match. For some reason the second plot is shifted to left. I 
think there is a problem concerning the axis scale.

Thanks a lot.

Rui
  

Hello,

The problem is barplot. To see that :

R (barplot(dpois(0:45,20),xlim=c(0,45),names=0:45))
R axis(3)

Try something like :

R plot(0:45, dpois(0:45,20), type=h, lwd=4, col=gray)
R curve(dnorm(x,20,sqrt(20)),from=0,to=45,add=T)

Romain

-- 
visit the R Graph Gallery : http://addictedtor.free.fr/graphiques
 ~ 
~~  Romain FRANCOIS - http://francoisromain.free.fr  ~~
   Doctorant INRIA Futurs / EDF
 ~ 

__
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] The R Graph Gallery {was boxplot statistics}

2005-10-07 Thread Romain Francois
Le 07.10.2005 09:21, Martin Maechler a écrit :

Romain == Romain Francois [EMAIL PROTECTED]
on Thu, 06 Oct 2005 23:23:12 +0200 writes:



Romain Selon bogdan romocea [EMAIL PROTECTED]:
 A related comment - don't rely (too much) on boxplots. They show only
 a few things, which may be limiting in many cases and completely
 misleading in others. Here are a couple of suggestions for plots which
 you may find more useful than the standard box plots:
 - figure 3.27 from
 http://www.stat.auckland.ac.nz/~paul/RGraphics/chapter3.html
 - violin plots (see package vioplot) - density plots - histograms
 - box-percentile plots (bpplot from Hmisc)
 - quantile plots
 - if comparing 2 distributions, qq plots, quantile-difference plots,
 mean-difference plots etc.

Romain Hi,

Romain HDR (highest density regions) boxplots are interresting.
Romain See 
 http://addictedtor.free.fr/graphiques/RGraphGallery.php?graph=102
Let me take the opportunity to thank Romain
for setting up and maintaining the R Graph Gallery.

This is really a cool website for R users. 
He'd get my number one vote for R website of the year!

Martin Maechler, ETH Zurich
  

Wouaw,

Thank you really very much Martin. It's a great honour.

Let me thank you back and all the useRs and developeRs for making such 
an amazing software. I never knew statistics without R. It certainly was 
a sad world. Also I would like to thank Eric Lecoutre who did a lot for 
the design of the gallery in the first place.

Romain

-- 
visit the R Graph Gallery : http://addictedtor.free.fr/graphiques
 ~ 
~~  Romain FRANCOIS - http://addictedtor.free.fr ~~
Etudiant  ISUP - CS3 - Industrie et Services   
~~http://www.isup.cicrp.jussieu.fr/  ~~
   Stagiaire INRIA Futurs - Equipe SELECT  
~~   http://www.inria.fr/recherche/equipes/select.fr.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] Animation of Mandelbrot Set

2005-10-04 Thread Romain Francois
Nice !!

Le 04.10.2005 21:04, Tuszynski, Jaroslaw W. a écrit :

Hi,

I was playing with Mandelbrot sets and come up with the following code, I
thought I would share: 

library(fields)  # for tim.colors
library(caTools) # for write.gif
m = 400  # grid size
C = complex( real=rep(seq(-1.8,0.6, length.out=m), each=m ), 
 imag=rep(seq(-1.2,1.2, length.out=m),  m ) )
C = matrix(C,m,m)
Z = 0
X = array(0, c(m,m,20))
for (k in 1:20) {
  Z = Z^2+C
  X[,,k] = exp(-abs(Z))
}
image(X[,,k], col=tim.colors(256)) # show final image in R
write.gif(X, Mandelbrot.gif, col=tim.colors(256), delay=100)
# drop Mandelbrot.gif file from current directory on any web brouser to
see the animation

 Jarek 
\ 
 Jarek Tuszynski, PhD.   o / \ 
 Science Applications International Corporation  \__,|  
 (703) 676-4192 \ 
 [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
  

-- 
visit the R Graph Gallery : http://addictedtor.free.fr/graphiques
 ~ 
~~  Romain FRANCOIS - http://addictedtor.free.fr ~~
Etudiant  ISUP - CS3 - Industrie et Services   
~~http://www.isup.cicrp.jussieu.fr/  ~~
   Stagiaire INRIA Futurs - Equipe SELECT  
~~   http://www.inria.fr/recherche/equipes/select.fr.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] Save output

2005-10-03 Thread Romain Francois
Le 03.10.2005 12:30, Frank Schmid a écrit :

 Dear R-Mastermind


 Within a while or a for-loop, is there a way that I can save to disk the
 results of the previous calculations at the end of each loop with 
 filenames
 called file01.Rdata, file02.Rdata etc?

 So far, I have tried to write the outcome of each loop in a 3 dimensional
 array and saved it just once after the loop. Or is there another way 
 so that
 I can keep the resulting matrix of every step in the loop?

 Thank you very much for your help


 Frank Schmid
  

?save
?sprintf

for(i in 1:12){
 tmp - rnorm(10) # change it with your computations
 save(tmp, file=sprintf('file%02d.RData',i))
}

Romain

-- 
visit the R Graph Gallery : http://addictedtor.free.fr/graphiques
 ~ 
~~  Romain FRANCOIS - http://addictedtor.free.fr ~~
Etudiant  ISUP - CS3 - Industrie et Services   
~~http://www.isup.cicrp.jussieu.fr/  ~~
   Stagiaire INRIA Futurs - Equipe SELECT  
~~   http://www.inria.fr/recherche/equipes/select.fr.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] heatmap

2005-10-03 Thread Romain Francois
Le 03.10.2005 14:24, Andrea Zangrando a écrit :

Hi,
i created a graph with heatmap(sma) function:

heatmap(dataHeat(x))

and I wish to change the gradation of colors from blue to red, how could 
i do?
Using heatmap(dataHeat(x), col=c(2,4)) i will use only 2 colors 
without gradation.

Ty so much
Andrea
  

Hello,

Check bluered() in the gplots package.

Romain

-- 
visit the R Graph Gallery : http://addictedtor.free.fr/graphiques
 ~ 
~~  Romain FRANCOIS - http://addictedtor.free.fr ~~
Etudiant  ISUP - CS3 - Industrie et Services   
~~http://www.isup.cicrp.jussieu.fr/  ~~
   Stagiaire INRIA Futurs - Equipe SELECT  
~~   http://www.inria.fr/recherche/equipes/select.fr.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] scatterplot3d + density() + polygon(color)

2005-09-28 Thread Romain Francois
Le 28.09.2005 09:45, Martin Maechler a écrit :

UweL == Uwe Ligges [EMAIL PROTECTED]
on Wed, 28 Sep 2005 08:58:16 +0200 writes:



UweL klebyn wrote:
 Hi R Users,
 
 How to use the function polygon() together with the
 package scatterplot3d?
 
 I am trying to color below of the curves defined for the
 function density().
 
 I tried to use the site: R GRAPH GALLERY as tutorial.
 
 I tried to adapt the example of this page: [figure]:
 http://addictedtor.free.fr/graphiques/RGraphGallery.php?graph=30
 
 [code]:
 http://addictedtor.free.fr/graphiques/sources/source_30.R
 
 to my case but I do not obtain success.
 
 Somebody could give a tip to me, please?
 
 I am thankful anticipatedly.
 
 Cleber Borges
 
 
 
 #My code test
 ##
...

UweL Example:

  

 library(scatterplot3d)

 x - c(0.4, -1.2, .8, -.7, 0)
 d - vector(length = length(x), mode = list)
 d[[1]] - density(x[1], bw = 1.2, from = -3.0, to = 3.0)
 d[[2]] - density(x[2], bw = 0.8, from = -3.0, to = 3.0)
 d[[3]] - density(x[3], bw = 0.6, from = -2.5, to = 2.5)
 d[[4]] - density(x[4], bw = 0.5, from = -2.0, to = 2.0)
 d[[5]] - density(x[5], bw = 0.3, from = -1.5, to = 1.5)

 x - lapply(d, [[, x)
 y - lapply(d, [[, y)
 z - lapply(seq(0.1, 0.5, 0.1), rep, each = 512)

 sx - unlist(x)
 sy - unlist(y)
 sz - unlist(z)

 s3d - scatterplot3d(x = sx, y = sz, z = sy, type = n)
 for(i in rev(seq(along=d))){
 s3d_coords - s3d$xyz.convert(x[[i]], z[[i]], y[[i]])
 polygon(s3d_coords, col = i, border = black)
 }

  


Very nice, Uwe!

To make it perfect, you'd have to add

 s3d$box3d()

at the end; otherwise some of the painted polygons hide lines of
the cube box which should not be hidden.

Martin Maechler
  

Very nice indeed,

may i suggest some changes in the lapply calls :

 x - lapply(d, function(dd){dd$x[c(1,1:512,512)]})
 y - lapply(d, function(dd){c(0,dd$y,0)})
 z - lapply(seq(0.1, 0.5, 0.1), rep, each = 514)

some densities weren't 0 at the end of the interval, so the curves 
seemed rotated. especially the red one.


Romain

-- 
visit the R Graph Gallery : http://addictedtor.free.fr/graphiques
 ~ 
~~  Romain FRANCOIS - http://addictedtor.free.fr ~~
Etudiant  ISUP - CS3 - Industrie et Services   
~~http://www.isup.cicrp.jussieu.fr/  ~~
   Stagiaire INRIA Futurs - Equipe SELECT  
~~   http://www.inria.fr/recherche/equipes/select.fr.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] hist(x, ...) with normal distribution curve

2005-09-27 Thread Romain Francois
Le 27.09.2005 10:32, Peter Wolf a écrit :

Knut Krueger wrote:
  

I am looking for a histogram or box plot with the adding  normal 
distribution  curve
I think that must be possible, but I am not able to find out how to do.

Regards Knut
 


*There are a lot of answers to add a histogram.
Here is a simple way to add a tiny boxplot to a plot / histogram

x-rexp(100)
hist(x)
boxplot(x,axes=F,add=T,horizontal=T,
 at=par()$usr[3]+diff(par()$usr[3:4])*.017,
 boxwex=0.02*diff(par()$usr[3:4]),pch=8)

Peter Wolf

  

The tufte axes, described there : 
http://www.cl.cam.ac.uk/users/sjm217/projects/graphics/
may be of interrest here.

What about making it a possibility for all plots ? For example using :
R par(xaxt='tufte')
R plot(rnorm(200), rnorm(200))
would produce a scatterplot with the tufte axes

Romain.

-- 
visit the R Graph Gallery : http://addictedtor.free.fr/graphiques
 ~ 
~~  Romain FRANCOIS - http://addictedtor.free.fr ~~
Etudiant  ISUP - CS3 - Industrie et Services   
~~http://www.isup.cicrp.jussieu.fr/  ~~
   Stagiaire INRIA Futurs - Equipe SELECT  
~~   http://www.inria.fr/recherche/equipes/select.fr.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] hist(x, ...) with normal distribution curve

2005-09-26 Thread Romain Francois
Le 25.09.2005 14:34, Knut Krueger a écrit :

.
I am looking for a histogram or box plot with the adding  normal 
distribution  curve
I think that must be possible, but I am not able to find out how to do.



Regards Knut
  

Hi Knut,

There are a lot of ways to do that, let x be your data (assume x ~ 
N(mu=2,sd=.4))
R x - rnorm(200, mean=2, sd=.4)

** With the traditionnal graphics system, do :
R hist(x, prob=T)
R curve(dnorm, col=2, mean=mean(x), sd=sd(x))

** With lattice :
R histogram(~x,
  panel = function(x,...){
panel.histogram(x,...)
panel.mathdensity(dmath = dnorm, col = red,
args = list(mean=mean(x),sd=sd(x)))
   },
  type=density)

Then, have a look at :
http://addictedtor.free.fr/graphiques/search.php?q=hist

And also have a nice day

Romain

-- 
visit the R Graph Gallery : http://addictedtor.free.fr/graphiques
 ~ 
~~  Romain FRANCOIS - http://addictedtor.free.fr ~~
Etudiant  ISUP - CS3 - Industrie et Services   
~~http://www.isup.cicrp.jussieu.fr/  ~~
   Stagiaire INRIA Futurs - Equipe SELECT  
~~   http://www.inria.fr/recherche/equipes/select.fr.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


  1   2   >