Re: [R] Excel (off-topic, sort of)

2007-08-29 Thread Philippe Grosjean
Take a look at Mathematica or Maple. This is the kind of thing you do 
with these languages.
Best,

Philippe Grosjean


Alberto Monteiro wrote:
 Chris wrote:
 Typically, people in the R community are not used to the spreadsheet 
 paradigm and need some time to be able to take advantage of 
 automatic recalculation, (...)

 Do you know what's in my wish list?
 
 I wish spreadsheets and computer languages had gone one
 step further.
 
 I mean, it's nice to define Cell X to be equal to
 Cell Y + 10, and then when we change Cell Y, magically we
 see Cell X change.
 
 But why can't it be the reverse? Why can't I change Cell X
 _and see the change in Cell Y_?
 
 Maybe I'll write a letter to Santa Claus [there are people
 who write to congressman; they must have more faith than me].
 I wish a language where I can write
 
   a = b + 10
 
 and then when I write
 
   a = 20
 
 the language automatically assigns b = 10.
 
 There's a way to simulate this in any computer language, or even
 in Excel: instead of variables or cells, we have structures
 with value and a flag. The flag dictates if it's input, undefined
 or calculated. And then there's a list of relations. So the
 program/language/spreadsheed loops through the list of relations,
 detects whenever we can infer a new calculated value, and calculates
 it, until there's nothing else to do or a contradiction is found.
 
 Alberto Monteiro
 
 __
 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] Excel

2007-08-29 Thread Philippe Grosjean
I think that one big problem of Excel regarding readability of the 
calculation done is its non linear nature: mixing data and calculation 
on a 2D grid could look nice at first sight, but indeed, it turns into a 
nightmare to understand all the calculations actually done.

On the counterpart, reading a R script is like reading a book: providing 
you understand the language, the R script tells you a story from the 
beginning (reading of the raw data) to the end (final graphs and tables) 
in a linear way.

Thus, it is the concept of Excel itself (the 2D/3D interactive 
spreadsheet) that makes it confusing. All the nice things you can do 
with Excel will never save it for the time lost to understand what a 
spreadsheet does (and thus, to debug it, or slightly change its 
calculation).

Best,

Philippe Grosjean

Frank E Harrell Jr wrote:
 Rolf Turner wrote:
 On 30/08/2007, at 8:49 AM, Greg Snow wrote:

 Erich Neuwirth said:

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On Behalf Of Erich Neuwirth
 Sent: Wednesday, August 29, 2007 12:43 PM
 To: r-help
 Subject: Re: [R] Excel

 Excel bashing can be fun but also can be dangerous because
 you are makeing your life harder than necessary.
 My experience differs, so far using excel (other than as a table  
 layout
 program) has made my life harder more times than it has made it  
 easier.
  Remainder of message deleted.

  Bravo!!!  Very well and very cogently expressed!

  cheers,

  Rolf Turner
 
 Yes!  In addition I'd like to stress that the Excel model represents 
 non-reproducible research.
 
 Frank Harrell
 


__
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] filling a list faster

2007-07-13 Thread Philippe Grosjean
If all the data coming from your iterations are numeric (as in your toy 
example), why not to use a matrix with one row per iteration? Also, do 
preallocate the matrix and do not add row or column names before the end 
of the calculation. Something like:

  m - matrix(rep(NA, 3*10^5), ncol = 3)
  system.time(for(i in (1:10^5)) m[i, ] - c(i,i+1,i))
user  system elapsed
   1.362   0.033   1.424

That is, about 1.5sec on my Intel Duo Core 2.33Mhz MacBook Pro, compared to:

  l - list(1-c(1,2,3))
  system.time(for(i in (1:10^5)) l[[length(l)+1]] - c(i,i+1,i))
user  system elapsed
191.629  49.110 248.454

... more than 4 minutes for your code.

By the way, what is your very fast machine, that is actually four 
times faster than mine (gr!)?

Best,

Philippe Grosjean

..∞}))
  ) ) ) ) )
( ( ( ( (Prof. Philippe Grosjean
  ) ) ) ) )
( ( ( ( (Numerical Ecology of Aquatic Systems
  ) ) ) ) )   Mons-Hainaut University, Belgium
( ( ( ( (
..

Balazs Torma wrote:
 hello,
 
 first I create a list:
 
 l - list(1-c(1,2,3))
 
 then I run the following cycle, it takes over a minute(!) to  
 complete on a very fast mashine:
 
 for(i in (1:10^5)) l[[length(l)+1]] - c(i,i+1,i)
 
 How can I fill a list faster? (This is just a demo test, the elements  
 of the list are calculated iteratively in an algorithm)
 
 Are there any packages and documents on how to use more advanced and  
 fast data structures like linked-lists, hash-tables or trees for  
 example?
 
 Thank you,
 Balazs Torma
 
 __
 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] How to activate the R commands in SciViews

2007-07-12 Thread Philippe Grosjean
As explained on the web page from where you downloaded SciViews 0.8-9, 
this version is not compatible with R 2.5.0.
Best,

Philippe Grosjean
..∞}))
  ) ) ) ) )
( ( ( ( (Prof. Philippe Grosjean
  ) ) ) ) )
( ( ( ( (Numerical Ecology of Aquatic Systems
  ) ) ) ) )   Mons-Hainaut University, Belgium
( ( ( ( (
..

Liviu Andronic wrote:
 Hello everybody,
 
 I have a problem similar to that reported by Felipe. I installed R
 2.5.0, Rcmdr from CRAN and SciViews-R 0.8-9 (with all the required and
 optional components).
 
 When accessing the R Commander menu from within
 SciViews, the links cannot be clicked. When pointing at them, the mouse
 transforms in a hand (as it normally does, similar to Internet
 hyperlinks). However, the links cannot be activated. I had the
 impression that in some way SciViews makes use of Internet Explorer in
 its GUI, and that the problem was somewhere there. But I could not get
 to the bottom of it.
 
 Is there any way to make SciViews correctly use Rcmdr functionality?
 
 Thanks in advance,
 Liviu
 
 
 On 6/20/07, Felipe Carrillo [EMAIL PROTECTED] wrote:
 Please help, I have SciViews(svGUI) and Rcmdr but when the SciViews Console 
 opens the R commander menu don't work. Any ideas anybody?

 


__
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] [Fwd: Re: How to activate the R commands in SciViews]

2007-07-12 Thread Philippe Grosjean
Well.. plans are there from a long time to rewrite SciViews completely
and make it platform independent (to work on Linux/Unix and MacOS X, as
well as Windows). I have done some work in this direction when time
permitted, but I am pretty busy with other work. During the holidays, I
will continue to work in this direction. I will try to package a first
running version of SciViews compatible with latest R and Rcmdr for
Windows and Linux for next September. At least, I *have* to do so,
because I *need* it for one of my teachings which will be done in a
different University (where all machines are running with Linux)!

So, my advice would be to check the web site again in September/October
for some news. Unfortunately, I cannot promise more. Sorry for the long
delays. I do my best, and the second programmer (Eric Lecoutre) has left
the project a long time ago... so, I am alone on this!

Best,

Philippe Grosjean

..∞}))
  ) ) ) ) )
( ( ( ( (Prof. Philippe Grosjean
  ) ) ) ) )
( ( ( ( (Numerical Ecology of Aquatic Systems
  ) ) ) ) )   Mons-Hainaut University, Belgium
( ( ( ( (
..

Liviu Andronic wrote:
 Thank you for the pointer.
 
 On the SciViews official site
 (http://www.sciviews.org/SciViews-R/index.html) I could not find any
 indications on this incompatibility. At any rate, I would have two
 questions related to the future of SciViews-R.
 
 Are there any developments planned in some near future that would make
 SciViews compatible with recent versions of R and Rcmdr? At the
 Unviversity of Social Sciences of Toulouse, for example, the most
 recent version of R is installed. And for statistics introductory
 classes, SciViews would be an important advantage. R should be
 downgraded to which version for the two to be compatible?
 
 Secondly, is there any chance that SciViews become available on Linux,
 again in some not so distant future? That is, would the tcltk2 package
 be ported to other OS's and would SciViews be subsequently enhanced to
 build on such systems? Last time I checked the net, no interesting
 information was available as to such developments. Maybe there is some
 beta version of tcltk2 that I don't know of..
 
 Regards,
 Liviu
 
 On 7/12/07, Philippe Grosjean [EMAIL PROTECTED] wrote:
 As explained on the web page from where you downloaded SciViews 0.8-9,
 this version is not compatible with R 2.5.0.
 Best,

 Philippe Grosjean
 ..∞}))
   ) ) ) ) )
 ( ( ( ( (Prof. Philippe Grosjean
   ) ) ) ) )
 ( ( ( ( (Numerical Ecology of Aquatic Systems
   ) ) ) ) )   Mons-Hainaut University, Belgium
 ( ( ( ( (
 ..

 Liviu Andronic wrote:
  Hello everybody,
 
  I have a problem similar to that reported by Felipe. I installed R
  2.5.0, Rcmdr from CRAN and SciViews-R 0.8-9 (with all the required and
  optional components).
 
  When accessing the R Commander menu from within
  SciViews, the links cannot be clicked. When pointing at them, the mouse
  transforms in a hand (as it normally does, similar to Internet
  hyperlinks). However, the links cannot be activated. I had the
  impression that in some way SciViews makes use of Internet Explorer in
  its GUI, and that the problem was somewhere there. But I could not get
  to the bottom of it.
 
  Is there any way to make SciViews correctly use Rcmdr functionality?
 
  Thanks in advance,
  Liviu
 
 
  On 6/20/07, Felipe Carrillo [EMAIL PROTECTED] wrote:
  Please help, I have SciViews(svGUI) and Rcmdr but when the SciViews 
 Console opens the R commander menu don't work. Any ideas anybody?
 
 
 

 
 


-- 
..∞}))
  ) ) ) ) )
( ( ( ( (Prof. Philippe Grosjean
  ) ) ) ) )
( ( ( ( (Numerical Ecology of Aquatic Systems
  ) ) ) ) )   Mons-Hainaut University, Belgium
( ( ( ( (
..

__
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] Me again, about the horrible documentation of tcltk

2007-07-06 Thread Philippe Grosjean
For those who are interested, I just cook a little tcltkHelp() function 
to ease access to the Tcl/Tk documentation under Windows. This is on the 
Wiki discussion of the TkCommands help page at: 
http://wiki.r-project.org/rwiki/doku.php?id=rdoc:tcltk:tkcommands
Best,

Philippe Grosjean

..°}))
  ) ) ) ) )
( ( ( ( (Prof. Philippe Grosjean
  ) ) ) ) )
( ( ( ( (Numerical Ecology of Aquatic Systems
  ) ) ) ) )   Mons-Hainaut University, Belgium
( ( ( ( (
..

Duncan Murdoch wrote:
 On 06/07/2007 3:51 AM, Mike Meredith wrote:
 I think it would help if the tcl/tk manuals were added to the RGui Help
 menu. Why google when they are on your hard drive already?
 
 I'd say they are too specialized for that.  There are dozens of topics 
 that are as important as this, but a GUI menu with more than a few 
 entries is just unwieldy.
 
 We do have a text reference to the help files in the ?tcltk topic.
 
 Duncan Murdoch
 
 Cheers,  Mike


 Mike Prager wrote:
 Alberto Monteiro [EMAIL PROTECTED] wrote:

 How on Earth can I know what are the arguments of any of the functions of 
 the tcl/tk package? [...]
 My impression is that you as supposed to look in tck/tk manuals.
 For example, Googling on

 tk tck getopenfile

 pointed to this Web page:

 http://www.tcl.tk/man/tcl8.5/TkCmd/getOpenFile.htm

 Hope that helps.

 -- 
 Mike Prager, NOAA, Beaufort, NC
 * Opinions expressed are personal and not represented otherwise.
 * Any use of tradenames does not constitute a NOAA endorsement.

 __
 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.


__
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] Question concerning pastecs package

2007-05-25 Thread Philippe Grosjean
Hello,

I already answered privately to your question. No, there is no 
translation of pastecs.pdf. The English documentation is accessible, as 
usual, by:

?turnpoints

Regarding your specific question, 'info' is the quantity of information 
I associated with the turning points:

I = -log2 P(t)

where P is the probability to observe a turning point at time t under 
the null hypothesis that the time series is purely random, and thus, the 
distribution of turning points follows a normal distribution with:

E(p) = 2/3*(n-2)
var(p) = (16*n - 29)/90

with p, the number of observed turning points and n the number of 
observations. Ibanez (1982, in French, sorry... not my fault!) 
demonstrated that P(t) is:

P(t) = 2*(1/n(t-1)! * (n-1)!)

As you can easily imagine, from this point on, it is straightforward to 
construct a test to determine if the series is random (regarding the 
distribution of the turning points), more or less monotonic (more or 
less turning points than expected), See also the ref cited in the online 
help (Kendall 1976).

References:
---
Ibanez, F., 1982. Sur une nouvelle application de la théorie de 
l'information à la description des séries chronologiques planctoniques. 
J. Exp. Mar. Biol. Ecol., 4:619-632

Kendall, M.G., 1976. Time-series, 2nd ed. Charles Griffin  Co, London

Best,

Philippe Grosjean

..°}))
  ) ) ) ) )
( ( ( ( (Prof. Philippe Grosjean
  ) ) ) ) )
( ( ( ( (Numerical Ecology of Aquatic Systems
  ) ) ) ) )   Mons-Hainaut University, Belgium
( ( ( ( (
..

Rainer M. Krug wrote:
 Hi
 
 I just installed the pastecs package and I am wondering: is there an 
 english (or german) translation of the file pastecs.pdf? If not, is 
 there an explanation somewhere of the object of type 'turnpoints' as a 
 result of turnpoints(), especially the info field?
 
 Thanks,
 
 Rainer


__
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 Wiki down?

2007-05-04 Thread Philippe Grosjean
The site is up again. This was a wrong manipulation. Sorry.

..°}))
  ) ) ) ) )
( ( ( ( (Prof. Philippe Grosjean
  ) ) ) ) )
( ( ( ( (Numerical Ecology of Aquatic Systems
  ) ) ) ) )   Mons-Hainaut University, Belgium
( ( ( ( (
..

Martin Maechler wrote:
 Talbot == Talbot Katz [EMAIL PROTECTED]
 on Thu, 03 May 2007 12:35:27 -0400 writes:
 
 Talbot Hi.  I can't access the site
 Talbot http://wiki.r-project.org/.  I didn't find any
 Talbot notice about this on http://www.r-project.org/.
 Talbot Does anyone have any more information about the R
 Talbot Wiki status?  Thanks!
 
 Yes, it is currently down.
 Thanks for the note.
 
 It's maintainer has hereby __ CC __ be notified as well.
 
 Regards, 
 Martin Maechler ETH Zurich
 
 __
 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] Get the difference between two matrices with different length

2007-05-04 Thread Philippe Grosjean
Hello,

The answer is in one page of the R Wiki (just created to address such a 
question, by the way): 
http://wiki.r-project.org/rwiki/doku.php?id=tips:data-manip:calc_on_two_tables

..°}))
  ) ) ) ) )
( ( ( ( (Prof. Philippe Grosjean
  ) ) ) ) )
( ( ( ( (Numerical Ecology of Aquatic Systems
  ) ) ) ) )   Mons-Hainaut University, Belgium
( ( ( ( (
..

Felix Wave wrote:
 Hello,
 I have got two matrices with different length. The matrices have 3
 columuns. The first two are coordinates. The third is a measurement.
 
 Now I want to get a subtraction between every single value of the 
 third column (between matrix1 and matrix2), but only if the two 
 first coordinates in matrix1 and matrix2 are the same.
 
 I tried FUN=? in aggregate and ave, but I don't know the command
 for such a subtraction?
 
 
 Thank's a lot.
 Felix
 
 
 ---
 
 The matrixes (examlple):
 
 1 0.1 0.0042
 1 0.2 0.00423
 1 0.4 0.00467
 1 0.5 0.00518
 1 0.6 0.0061
 
 
 1 0.1 0.0043
 1 0.2 0.00442
 1 0.3 0.00433
 1 0.4 0.0045
 1 0.5 0.00524
 1 0.7 0.006
 
 
 
 My aim:
 ---
 1 0.1 -0.0001
 1 0.2 -0.00019
 1 0.4 0.00017
 1 0.5 -0.6
 
 __
 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] A problem with svIDE in Tinn-R?

2007-04-30 Thread Philippe Grosjean
Hello,

I konw I have some corrections to do in svIDE,... I simply don't have 
the time right now. Will try next week. Thank for reporting the problem.
Best,

Philippe Grosjean

..°}))
  ) ) ) ) )
( ( ( ( (Prof. Philippe Grosjean
  ) ) ) ) )
( ( ( ( (Numerical Ecology of Aquatic Systems
  ) ) ) ) )   Mons-Hainaut University, Belgium
( ( ( ( (
..

Prof Brian Ripley wrote:
 It is a warning, and a warning about a long-standing error in svIDE.
 
 This is not to do with Tinn-R except perhap that the message gets 
 mangled.  I get from command-line R
 
 1: '\A' is an unrecognized escape in a character string
 2: unrecognized escape removed from ;for Options\AutoIndent: 0=Off, 
 1=follow language scoping and 2=copy from previous line\n
 
 Of course, a \ needs to be doubled in R character strings.  That has 
 always been the case, but the warning is new.
 
 Please take it up with the svIDE maintainer.
 
 
 On Sun, 29 Apr 2007, Kenneth Cabrera wrote:
 
 Hi R users:

 I want to know if any one of you had
 the problem with Tinn-R, when you
 call the library svIDE on the new R 2.5.0,
 (because in the old R 2.4.1 works with out
 any problem).

 I got this message:

 library(svIDE)
 Loading required package: tcltk
 Loading Tcl/Tk interface ... done
 Warning messages:
 1: '\A' is an unrecognized escape in a character string
 2: no se reconoce el valor 'save'

 Is it a critical warning? What would work and what not?
 What is it new in the new version that
 is not in the old version that makes this message appears?

 Thank you for your help.




__
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] regular expression help

2007-04-18 Thread Philippe Grosjean
gsub(^.*([[:alpha:]]).*$, \\1, vzor)


..°}))
  ) ) ) ) )
( ( ( ( (Prof. Philippe Grosjean
  ) ) ) ) )
( ( ( ( (Numerical Ecology of Aquatic Systems
  ) ) ) ) )   Mons-Hainaut University, Belgium
( ( ( ( (
..

Petr PIKAL wrote:
 Dear all
 
 as usual I am again lost in virtues of regular expressions.
 
 I have such character vector named vzor:
 
 [365] 61A  62C/27   65A/27   66C/29   69A/29   70C/31 
 73A/31   74C/33   77A/33   81A/35   82C/37   85A/37   86C/39 
  
 [378] 89A/39   90C/41   93A/41   94C/43   97A/43   98C/45 
 101A/45  102C/47  105A/47  106C/49  109A/49  110C/51 113A/51 
 
 
 and I want only letters from it.
 
 I tried
 
 gsub([[:alpha:]], \\1,vzor)
 Error in gsub([[:alpha:]],  \\1, vzor) : 
 invalid backreference 1 in regular expression
 
 gsub([:alpha:], \\1,vzor)
 
 gives me the same vector
 
 There is probably very simple solution to it which I overlooked and 
 examples in help page did not help me to find it.
 
 Thank you
 Best regards
 
 Petr Pikal
 [EMAIL PROTECTED]
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


__
R-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] software comparison

2007-04-16 Thread Philippe Grosjean
Hello,

I just read this paper, and was surprised by:

This study performs a comparison of the latest versions of nine 
different statistical software packages using StRD. These packages are 
SAS (9.1), SPSS (12.0), Excel (2003), Minitab (14.0), Stata (8.1), Splus 
(6.2), R (1.9.1), JMP (5.0), and StatCrunch (3.0).

For a paper published in 2007, and submitted in April 2005, this is 
still surprising. If I my calculation is correct, in 2004, they would 
have used R 2.2.x, or something,... not 1.9.1?

Anyway, does someone know if there is a chance 2.5.0 provides some 
improvements in some of the difficult cases for R 1.9.1 (for instance, 
improvement of the algorithms for calculating autocorrelation, ANOVA, 
linear regression or non linear regression)?

Best,

Philippe Grosjean

..°}))
  ) ) ) ) )
( ( ( ( (Prof. Philippe Grosjean
  ) ) ) ) )
( ( ( ( (Numerical Ecology of Aquatic Systems
  ) ) ) ) )   Mons-Hainaut University, Belgium
( ( ( ( (
..

Robert McFadden wrote:
 Dear R Users,
 May be you are interested in an article that compares 9 statistical
 softwares (including R).
 Any comments are appreciate.  
 
 Article:
 Keeling, Kellie B.; Pavur, Robert J.A comparative study of the reliability
 of nine statistical software packages Computational Statistics and Data
 Analysis, Volume: 51, Issue: 8, 2007, pp. 3811-3831
 
 
 Abstract
 The reliabilities of nine software packages commonly used in performing
 statistical analysis are assessed and compared. The
 (American) National Institute of Standards and Technology (NIST) data sets
 are used to evaluate the performance of these software
 packages with regard to univariate summary statistics, one-way ANOVA, linear
 regression, and nonlinear regression. Previous
 research has examined various versions of these software packages using the
 NIST data sets, but typically with fewer software
 packages than used in this study. This study provides insight into a
 relative comparison of a wide variety of software packages
 including two free statistical software packages, basic and advanced
 statistical software packages, and the popular Excel package.
 Substantive improvements from previous software reliability assessments are
 noted. Plots of principal components of a measure of
 the correct number of significant digits reveal how these packages tend to
 cluster for ANOVA and nonlinear regression.
 
 
 Best,
 Rob
 
 __
 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] Abundance data ordination in R

2007-04-02 Thread Philippe Grosjean

Gavin Simpson wrote:
 On Sun, 2007-04-01 at 09:20 -0700, Milton Cezar Ribeiro wrote:
 Dear R-gurus

 I have a data.frame with abundance data for species and sites which looks 
 like:
 mydf-data.frame(
  sp1=sample(0:10,5,replace=T),
  sp2=sample(0:20,5,replace=T),
  sp3=sample(0:4,5,replace=T),
  sp4=sample(0:2,5,replace=T))
 rownames(mydf)-paste(sites,1:5,sep=)

 I would like make an ordination analysis of these data and my worries
 is about the zeros (absence of species) into the matrix. Up to I
 read (Gotelli - A primir of ecological statistics, 2004), when I have
 abundance data I cant compute Euclidian Distances because the zeros
 have the meaning of absence of the species and not as zero counting.
 Gotelli suggests one make principal coordinates analysis. I would
 like to here from you what you think about and what is the best
 packages and functions to I compute my distance matrices and do my
 ordination analysis. Can I considere zero as NA on my data.frame? Is
 there a good PDF book available about Multivariate Analysis for
 abundance data available on the web?
 
 In addition to the other suggestions, there is a Task View on CRAN for
 the topic of Environmetrics. This has a section describing the various
 ordination techniques available in R as well as functions to calculate
 distance/dissimilarity matrices:
 
 http://cran.r-project.org/src/contrib/Views/Environmetrics.html
 
 G

... And here are a couple of other suggestions:

1) Use a distance that does not take couples of zero as information. 
Typically, the Bray-Curtis distance is one of the most commonly used in 
such a case.

2) Possibly transform your data first, depending on the relative 
importance you want to give to rare species (typically, a log, or double 
square root transformations increase importance of rare species relative 
to abundant ones).

3) One approach is to use MultiDimensional Scaling (see MASS package) on 
the distance matrix to make the ordination in two or three dimensions. 
See the Venables  Ripley's MASS book for details.

4) Another alternative is to use correspondence analysis, which uses the 
Chi2 distance and is adapted to abundances (it is designed to analyze 
contingency tables, but table of abundances, station versus species, 
could be considered as such a double entry contingency table in a way).

Best,

Philippe Grosjean

 Kind regards

 Miltinho
 Brazil

 __


  [[alternative HTML version deleted]]

 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 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] Wikibooks

2007-03-30 Thread Philippe Grosjean


Bert Gunter wrote:
 Question:
 
 Many (perhaps most?) questions on the list are easily answerable simply by
 checking existing R Docs (Help file/man pages, Intro to R, etc.). Why would
 a Wiki be more effective in deflecting such questions from the mailing list
 than them? Why would too helpful R experts be more inclined to refer people
 to the Wiki than the existing docs? Bottom line: it's psychology at issue
 here, I think, not the form of the docs. 

Answer:

The online help, vignettes and manuals have a very intimidating (i.e., 
technical) presentation for people that tend to be afraid of such a 
crude presentation. It is apparently not your case, and this is probably 
why you even don't realize this could be a problem for a non negligible 
fraction of R. The Wiki was primarily targeted to them. As you say: it's 
psychology at issue here.

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.

Best,

Philippe Grosjean
-- 
..°}))
  ) ) ) ) )
( ( ( ( (Prof. Philippe Grosjean
  ) ) ) ) )
( ( ( ( (Numerical Ecology of Aquatic Systems
  ) ) ) ) )   Mons-Hainaut University, Belgium
( ( ( ( (
..



 Disclaimer 1: None of this is meant to reflect one way or ther other on the
 usefulness of Wikis as a documentation format -- only their ability to
 change the Help list culture.
 
 Disclaimer 2: Others have repeatedly made similar comments (asking us to
 refer people to the docs rather than providing explicit answers, I mean).
 
 Cheers,
 Bert Gunter
 Genentech Nonclinical Statistics
 South San Francisco, CA 94404
 650-467-7374
 
 
 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On Behalf Of Frank E Harrell Jr
 Sent: Thursday, March 29, 2007 3:32 PM
 To: Ben Bolker
 Cc: r-help@stat.math.ethz.ch
 Subject: Re: [R] Wikibooks
 
 Ben Bolker wrote:
 Alberto Monteiro albmont at centroin.com.br writes:

 As a big fan of Wikipedia, it's frustrating to see how little there is
 about 
 R in the correlated project, the Wikibooks:

 http://en.wikibooks.org/wiki/R_Programming

 Alberto Monteiro

   Well, we do have an R wiki -- http://wiki.r-project.org/rwiki/doku.php
 --
 although it is not as active as I'd like.  (We got stuck halfway through
 porting Paul Johnson's R Tips to it ...)   Please contribute!
   Most of the (considerable) effort people expend in answering
 questions about R goes to the mailing lists -- I personally would like it
 if some
 tiny fraction of that energy could be redirected toward the wiki, where
 information can be presented in a nicer format and (ideally) polished
 over time -- rather than having to dig back through multiple threads on
 the
 mailing lists to get answers.  (After that we have to get people
 to look for the answers on the wiki.)
 
 I would like to strongly second Ben.  In some ways, R experts are too 
 nice.  Continuing to answer the same questions over and over does not 
 lead to a better way using R wiki.  I would rather see the work go into 
 enhancing the wiki and refactoring information, and responses to many 
 r-help please for help be see wiki topic x.  While doing this let's 
 consider putting a little more burden on new users to look for good 
 answers already provided.
 
 Frank
 
   Just my two cents -- and I've been delinquent in my 
 wiki'ing recently too ...

   Ben Bolker

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

2007-03-30 Thread Philippe Grosjean

..°}))
  ) ) ) ) )
( ( ( ( (Prof. Philippe Grosjean
  ) ) ) ) )
( ( ( ( (Numerical Ecology of Aquatic Systems
  ) ) ) ) )   Mons-Hainaut University, Belgium
( ( ( ( (
..

Dieter Menne wrote:
 Ben Bolker bolker at zoo.ufl.edu writes:
 
   Well, we do have an R wiki -- http://wiki.r-project.org/rwiki/doku.php --
 although it is not as active as I'd like.  (We got stuck halfway through
 porting Paul Johnson's R Tips to it ...)   Please contribute!
 
 I once tried:
 
 http://wiki.r-project.org/rwiki/doku.php?id=guides:lmer-tests
 
 but I don't think I will do this again on the existing Wiki. I am a frequent
 Wikipedia-Writer, so I know how it works, but this was discouraging.
 
 1) The structure of the Wiki was and is still incomprehensibly to me. I needed
 too much time to find out how to put the stuff into it.

Really bad. This was the best design we obtained after a hard work of 
several tens of people. Sorry for you. By the way, did you ever noticed 
that Wikipedia basically has NO structure? It is intended to be mostly 
accessed by KEYWORDS. On the main page, you have: main (that page), 
then content (explanation and general links to the whole content), 
plus a couple of selected content links (featured, recent, random).

So, if you like this structure, that is, basically, no structure and 
access through keywords... why not to do the same with the R Wiki? Just 
type your keyword in the top-right text entry and click search. Then, 
you don't need to care about that structure that is still 
incomprehensible to you.

 2) I decided to use the large guides section, because I wanted the thread
 transcript to be one one page. If you check the revision history, you will 
 find
 that I needed more than three hours to get it working. The main reason is the
 sluggish response, and the incomprehensible error messages or the lack of it
 when some  was not matched or whatever (Thanks, Ben, for correcting the
 remaining errors). This is a problem of the Wiki software used, other Wikis 
 such
 as Media(pedia) are much more tolerant or informant.

As I said, sluggish response is probably due to a combination of a slow 
Internet communication from your computer to the server at the time you 
edited your page, the edition of a too large page, and lack of edition 
section per section (you can edit each paragraph separately). I already 
made some corrections on the Wiki when I was in USA (the server is in 
Belgium, Europe), and it was not sluggish at all... On other 
circumstances, I noted a much slower reaction, too. That's Internet!

DokuWiki is NOT slower than Mediawiki, especially with an underused Wiki 
site as R wiki is currently.

 Then, Philippe Grosjean informed me: Your page is way too long and is a 
 rather
 crude copy and paste from the long thread in the mailing list.

Yes, I still believe so. Wiki pages are more effective when they are 
kept short.

 I disagree. Why do you have a large guides section? And taking into account
 the amount of work I put into reformatting the transcript, I decided it was my
 first and last contribution to the Wiki.

The large guides section is for ... large guides, of course... but who 
said that they should be all contained in a single page??? Just quoting 
http://wiki.r-project.org/rwiki/doku.php?id=guides:guides: If it is a 
larger contribution with many pages, create a dedicated subsection in 
tutorials (like “stats-with-r”, for instance). The key is there: a 
large guide should better be represented by several wiki pages collected 
together in a dedicated subsection. Is it that hard to understand?

Philippe Grosjean

 Dieter Menne
 
 __
 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] Fanny Clustering

2007-03-29 Thread Philippe Grosjean
1) Reduce the size of your sample (random or stratified subsampling),

2) Increase the memory of your computer available to R.

Best,

Philippe Grosjean

..°}))
  ) ) ) ) )
( ( ( ( (Prof. Philippe Grosjean
  ) ) ) ) )
( ( ( ( (Numerical Ecology of Aquatic Systems
  ) ) ) ) )   Mons-Hainaut University, Belgium
( ( ( ( (
..

Sergio Della Franca wrote:
 Dear R-Helpers,
 
 
 I'd like to develop a fanny clustering on my data set(70.000 rows), but when
 i run the procedure i obtain this error:
 
 error in vector(double, lenght): too big dimension for
 the selected vector.
 
 
 How can i solve this problem?
 
 
 Thank you in advance.
 
 
 Sergio Della Franca.
 
   [[alternative HTML version deleted]]
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 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] Fanny Clustering

2007-03-29 Thread Philippe Grosjean


Sergio Della Franca wrote:
 Ok,
 
 How can i increase the memory of your computer available to R?

Well, if you would like to increase memory of MY computer... you are 
welcome to do so... but I doubt it would be of any use for you ;-)

You don't tell us how much RAM you have currently, which platform you 
use, etc... The general approach is to use a computer with more RAM, up 
to the limit permitted by a 32-bit system for R, and then, to switch to 
a 64-bit version under Linux, if you need even more RAM.

The other proposed solution is not stupid. With 70.000 cases, you have a 
fairly large dataset. You don't tell use how many groups you expect from 
your clustering, but it is often better to use a couple of tens, or 
hundreds of representative cases for each group, no more. In supervised 
classification, it is easier to build such a training set with 
relatively balanced number of items in each group, because targeted 
classification is known a priori from the manual classification provided.

With unsupervised classification, you could either try a pure random 
subsampling, or select your subsample based on similarity according to a 
given distance measurement. I did something like that using a 
Malahanobis distance, MDS, and then, stratified subsampling inside a 
regular grid placed on top of the MDS plot.

Otherwise, I am not a specialist of unsupervised classification, and 
other people here could have better suggestion.

Best,

Philippe Grosjean

 
 2007/3/29, Philippe Grosjean [EMAIL PROTECTED]:
 1) Reduce the size of your sample (random or stratified subsampling),

 2) Increase the memory of your computer available to R.

 Best,

 Philippe Grosjean

 ..°}))
 ) ) ) ) )
 ( ( ( ( (Prof. Philippe Grosjean
 ) ) ) ) )
 ( ( ( ( (Numerical Ecology of Aquatic Systems
 ) ) ) ) )   Mons-Hainaut University, Belgium
 ( ( ( ( (
 ..

 Sergio Della Franca wrote:
 Dear R-Helpers,


 I'd like to develop a fanny clustering on my data set(70.000 rows), but
 when
 i run the procedure i obtain this error:

 error in vector(double, lenght): too big dimension for
 the selected vector.


 How can i solve this problem?


 Thank you in advance.


 Sergio Della Franca.

   [[alternative HTML version deleted]]

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

 
   [[alternative HTML version deleted]]
 
 
 
 
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 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] non-linear curve fitting

2007-03-22 Thread Philippe Grosjean
Hello,

If a least-square criterion is fine for you, you should use nls(). For 
the logistic curve, you have a convenient self-starting model available: 
SSlogis(). Look at:

?nls
?SSlogis

Best,

Philippe Grosjean

..°}))
  ) ) ) ) )
( ( ( ( (Prof. Philippe Grosjean
  ) ) ) ) )
( ( ( ( (Numerical Ecology of Aquatic Systems
  ) ) ) ) )   Mons-Hainaut University, Belgium
( ( ( ( (
..

Hufkens Koen wrote:
 Hi list,
  
 I have a little curve fitting problem.
  
 I would like to fit a sigmoid curve to my data using the following equation:
  
 f(x) = 1/(1 + exp(-(x-c)*b)) (or any other form for that matter)
  
 Where x is the distance/location within the dataframe, c is the shift of the 
 curve across the dataframe and b is the steepness of the curve.
  
 I've been playing with glm() and glm.fit() but without any luck.
  
 for example the most simple example
  
 x = -10:10
 y = 1/(1 + exp(-x))
 glm(y ~ x, family=binomial(link=logit))
  
 I get a warning:
 non-integer #successes in a binomial glm! in: eval(expr, envir, enclos) 
  
 and some erratic results
  
 This is the most simple test to see if I could fit a curve to this perfect 
 data so since this didn't work out, bringing in the extra parameters is a 
 whole other ballgame so could someone give me a clue?
  
 Kind regards,
 Koen
  


__
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] listing all functions in R

2007-01-15 Thread Philippe Grosjean
Hello,

First, regarding GeSHi syntax highlighting for R, I have done one for
the R Wiki (plus the R function that generates the list of keywords
automatically). I will attach it to a second email send privately to
you, since the mailing list do not accept attachments.

For the problem of keeping web pages up-to-date with R code, I am also
considering this problem with the R Wiki. Although I still do not have a
completely working solution, the approach is similar to Sweave. I have a
function which extracts the R code from wiki pages (that is, it
'Stangles' the wiki page, in the Sweave terminology). I can get, thus,
the R code from all wiki pages in turn, test them and write a report
with a couple of R code lines. Here is are my functions:

getWikiRcode - function(wikipage, url = http://wiki.r-project.org/rwiki;,
strip.empty.lines = TRUE, strip.output = FALSE) {
# Read the raw wiki page
Url - paste(url, /doku.php?id=, wikipage, do=export_raw, sep =)
Raw - readLines(Url)

# Get only code r  /code chunks from this page
Codestart - grep(^\\s*code, Raw)
Codeend - grep(^\\s*/code, Raw)
# A little bit of checking first
if (length(Codestart) != length(Codeend) || any(Codeend = Codestart))
stop(Malformed wiki page (wrong code... /code sections))  
# Get only r code sections (those starting with code r from the list
Rstart - grep(^\\s*code r, Raw)
if (length(Rstart) == 0) return(character(0))   # no R code in this page
isRsection - Codestart %in% Rstart
Rend - Codeend[isRsection]

# Construct the list of text lines related to r code
R - data.frame(Start = Rstart, End = Rend)
Seq - function(x) seq(from = x[1], to = x[2])
Rrows - c(apply(R, 1, Seq), recursive = TRUE)
Rcode - Raw[Rrows]

# Eliminate code r and /code tags
Rcode - gsub(^\\s*/?code( r)?.*$, , Rcode)

# Eliminate prompt from R code ' ', or '+ ' at the begining of a line
Rcode - sub(^[+] , , Rcode)

# Possibly eliminate empty lines
if (strip.empty.lines) Rcode - Rcode[Rcode != ]

# Possibly eliminate output (lines starting with '#!')
if (strip.output) {
Routput - grep(^\\#\\!, Rcode)
if (length(Routput)  0) Rcode - Rcode[-Routput]
}

# Return the R code
return(Rcode)
}

rcode - getWikiRcode(tips:data-frames:merge)
rcode

sourceWikiRcode - function(wikipage, echo = TRUE, url =
http://wiki.r-project.org/rwiki;,
strip.empty.lines = TRUE, strip.output = FALSE, ...) {
# Call getWikiRcode() to extract r code from wiki pages
Rcode - getWikiRcode(wikipage = wikipage, url = url,
strip.empty.lines = strip.empty.lines, strip.output = 
strip.output)
if (length(Rcode) == 0) {
warning(No r code in this page!)
} else {
Con - textConnection(Rcode)
source(Con, echo = echo, ...)
close(Con)
}
}

sourceWikiRcode(tips:data-frames:merge)
# Here, the last part of this page is not directly executable (data1 is
not defined)
# but the rest is fine!

This is suboptimal, and I am considering rewriting it in PHP to return R
code only from the wiki server.

Best,

Philippe Grosjean

Gavin Simpson wrote:
 On Sat, 2007-01-06 at 10:58 -0500, Gabor Grothendieck wrote:
 The arguments to the functions can differ too even if they
 exist on multiple platforms.   system() on Windows has the
 input= argument but not on UNIX.
 
 That's a good point Gabor, and one I hadn't considered as yet. As I'm
 only just setting out on the road to providing R help resources for the
 wider world (rather than the limited environs of the courses I have
 run), I tend to not have thought about these things much - though I
 guess I have a few gotchas waiting to bite me in the ass before too
 long.
 
 I am just starting to think about the best way to organise the snippets
 of code to allow me to keep them up-to-date with current R and changes
 in package code that the snippets use. Dropping the code verbatim into
 PHP scripts isn't a good idea. At the moment I intend to store all
 snippets in individual *.R files and read them into to variables within
 the PHP scripts, from where they will be highlighted and formatted for
 display.
 
 It would be reasonably easy to write an R script to source all *.R files
 in a directory to look for errors and problems. And having them all as
 separate files means I can still use Emacs/ESS to prepare, format, and
 run the code through R, which is my preferred environment.
 
 All the best,
 
 G
 
 On 1/6/07, Duncan Murdoch [EMAIL PROTECTED] wrote:
 On 1/6/2007 9:25 AM, Gavin Simpson wrote:
 On Sat, 2007-01-06 at 13:48 +, Prof Brian Ripley wrote:
 Could you tell us what you mean by
 Thank you for your reply, Prof

[R] How to detect if R is running on Mac OS X?

2007-01-14 Thread Philippe Grosjean
This question is probably trivial, but I don't find the answer. I have 
code that is different for Windows, Unix/Linux and Mac OSX. The man page 
of .Platform tells that .Platform$OS.type is the right way to test for 
it... but it also tels that it returns either windows or unix. Is 
Mac OS X reported as unix? If yes, how do I make the difference?
Thanks,

Philippe Grosjean

__
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] A question about R environment

2007-01-08 Thread Philippe Grosjean
Please, don't reinvent the wheel: putting functions in a dedicated 
environment is one of the things done by R packages (together with a 
good documentation of the function, and making them easily installable 
on any R implementation). So, this is probably the time for you to read 
the Writing R extensions manual, and to start implementing your own R 
package!
Best,

Philippe Grosjean

François Pinard wrote:
 [Tong Wang]
 
 I created environment mytoolbox by : mytoolbox - 
 new.env(parent=baseenv()).  Is there anyway I put it in the search 
 path?  In a project, I often write some small functions, and load them 
 into my workspace directly, so when I list the objects with ls(), it 
 looks pretty messy.  So I am wondering if it is possible to creat an 
 environment, and put these tools into this environment.  For example, 
 I have functions fun1(), fun2() ... and creat an environment mytoolbox 
 which contains all these functions.  And it should be somewhere in the 
 search path:  .GlobalEnv mytoolbox package:methods.
 
 Here is a trick, shown as a fairly simplified copy of my ~/.Rprofile.  
 It allows for a few simple functions always available, yet without 
 having to create a package, and leaving ls() and any later .RData file 
 unencumbered.
 
 The idea is to use local() to prevent any unwanted clutter to leak out 
 (my real ~/.Rprofile holds more than shown below and use temporary 
 variables), to initialise a list meant to hold a bunch of functions or 
 other R things, and to save that list on the search path.
 
 This example also demonstrate a few useful functions for when I read the 
 R mailing list.  I often need to transfer part of emails containing
 code excerpts within the window where R executes, while removing 
 quotation marks, white lines and other noise.  I merely highlight-select 
 part of the message with the mouse, and then, within R, do things like:
 
xs()   source the highlighted region
xd()   read in a data.frame
xm()   read in a matrix
xe()   evaluate and print an expression
xv()   read a list of values as a vector
 
 The list above in decreasing order of usefulness (for me).  Except for 
 xs(), which has no automatic printout, you may either let the others 
 print what they got, or assign their value to some variable.  Arguments 
 are also possible, for example like this:
 
xd(T)  read in a data.frame when the first line holds column names
 
 
 
 if (interactive()) {
 local({
 
 fp.etc - list()
 
 fp.etc$xsel.vector - function (...) {
 connexion - textConnection(xselection())
 on.exit(close(connexion))
 scan(connexion, ...)
 }
 fp.etc$xsel.dataframe - function (...) {
 connexion - textConnection(xselection())
 on.exit(close(connexion))
 read.table(connexion, ...)
 }
 fp.etc$xsel.matrix - function (...) {
 connexion - textConnection(xselection())
 on.exit(close(connexion))
 data.matrix(read.table(connexion, ...))
 }
 fp.etc$xsel.eval - function (...) {
 connexion - textConnection(xselection())
 on.exit(close(connexion))
 eval(parse(connexion, ...))
 }
 fp.etc$xsel.source - function (...) {
 connexion - textConnection(xselection())
 on.exit(close(connexion))
 source(connexion, ...)
 }
 
 fp.etc$xselection - function ()
 {
 lignes - suppressWarnings(readLines('clipboard'))
 lignes - lignes[lignes != '']
 stopifnot(length(lignes) != 0)
 marge - substr(lignes, 1, 1)
 while (all(marge %in% c('', '+', ':', '|'))
   || all(marge == ' ')) {
 lignes - substring(lignes, 2)
 marge - substr(lignes, 1, 1)
 }
 lignes
 }
 
 fp.etc$xv - fp.etc$xsel.vector
 fp.etc$xd - fp.etc$xsel.dataframe
 fp.etc$xm - fp.etc$xsel.matrix
 fp.etc$xe - fp.etc$xsel.eval
 fp.etc$xs - fp.etc$xsel.source
 
 attach(fp.etc, warn=FALSE)
 
 })
 }
 
 # vim: ft=r
 


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


Re: [R] nonlinear quantile regression

2006-12-03 Thread Philippe Grosjean
You must specify starting conditions.

PhG

Ricardo Bessa wrote:
 Hello, I’m with a problem in using nonlinear quantile regression, the 
 function nlrq.
 I want to do a quantile regression o nonlinear function in the form 
 a*log(x)-b, the coefficients “a” and “b” is my objective. I try to use the 
 command:
 
 funx - function(x,a,b){
 res - a*log(x)-b
 res
 }
 
 Dat.nlrq - nlrq(y ~ funx(x, a, b), data=Dat, tau=0.25, trace=TRUE)
 
 But a can’t solve de problem, How I put the formula “y ~ funx(x,a,b)”?
 
 _
 MSN Busca: fácil, rápido, direto ao ponto.  http://search.msn.com.br
 
 __
 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] Colour-coded Editor for R Code

2006-11-06 Thread Philippe Grosjean
Hello,

You have a rather large list of editor that support R syntax 
highlighting listed in: http://www.sciviews.org/_rgui/projects/Editors.html.
Best,

Philippe Grosjean

Dan Bebber wrote:
 Jon,
 
 are you using Windows? If so, try WinEdt with library(RWinEdt).
 It has all the features you want and need.
 
 For Linux/Unix use EMACS.
 
 There is a section on CRAN about editors.
 
 Cheers,
 Dan Bebber
 
 Department of Plant Sciences
 University of Oxford
 
 __
 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] Progress Monitor in R / looping

2006-10-25 Thread Philippe Grosjean
This question is regularly asked. Have a look at progress() in svMisc() 
package (SciViews bundle).
Best,

Philippe Grosjean

Barry Rowlingson wrote:
 Xiaofan Cao wrote:
 Hi there,

 I'm writing a program in R that has a few nested loops. I'd like to 
 monitor the progress when the program is running and be able to estimate 
 the remaining time.
 
   A long time ago I started writing some code to give R something like 
 an 'iterator' object. You could do this:
 
ml=loop(5)
 
while(iterate(ml))
   + {cat(doing ,iteration(ml), of ,N(ml),\n,Ending at 
 ,predictEnd(ml),\n);sleep(5)}
 
 doing  1  of  5
   Ending at  Wed 25 Oct 2006 11:00:05 BST
 doing  2  of  5
   Ending at  Wed 25 Oct 2006 11:00:20 BST
 doing  3  of  5
   Ending at  Wed 25 Oct 2006 11:00:20 BST
 doing  4  of  5
   Ending at  Wed 25 Oct 2006 11:00:20 BST
 doing  5  of  5
   Ending at  Wed 25 Oct 2006 11:00:20 BST
 
   you use loop(N) to construct a 1:N loop object, while(iterate(ml)) to 
 loop round it, iteration(ml) to get the current iteration number, N(ml) 
 to get the iteration limit, and predictEnd(ml) to guess when the whole 
 thing will finish.
 
   All the information about the loop is encapsulated in the ml object.
 
   It needs a chunk of polishing up and nobody seemed that interested in 
 it last time I mentioned it. My particular application was to MCMC, 
 where you could have an MCMC iterator object that was a subclass of my 
 simple loop class, and then you could have methods like if(isBurnIn(ml)) 
 to decide when to start taking samples, or if(!isThinned(ml)) to decide 
 whether to store a sample from a thinned chain. Again, all the info 
 encapsulated in the loop object.
 
   Another advantage is that unlike for(i in 1:1000) it doesn't 
 create a vector of 1000 objects...
 
   If anyone thinks this is worth me working on then I'll try and find 
 some spare time (hah!) to fix it up. Or if anyone wants to take over, I 
 can throw my code at you at see if it sticks.
 
 Barry
 
 __
 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] ts vs zoo

2006-10-12 Thread Philippe Grosjean


Schweitzer, Markus wrote:
 Hello,

 I have lots of data in zoo format and would like to do some time
 series analysis. (using library(zoo), library(ts) )

 My data is usually from one year, and I try for example  stl() to find
 some seasonalities or trends.

 I have now accepted, that I might have to convert my series into ts()
 but still I am not able to execute the comand since stl() is not
 satisfied

 x-zoo(rnorm(365), as.Date(2005-01-01):as.Date(2005-12-31))
 x-as.ts(x)
 #x-as.ts(x, frequency=12)  #this has no effect frequency is not taken
 stl(x)
 Fehler in stl(x) : series is not periodic or has less than two periods

Please, read the error message carefully: ... has less than two 
periods... And you say you have series of one year. stl() cannot be used 
with so short series.

Otherwise, you must take care to define the time unit as year for using 
stl(), since it assumes that the periodic signal it extracts is of 
frequence one.

Best,

Philippe Grosjean

 I googled for an answer but I couldn t find any. Is it really
 necessary to transform my zoo objects to ts? how can I fix the
 frequency-problem.
 I hope you can help me.

 Thank you very much in advance and best regards,

 Markus

 
   [[alternative HTML version deleted]]
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 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] ts vs zoo

2006-10-12 Thread Philippe Grosjean


Schweitzer, Markus wrote:
 thank you very much for the information.
 
 I guess I should have been more clear here.
 I was looking for the monthly or weekly trends within this one year
 period.

Then, always keep in mind that stl() is looking for periodic component 
of a frequency = 1. This means you have to define the time unit so that 
you catch it. For monthly periodic component, use month as time unit. 
For weekly periodic component, use week as time unit. You must convert 
your data accordingly. Also keep in mind that stl() decomposes your 
series into a general trend, a periodic trend of frenquency 1, and 
noise, using an ADDITIVE model. So, if the components are 
multiplicative, you should use a different model.

Otherwise, there is much more than stl() in R! In particular, you could 
look at any significant periodic component in your series by using 
spectrum(), for instance... still considering that your series is long 
enough, which is probably the case for looking at weekly periodic 
signals on a one-year long series.

Best,

Philippe Grosjean

 to get there I now only took the zoo object x and made
 
 
 x-as.ts(x)
 x-ts(x, frequency=7) #to get 52 weeks(Periods) with 7 days each
 
 - to get 12 periods e.g. months with 29,30 or 31 days, I guess I can
 only choose frequency=30
 
 I then can run stl
 It is just a pitty, that the labeling (jan 2005, feb 2005 ..) has
 gone.
 
 So thank you for your hint with barplot and rollmean
 
 best regards, markus
  
 
 -Original Message-
 From: Achim Zeileis [mailto:[EMAIL PROTECTED] 
 Sent: Donnerstag, 12. Oktober 2006 12:15
 To: Schweitzer, Markus
 Cc: R-help@stat.math.ethz.ch
 Subject: Re: [R] ts vs zoo
 
 Markus,
 
 several comments:
 
 I have lots of data in zoo format and would like to do some time 
 series analysis. (using library(zoo), library(ts) )
 
 The ts package has been integrated into the stats package for a long
 time now...
 
 My data is usually from one year, and I try for example  stl() to 
 find some seasonalities or trends.
 
 As pointed out by Philippe, this is not what STL is made for. In STL you
 try to find seasonality patterns by loess smoothing the seasonality of
 subsequent years. If you have observations from just one year, there is
 just one seasonality pattern (at least if you look for monthly or
 quaterly patterns).
 
 I have now accepted, that I might have to convert my series into ts
 () but still I am not able to execute the comand since stl() is not 
 satisfied
 
 And there are reasons for this: you need to have a regular time series
 with a certain frequency so that STL is applicable. (One could argue
 that ts is not the only format for regular time series but typically
 you can easily coerce back and forth between ts and zoo/zooreg.
 
 x-zoo(rnorm(365), as.Date(2005-01-01):as.Date(2005-12-31))
 
 I don't think that this is what you want. Look at time(x). I guess you
 mean
   x - zoo(rnorm(365), seq(from = as.Date(2005-01-01),
 to = as.Date(2005-12-31), by = 1 day))
 
 x-as.ts(x)
 #x-as.ts(x, frequency=12)  #this has no effect frequency is not
 
 Here, it seems to me that you want to aggregate to monthly data, this
 can be done via
   x2 - aggregate(x, as.yearmon, mean)
 
 This is now (by default) a regular series with frequency 12
   frequency(x2)
 
 and hence it can be easily coereced to ts and back (with almost no
 loss of information):
   as.zoo(as.ts(x2))
 
 However, calling stl(as.ts(x2)) still complains that there are not
 enough periods because this is just a single year, i.e., only a single
 seasonality pattern. To look at this, you could do
barplot(x2)
 
 For looking at the trend you could use a simple running mean
   plot(x)
   lines(rollmean(x, 14), 2)
 or you could also use loess() or some other smoother...
 
 For more details on the zoo package, see
   vignette(zoo, package = zoo)
 
 Best,
 Z
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 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.


[R] [Fwd: Re: Block comments in R?]

2006-10-05 Thread Philippe Grosjean
Ooops! Sorry, I send it only to Uwe Ligges the first time.
Best,

Philippe Grosjean

This is perhaps another solution, more elegant in the way the block
comment is written... but it requires to redefine `!` and slows it a
little bit because it tests first its arguments before calling
.Primitive(!):

It takes advantage of `!` being not defined for character arguments:

 !2
[1] FALSE
 !some text
Error in !some text : invalid argument type

So, now, we will define it for character arguments (invisibly returns
the argument)

 `!`- function(x)
+   if (inherits(x, character) == FALSE)
+   .Primitive(!)(x) else invisible(x)


Now, `!` can be used to construct a block comment:

 A R script with block comments =

1+1 # This is a line comment

!'
This is a block comment spread
on several lines...
'

ls()

!!'
This is another block comment, possibly of higher
importance than the previous one
'
search()

!!!'
For color syntax highlighting and to better detect
the end of block comments, one may also decide to
use the same code for opening and closing the comments
like it is the present case
!!!'

!'
Note that the only constraint is to escape single quotes
in block comments (or not to use single quotes)
Of course, one could also decide to use double quotes
instead of single quotes
!'

!'
Now, it would be nice to have a little patch of .Primitive(!)
that simply displays no error message in case the argument of
`!`is a character sting. So, the hock would not be required
any more
!'

 And of the R script =

Best,

Philippe Grosjean


Uwe Ligges wrote:
 
 Robin Hankin wrote:
 On 5 Oct 2006, at 10:05, Uwe Ligges wrote:


 Wee-Jin Goh wrote:
 Hello list,

 Is there any way to perform a block comment in R? In C++, anything in
 between a /* and */ is considered a comment, and it allows
 programmers to comment out chunks of code for testing and debugging.
 Is there such a feature in R?

 This has frequently been asked on the list. Try to google for it. You
 will find answers like

 if(FALSE){
  code block
  commented
 }



 That method doesn't work for me:

 if(FALSE){

 if(12)
   print(12)
 else
   print(12)

 }
 
 
 Use an editor that comments out a whole block which is what I do all the 
 time, e.g. use Tinn-R, Emacs or WinEdt, to mention just a few of them.
 
 Or you can go ahead and use
 
 if(FALSE){
 
 if(12)
print(12)
 else
print(12)
 
 }
 
 
 or
 
 if(FALSE){'
 
 if(12)
print(12)
 else
print(12)
 
 '}
 
 
 Uwe
 
 
 returns an error.  How would I comment out that block of (incorrect) code?







 or use a good editor that supports commenting and uncommenting blocks.


 Uwe Ligges


 -- 
 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] Maximum length of R GUI input line?

2006-08-18 Thread Philippe Grosjean
You should put your SQL query in a variable, and use this variable in 
your call. Something like:

MyQuery - bla bla bla
MyQuery - paste(MyQuery, more bla bla)
# 
doMyRequest(MyQuery)

Best,

Philippe Grosjean



Eric Fegraus wrote:
 Hello,
 
 
 I'm using R 2.3.1 on Windows.
 
 I'm generating some very long SQL statements. I do this by using paste() 
 which will contain many strings and variables.  I'm getting an error when the 
 the total line length is longer than about 1013 characters.  For example, it 
 works with the line containing 1013 characters and not when it is 1059.
 
 I've looked into adjusting the options(width) and a handful of other 
 settings.   I have a feeling there is some other setting i'm missing that i 
 can adjust.
 
 Any ideas?
 
 Thanks!
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 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] classification tables

2006-08-07 Thread Philippe Grosjean

  x - c(1,2,3,4,2,3,3,1,2,3)
  y - c(2,1,3,4,1,3,3,2,2,3)
  table(x, y)
y
x   1 2 3 4
   1 0 2 0 0
   2 2 1 0 0
   3 0 0 4 0
   4 0 0 0 1
  ?table

Best,

Philippe Grosjean

..°}))
  ) ) ) ) )
( ( ( ( (Prof. Philippe Grosjean
  ) ) ) ) )
( ( ( ( (Numerical Ecology of Aquatic Systems
  ) ) ) ) )   Mons-Hainaut University, Belgium
( ( ( ( (
..

Taka Matzmoto wrote:
 Dear R-users
 
 I have two vectors. One vector includes true values and the other vector has 
 estimated values. Values are all integers from 1 to 4.
 
 For example,
 
 x - c(1,2,3,4,2,3,3,1,2,3)
 y - c(2,1,3,4,1,3,3,2,2,3)
 
 I would like to a classfication table x by y. With the table, I would like 
 to calculate what percentage is correct classfication.
 
 Which R function do I need to use for creating a 4 * 4 classification table?
 
 Thank you.
 
 Taka,
 
 __
 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] R and DDE (Dynamic Data Exchange)

2006-07-19 Thread Philippe Grosjean
Richard M. Heiberger wrote:
 I am thrilled to learn tcltk2 has DDE capability.
 It is the piece I have been needing to make ESS work directly
 with the RGUI on Windows.  GNU emacs on Windows has a ddeclient,
 but no access to COM.  So if R, or tcltk2 talking in both directions to R,
 has a ddeserver, all should be possible.  I will be reading the documentation
 closely in a few weeks to tie it together and then intend to make it happen.
 
 Do you, or any other list member, have a sense of the size, complexity, ease,
 magnitude of the task I just defined?  Any advice as I get started on it?
 
 Rich

Well, to be honest, DDE is an old exchange protocol (the first one 
proposed by M$ in Windows version 1 or 2). It is not that reliable. In 
practice, when the communication is working fine, you have no problems 
with it. But if something fails in either the server or the client, you 
got a very bad behaviour sometimes.

I think there is some interest to have DDE available for R (WinEdt uses 
DDE, I think... Uwe???), together with (D)COM, and socket server. 
Currently, I am improving the socket server build in svSocket (SciViews 
bundle) because it is the communication protocol we decided to push 
forward in Tinn-R, but there are other implementations out there. I 
think that using a socket server is more reliable and it is also a 
cross-platform solution. So, I would personnally prefer that solution.

Best,

Philippe Grosjean

__
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 and DDE (Dynamic Data Exchange)

2006-07-19 Thread Philippe Grosjean
Gabor Grothendieck wrote:
 You can access DDE via COM as in this example
 which uses DDE to open an Excel file.  Note that
 Excel also supports COM directly and normally
 one would use COM with Excel, not DDE, so you
 might check if your application also supports COM.
 
 # opens an excel spreadsheet c:\test.xls using dde
 library(RDCOMClient)
 sh - COMCreate(Shell.Application)
 sh$Namespace(C:\\)$ParseName(test.xls)$InvokeVerb(Open)

Well, I think you are really using COM here, not DDE. M$ implemented the 
same DDE commands in Excel and Word in COM to ease upgrading from DDE to 
COM... but the internal is completelly different!
Best,

Philippe Grosjean

 Also if you are going to access DDE via COM or just COM also
 check out the rcom package which is similar to RDCOMClient.
 
 On 7/17/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 
R and DDE (Dynamic Data Exchange)

Dear Rusers,
I run an application (not mine) which acts as a DDE server.
I would like to use R to get data from this application,
say once per minute, and do some processing on it.
I didn't find much info on the R DDE abilities, apart the tcltk2
package in which I will try to go deeper.
I would be very thankful for any info, pointer or advice about the
good ways to make R program get online data from a DDE server.
Thanks
Vincent

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

 
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
 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] R and DDE (Dynamic Data Exchange)

2006-07-18 Thread Philippe Grosjean
Hello Vincent,

I think there is not much else than tcltk2. It is a complete 
implementation of DDE (client/server), so it should fit your needs. 
There are lots of examples on the man page. Please, if you think it 
could be helpful for other users, do submit examples. I think real-time 
acquisition of data through DDE under Windows would interest a couple of 
users (including myself).
Best,

Philippe Grosjean

..°}))
  ) ) ) ) )
( ( ( ( (Prof. Philippe Grosjean
  ) ) ) ) )
( ( ( ( (Numerical Ecology of Aquatic Systems
  ) ) ) ) )   Mons-Hainaut University, Belgium
( ( ( ( (
..

[EMAIL PROTECTED] wrote:
 R and DDE (Dynamic Data Exchange)
 
 Dear Rusers,
 I run an application (not mine) which acts as a DDE server.
 I would like to use R to get data from this application,
 say once per minute, and do some processing on it.
 I didn't find much info on the R DDE abilities, apart the tcltk2
 package in which I will try to go deeper.
 I would be very thankful for any info, pointer or advice about the
 good ways to make R program get online data from a DDE server.
 Thanks
 Vincent
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
 


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


Re: [R] cat and positioning of the output

2006-06-29 Thread Philippe Grosjean

=?ANSI_X3.4-1968?Q?J=3Frn_Schulz?= wrote:
 Hello R users!
 
 I like to use cat in a loop. I know, loops are not the best way in R ... but
 my question: It is possible to overwrite the expression Reading row: i in
 each iteration of the loop (print out in the below loop on the screen) or
 more particulary to overwrite the counter i.

In package svMisc (SciViews bundle):

  ?progress
  example(progress)
Best,

Philippe Grosjean


 for(i in 1:header$M){
cat(Reading row: , i)
SparseIndex[[i]] - readBin( con, integer(), n=MIndexNumber[i], size=4 )
SparseSignal[[i]] - readBin( con, numeric(), n=MIndexNumber[i], size=4 )
 }
 
 Many thanks
 J?rn Schulz.

__
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] cat and positioning of the output

2006-06-29 Thread Philippe Grosjean
Dan Gunter wrote:
 =?ANSI_X3.4-1968?Q?J=3Frn_Schulz?= wrote:
 
Hello R users!

I like to use cat in a loop. I know, loops are not the best way in R ... but
my question: It is possible to overwrite the expression Reading row: i in
each iteration of the loop (print out in the below loop on the screen) or
more particulary to overwrite the counter i.

for(i in 1:header$M){
   cat(Reading row: , i)
   SparseIndex[[i]] - readBin( con, integer(), n=MIndexNumber[i], size=4 )
   SparseSignal[[i]] - readBin( con, numeric(), n=MIndexNumber[i], size=4 )
}

Many thanks
J?rn Schulz.
  
 
 On a UNIX terminal, adding '\r' will cause the cursor to go back to the 
 beginning of the same line. I can't speak for Windows.
 
 e.g.
 
 for ( i in 1:10 ) { cat(Number,i,\r); Sys.sleep(1) }; cat(\n)
 
 -Dan

It works, but I don't like much strange things that can happen with \r 
because the caret is located at the beginning of the line. Look at what 
happens if you forgot the latests 'cat(\n)'. Also, note that for RGui 
under windows, you must use flush.console(). So:

  for (i in 1:10) {
 cat(Number,i,\r)
 flush.console()
 Sys.sleep(1)
  }
  cat(\n)

does the job. The alternative is to use \b repeatedly, which is done 
in progress() indeed.
Best,

Philippe Grosjean

__
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] Continuation and parse

2006-06-28 Thread Philippe Grosjean
Well, you haven't used the search engines with the right key: the magic 
words are:

  RSiteSearch(incomplete line)

With the first document being my query (almost two years ago), and the 
second one being Peter Dalgaard answer. You must adapt it to cope with 
internationalization, but basically, you could use something like:

  grep(\n2:,try(parse(textConnection(ls))), silent = TRUE))
numeric(0)
  grep(\n2:,try(parse(textConnection(ls()), silent = TRUE))
[1] 1

Best,

Philippe Grosjean

..°}))
  ) ) ) ) )
( ( ( ( (Prof. Philippe Grosjean
  ) ) ) ) )
( ( ( ( (Numerical Ecology of Aquatic Systems
  ) ) ) ) )   Mons-Hainaut University, Belgium
( ( ( ( (
..

Jim Lemon wrote:
 Hi gurus,
 
 After an unsuccessful scrabble through the documentation and Jon's 
 excellent search facility, I am no wiser as to how R recognizes an 
 incomplete command line and politely raises its hand for more. The help 
 page for parse gives no indication that it does anything more than spit 
 the dummy when fed an incomplete command line, but something in there 
 must recognize such ellipsis. Any hints?
 
 Jim
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
 


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


Re: [R] R Reporting - PDF/HTML mature presentation quality package?

2006-06-25 Thread Philippe Grosjean
Frank E Harrell Jr wrote:
 zubin wrote:
 
Hello, searching for the key packages so i can output, Text, Tables ,and 
Graphics into a HTML or PDF report - have R create these reports in an 
easy and efficient way without LaTeX - I have searched the R pages but 
don't see any mature packages - anyone have any advice on a easy to use 
R package one can use for generating publication quality reports?  
Outputting HTML or PDF.
 
 
 Doing this without LaTeX is like doing statistical analysis without 
 linear models and the Wilcoxon test.
 

It depends the complexity of formatting and the intended use of the 
report. If required formatting is just title, bold, italic, etc. + 
tables and graphs inserted in the same page to be viewed in a web 
browser, HTML (or xHTML/CSS, to be more precise) can do a pretty good 
job (and it can do even much more). Of course, LaTeX + Sweave = PDF is 
another solution, richer in functionnalities, but more complex to 
install, especially on Windows.

Zubin, you ask for mature package. You should look at R2HTML + svViews 
(from the SciViews bundle) that work hand in hand to generate chunks of 
xHTML/CSS elements from R objects (the so called, views), or complete 
HTML page collecting together several of these views (reports). 
Depending on the degree of maturity that is acceptable for you, you 
should perhaps plan a beta test and expect some code adaptation, as it 
is usual with any R package that is not intensively used.

If you prefer dynamic reports, there are many approaches, but I tend to 
consider Rpad (also on CRAN) as one of the better solution out there. 
Note that it also uses R2HTML for R objects formatting, although Tom 
Short customized some of the R2HTML functions for a better use in Rpad. 
You should probably also customize and/or contribute to the development 
of R2HTML if you want a solution that best fits your own needs in any case.

Best,

Philippe Grosjean

__
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 Reporting - PDF/HTML mature presentation quality package?

2006-06-25 Thread Philippe Grosjean
Jim Lemon wrote:
 I heartily second Phillipe's response. I just started a new job and the 
 first thing required was a neat stats report for a dataset. I thought I 
 would give R2HTML a try and about 5 minutes after downloading it, I was 
 looking at the first draft of the report. I did have to do a bit of 
 hacking on the graphics, but it was easy and I can now present the 
 report first thing in the morning. Had I not been able to do this, I 
 probably would have been told, You'll have to use SPSS.
 
 I was so impressed by R2HTML that I began writing a primitive HTML 
 generator that will scan an R script and do something like R2HTML. I 
 couldn't find anything like this as the svMisc package seems to have 
 disappeared.

No, it is still in the SciViews bundle. Tell me if you have problems 
with it.
Best,

Philippe Grosjean

If anyone knows of something like this or is working on it,
 I'd appreciate knowing about it.
 
 Jim
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
 


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


[R] R Wiki - official launch!

2006-06-18 Thread Philippe Grosjean
Hello all,

We are pleased to announce the official launch of the R Wiki at 
http://wiki.r-project.org. Although there are already many sources of R 
documentation, this R Wiki is a complementary tool, in the sense that 
users become R documentation authors, a little bit like users become 
developers for R code.

=
The main sections are:

- Getting Started: dedicated to very R beginners,

- Guides: a section for books, tutorials and demos in Wiki format,

- Tips: this is a large section with many small tipstricks, initially 
based on the excellent Paul Johnson's Rtips 
(http://pj.freefaculty.org/R/Rtips.html),

- Links: users can contribute links about R here,

- R Graph Gallery: an addition to discuss graphs in the Romain François' 
R Graph Gallery site (http://addictedtor.free.fr/graphiques/index.php),

- R packages: packages authors/maintainers are free to add related 
material; R package users can also contribute package-specific material 
here.

- R documentation: the wiki version of all R documentation (wikified 
Rd files), with the possibility for everybody to comment, add examples 
or anything else useful. Note that there are still some little 
formatting and navigation problems here, but they will be solved soon 
(do not report bugs yet, please!)

- Users: sections where R users can create their own public page. It is 
also the place where everybody can comment on R events, like useR!2006 
(see http://wiki.r-project.org/rwiki/doku.php?id=users:user-2006)

- Wiki and playground: sections to learn how to write wiki pages and to 
exercise.


As a R documentation reader, you could be interested by the additional 
information in the R Wiki. To be informed of new items added to the R 
Wiki, you have RSS feed available (see 
http://wiki.r-project.org/rwiki/doku.php?id=wiki:usage)

If you have something interesting to share with other R users, this is 
the place to publish it. Here, you will receive the support of other 
people to enhance and keep your document up-to-date with the rapidly 
evolving R. Here are a couple of suggested uses:

1) If you feel there is an interesting thread on this R-Help mailing 
list, summarize and illustrate it in the right subsection of 'Tips'. 
That way, one could answer Please, visit Wiki page  for further 
similar questions on the mailing list. The rich-formatted presentation 
of a R Wiki page is much easier to read that a mailing list thread in 
the archives,

2) Contribute to the official R documentation by adding material at the 
end of the wikified man pages in the R documentation section. Most 
valuable addition will eventually flow into to official documentation in 
subsequent R versions.

3) As a package author/maintainer, allow users to contribute various 
material (examples, comments, tutorials, ...) by creating a Wiki page 
dedicated to your package, and by adding its link in the 'URL' section 
of your description file.

4) Add a link to your own R-related web site in the 'Links' section.

5) Consider to publish your R tutorial / demo / course / book in the 
Guides section. The main advantage to publish it on the Wiki is the 
possibility to get help from your readers to keep this material updated 
(most of such contributed documents, including those on CRAN, are *not* 
regularly updated, if published elsewhere and if you do not revise them 
yourself regularly, that is, every six months!)

6) Start a page in the 'Users' section to share material under development.

7) As a R beginner, share your experience with other beginners in the 
'Getting started' section.

8) For a little bit more fun, participate, or propose a new challenge. 
A challenge consists in solving a problem with optimized R code 
(optimization for speed is easy to quantify, but do not forgot to 
improve readability and style of your code!). We would like to advertise 
R Wiki challenges from time to time on this mailing list. No prize 
here,... just the satisfaction to have written the better code to solve 
a given problem.

There are numerous other ways to use the R Wiki. Browse it to discover 
how useful it can be for you.

There is also a mailing list dedicated to R Wiki developments: 
R-SIG-WIKI (https://stat.ethz.ch/mailman/listinfo/r-sig-wiki).

On behalf of the R Wiki creators,

Philippe Grosjean
-- 
..°}))
  ) ) ) ) )
( ( ( ( (Prof. Philippe Grosjean
  ) ) ) ) )
( ( ( ( (Numerical Ecology of Aquatic Systems
  ) ) ) ) )   Mons-Hainaut University, Mons, Belgium
( ( ( ( (web:   http://www.umh.ac.be/~econum
  ) ) ) ) )  http://www.sciviews.org
( ( ( ( (
..

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

Re: [R] Functions starting with underscores

2006-06-05 Thread Philippe Grosjean
It is not allowed to start a variable name with an underscore. So, you 
must use ` to call this non-conventional name:

  '_foo' - function(x) 1
  attr('_foo', 'bar') - 'pow'
Error: target of assignment expands to non-language object
  attr(`_foo`, 'bar') - 'pow'
  '_foo'
[1] _foo
  `_foo`
function(x) 1
attr(,bar)
[1] pow
 

Best,

Philippe Grosjean


Joseph Wang wrote:
 I'm having problems with functions starting with underscores
 
 '_foo' - function(x) {1}
 
 seems to work
 
 but I can't assign an attribute to this function
 
 attr('_foo', 'bar') - 'pow'
 
 Any way of doing this?  This is for a C++ - R wrapping system so I'd like to 
 keep the C++ names which start with underscores.
 
 (please cc: responses to me personally)
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
 


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


Re: [R] SciViews and R-2.3.0; does it work yet?

2006-05-08 Thread Philippe Grosjean
David Foreman wrote:
 Following upgrading to R-2.3.0 SciViews generates 2 warning messages (I 
 suspect 1 for each dock) saying 'null environment deprecated', and the R 
 Commander menu simply returns a 'file-name not found' error.  I've had 
 to go back to 2.2.1 for the moment (where everything works fine), hence 
 relying on my memory for the error messages.  Do I need to wait for a 
 SciViews upgrade, or is it something else?

Yes, I need to fix these problems before that SciViews-R is fully 
compatible with R 2.3.0. I'll do it as soon as possible, which means: 
not before then end of June, as I don't have much free time for now.
Best,

Philippe Grosjean

__
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 pour débutant

2006-05-05 Thread Philippe Grosjean
Hello,

You send this email to a miling list where language is English. Please, 
read the posting guide.

Bon, je vais vous répondre en français cette fois (mais je ne sais pas à 
  QUI ce mail est réellement adressé)!

Vous trouverez des documents d'introduction à R en français dans la 
section documentation  contributed du site http://cran.r-project.org. 
Vous y trouverez trois très bon documents d'introduction à R par 
Emmanuel Paradis, Yves Brostaux et Vincent Goulet. Tous trois sont de 
très bon niveau, mais le dernier est le plus récent. Donc, il est plus à 
jour par rapport à la version actuelle de R.
Bien à vous,

Philippe Grosjean

..°}))
  ) ) ) ) )
( ( ( ( (Prof. Philippe Grosjean
  ) ) ) ) )
( ( ( ( (Numerical Ecology of Aquatic Systems
  ) ) ) ) )   Mons-Hainaut University, Belgium
( ( ( ( (
..

Denis POIGNONEC wrote:
 Bonjour,
 
 Je suis actuellement doctorant (en fin de thèse) et je vais avoir besoin de me
 servir de R.
 
 Devant apprendre R tout seul, je suis tombé sur un mail de vous disant que 
 vous
 aviez réaliser un tutorial sur ce logiciel pour des 100% débutant comme moi
 
 J'aurai essentiellement à utiliser des algo de clustering (SOM ou Nuée dyna) 
 sur
 des matrices pouvant faire 41x230
 
 Cependant je n'ai pas réussi à télécharger ce tutoriel. Le lien founi ne 
 semble
 plus être actif. Vous serez t il possible de m'envoyer en copie ce document ou
 bien tout autre document ou lien susceptible de faciliter cet apprentissage ?
 
 Pour être honnête, je n'étais pas sensé avoir à utiliser ce logiciel, mais 
 pour
 quelques raison d'encadrement', je me retrouve à 3 mois de la fin de ma 
 thèse
 à commencer a analyser mes données. Par conséquent, tout conseil, remarque ou
 aide sera vraiment la bienvenue
 
 Je vous remercie sincèrement par avance
 
 Denis
 
 
 __
 Denis POIGNONEC
 http://denis.poignonec.free.fr
 
 IRD CoRéUs
 BP A5
 98848 Nouméa Cedex
 Nouvelle Calédonie
 mob: +(687) 92.09.17
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
 


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


Re: [R] Rcmdr problem - SciViews R

2006-05-02 Thread Philippe Grosjean
Dear Saschin,
As John told you, you should better make sure that Rcmdr works fine with 
  R. I have seen a similar message once. It was due to missing libraries 
required by Rcmdr that could not be installed for some obscure reasons 
under SciViews-R. Once all required libraries were installed manually 
under R, everything worked fine. I was indeed not able to spot the 
problem, but at least, I found a solution. Look at all required 
libraries for Rcmdr in his DESCRIPTION file, and install them manually 
(Packages - Install package(s)...).
Best,

Philippe Grosjean

John Fox wrote:
 Dear Saschin,
 
 Does the Rcmdr package load properly from the standard R for Windows SDI
 console?
 
 BTW, the reinstall of the Rcmdr package didn't go through (see your listing)
 because the package was apparently already loaded.
 
 Regards,
  John
 
 
 John Fox
 Department of Sociology
 McMaster University
 Hamilton, Ontario
 Canada L8S 4M4
 905-525-9140x23604
 http://socserv.mcmaster.ca/jfox 
  
 
 
-Original Message-
From: [EMAIL PROTECTED] 
[mailto:[EMAIL PROTECTED] On Behalf Of Sachin J
Sent: Tuesday, May 02, 2006 8:46 AM
To: R-help@stat.math.ethz.ch
Subject: [R] Rcmdr problem - SciViews R

Hi,
   
  I am getting following error messages while using SciViews 
R. It displays a message saying: Package or Bundle Rcmdr was 
not found in C:\Software\R-22.1.1\Library would you like to 
install now?.  However the Rcmdr package is there in the 
library. I reinstalled Rcmdr  but still gives me same error 
message every time I try to use one of the GUI functions.  
Any pointers would be of great help.
   
  ERROR: 
   
  Loading required package: datasets
Loading required package: utils
Loading required package: grDevices
Loading required package: graphics
Loading required package: stats
Loading required package: methods
Loading required package: tcltk
Loading Tcl/Tk interface ... done
Loading required package: R2HTML
Loading required package: svMisc
Loading required package: svIO
Loading required package: svViews
Loading required package: Rcmdr
Loading required package: car
Error in .Tcl.args.objv(...) : argument default is missing, 
with no default
Error: .onLoad failed in 'loadNamespace' for 'Rcmdr'
  trying URL 'http://www.sciviews.org/SciViews-R/Rcmdr_1.1-2.zip'
Content type 'application/zip' length 788628 bytes opened URL 
downloaded 770Kb
  package 'Rcmdr' successfully unpacked and MD5 sums checked
Warning: cannot remove prior installation of package 'Rcmdr'
  The downloaded packages are in
C:\Documents and Settings\Local 
settings\Temp\Rtmp2g5Kpb\downloaded_packages
updating HTML package descriptions
Loading required package: Rcmdr
Error in .Tcl.args.objv(...) : argument default is missing, 
with no default
Error: .onLoad failed in 'loadNamespace' for 'Rcmdr'
Error in .Tcl.args.objv(...) : argument default is missing, 
with no default
Error: .onLoad failed in 'loadNamespace' for 'Rcmdr'
   
  TIA.
  Sachin



  
-

  [[alternative HTML version deleted]]

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


__
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] Rcmdr problem - SciViews R

2006-05-02 Thread Philippe Grosjean
John Fox wrote:
 Dear Philippe and Sachin,
 
 The only packages that Rcmdr absolutely needs are tcltk and car; if other
 packages (with the exception of rgl) are missing, then it will offer to
 install them, so a manual install shouldn't be necessary.

That works fine under R, but as I said, for obscure reasons, it 
sometimes fails under SciViews-R.

PhG

Another possible
 source of problems, apparently, can be a saved workspace that is
 automatically reloaded when R starts up.
 
 Regards,
  John
 
 
 John Fox
 Department of Sociology
 McMaster University
 Hamilton, Ontario
 Canada L8S 4M4
 905-525-9140x23604
 http://socserv.mcmaster.ca/jfox 
  
 
 
-Original Message-
From: [EMAIL PROTECTED] 
[mailto:[EMAIL PROTECTED] On Behalf Of 
Philippe Grosjean
Sent: Tuesday, May 02, 2006 3:43 PM
To: John Fox
Cc: R-help@stat.math.ethz.ch
Subject: Re: [R] Rcmdr problem - SciViews R

Dear Saschin,
As John told you, you should better make sure that Rcmdr 
works fine with
  R. I have seen a similar message once. It was due to 
missing libraries required by Rcmdr that could not be 
installed for some obscure reasons under SciViews-R. Once all 
required libraries were installed manually under R, 
everything worked fine. I was indeed not able to spot the 
problem, but at least, I found a solution. Look at all 
required libraries for Rcmdr in his DESCRIPTION file, and 
install them manually (Packages - Install package(s)...).
Best,

Philippe Grosjean

John Fox wrote:

Dear Saschin,

Does the Rcmdr package load properly from the standard R 

for Windows 

SDI console?

BTW, the reinstall of the Rcmdr package didn't go through (see your 
listing) because the package was apparently already loaded.

Regards,
 John


John Fox
Department of Sociology
McMaster University
Hamilton, Ontario
Canada L8S 4M4
905-525-9140x23604
http://socserv.mcmaster.ca/jfox




-Original Message-
From: [EMAIL PROTECTED] 
[mailto:[EMAIL PROTECTED] On Behalf Of Sachin J
Sent: Tuesday, May 02, 2006 8:46 AM
To: R-help@stat.math.ethz.ch
Subject: [R] Rcmdr problem - SciViews R

Hi,
  
 I am getting following error messages while using SciViews R. It 
displays a message saying: Package or Bundle Rcmdr was not found in 
C:\Software\R-22.1.1\Library would you like to install 

now?.  However 

the Rcmdr package is there in the library. I reinstalled Rcmdr  but 
still gives me same error message every time I try to use 

one of the 

GUI functions.
Any pointers would be of great help.
  
 ERROR: 
  
 Loading required package: datasets
Loading required package: utils
Loading required package: grDevices
Loading required package: graphics
Loading required package: stats
Loading required package: methods
Loading required package: tcltk
Loading Tcl/Tk interface ... done
Loading required package: R2HTML
Loading required package: svMisc
Loading required package: svIO
Loading required package: svViews
Loading required package: Rcmdr
Loading required package: car
Error in .Tcl.args.objv(...) : argument default is 

missing, with no 

default
Error: .onLoad failed in 'loadNamespace' for 'Rcmdr'
 trying URL 'http://www.sciviews.org/SciViews-R/Rcmdr_1.1-2.zip'
Content type 'application/zip' length 788628 bytes opened URL 
downloaded 770Kb
 package 'Rcmdr' successfully unpacked and MD5 sums checked
Warning: cannot remove prior installation of package 'Rcmdr'
 The downloaded packages are in
   C:\Documents and Settings\Local 
settings\Temp\Rtmp2g5Kpb\downloaded_packages
updating HTML package descriptions
Loading required package: Rcmdr
Error in .Tcl.args.objv(...) : argument default is 

missing, with no 

default
Error: .onLoad failed in 'loadNamespace' for 'Rcmdr'
Error in .Tcl.args.objv(...) : argument default is 

missing, with no 

default
Error: .onLoad failed in 'loadNamespace' for 'Rcmdr'
  
 TIA.
 Sachin




-

[[alternative HTML version deleted]]

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




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


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


Re: [R] www.r-project.org

2006-04-25 Thread Philippe Grosjean
Romain,
The R Web site is working fine. Even if it is not relifted from a long 
time, it is functional. So, this is the point... and it should remain, 
at least, as functional as it is.

One aspect that could be easily relooked is the CSS file. I would 
definitely be in favor of a more styled CSS. I mean, there are now new 
fonts around that are designed to be more readable than Times, Helvetica 
and Courrier on the screen, and equally fine on the printed material. 
With CSS, it is always possible to define several fonts for one style, 
so that the style degrades nicely in case of missing fonts. So, such 
kind of change is safe, even for very old computers.

It would be wonderful if we could get a more actual CSS file for R doc, 
for the Web site, and I would use the same for the R Wiki. That way, we 
will got homogeneity in the presentation.

So, I definitely encourage you for (microchirurgical) propositions to 
actualize the presentation of the R Web site, and I will follow the 
decision of the R Core Team on this topic to make the R Wiki looking 
similar.

Best,

Philippe Grosjean

Romain Francois wrote:
 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


__
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-25 Thread Philippe Grosjean
OK, I try...
What do you think about the fonts and styles of titles versus text in... 
http://wiki.r-project.org?

This is obviously in the line of: would we change the styles in the CSS 
file (while we are replacing frames with appropriate styles too)?

May be am I a little confused. Normal. After 14 hours continuous 
programming on R, I think that everybody starts to present serious 
troubles :-(

OK... back to work. I still have 3 or 4 hours to finish this $¤!§çà 
program...

Philippe Grosjean

Jonathan Baron wrote:
 I volunteer to attempt this, but only after I get my grades in
 (May 8).  If it gets done by someone else before that, I'll be
 happy.
 
 Don't worry.  It won't look like my personal page, or even my R
 page.  But I do know quite a bit about CSS.
 
 On 04/25/06 12:37, Dirk Eddelbuettel wrote:
 
On 25 April 2006 at 13:18, Jonathan Baron wrote:
| The only thing I might change is to replace the frames with some
| sort of CSS-based positioning.

Yes please!

Dirk

--
Hell, there are no rules here - we're trying to accomplish something.
  -- Thomas A. Edison
 
 
 I love this quote.  He really did say something like it.
 
 Jon

__
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] Considering port of SAS application to R

2006-04-21 Thread Philippe Grosjean
Please, read the R Data Import/Export manual provided with any version 
of R, and come back with more specific questions.

In general, R cannot deal with datasets as large as those handled by 
SAS. But this is true only when you use standard R functions, like 
read.table(), which are not written to save memory and load very large 
datasets (other aspects are optimized).

I would advise to put your data in a database and then access to it 
piece-by-piece using SQL queries. There are very little cases where you 
actually need the whole dataset in memory at once. A simple database 
system, if you just need to access those data (no complex database 
operations required) is SQLite. There is an R package to connect to such 
a database without extra software needed. Thus, very convenient.

Best,

Philippe Grosjean

..°}))
  ) ) ) ) )
( ( ( ( (Prof. Philippe Grosjean
  ) ) ) ) )
( ( ( ( (Numerical Ecology of Aquatic Systems
  ) ) ) ) )   Mons-Hainaut University, Belgium
( ( ( ( (
..

Werner Wernersen wrote:
 Hi there!
 
 I am considering to port a SAS application to R and I would like to hear your 
 opinion if you think this is possible and worthwhile. SAS is mainly used to 
 do data management and then to do some aggregations and simple computations 
 on the data and to output a modified data set. The main problem I see is the 
 size of the data file. As I have no access to SAS yet I cannot give real 
 details but the SAS data file is about 7 gigabytes large. (It's only the 
 basic SAS system without any additional modules)
 
 What do you think, would a port to R be possible with reasonable effort? Is R 
 able to handle that size of data? Or is R prepared to work together with some 
 database system?
 
 Thanks for your thoughts!
 
 Best regards,
   Werner
 
   
 -
 
   [[alternative HTML version deleted]]
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
 


__
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] cat(), Rgui, and support for carriage return \r...

2006-03-29 Thread Philippe Grosjean
Prof Brian Ripley wrote:
 On Tue, 28 Mar 2006, Duncan Murdoch wrote:
 
 
On 3/28/2006 11:00 AM, Prof Brian Ripley wrote:

Rgui now supports \r in the same way as rterm.

I notice that there's a slight change to the colour scheme:  now the prompt 
 is in foreground colour, rather than user colour.  This might make sense 
(it's printed by the system, after all), but it looks a little strange at 
first.
 
 
 Yes, it was intentional.  The problem is that you can now do
 
 
cat(abcde\rf)
 
 
 and then the next line will be
 
 f de

Actually, there is an interest to do so with GUIs, like R Commander or 
SciViews-R (although R commander uses its own in/out window by default). 
The idea is to work with commands constructed by the GUI, and report the 
corresponding command to the console, but to flag them with a special 
prompt, telling it is different from what the user actually entered. 
Something like:
  cat(\rGUI) # Tcl-triggered instruction
would give the following prompt:
GUI
which is nice if there is a way to append a command in user color just 
after it, for instance:
  cat(ls()\n) # Also triggered by Tcl code
giving:
GUI ls()
with GUI in foreground colour and ls() in user color.
Perhaps is it not possible, or even, not desirable to get this result 
for other situations.
Best,

philippe Grosjean

 with the cursor on the 'd'.  There is no longer a left-right divide 
 between system output and user input, as you can have output to the right 
 of user input.  The previous behaviour was to mark as system output all 
 the columns up to the 'e' here, so when you started entering new input it 
 looked very odd indeed, changing colour in mid-word.
 
 I can change to making the prompt be explicitly regarded as user input, 
 which would be backwards compatible and less odd in cases like this.
 
 
Duncan Murdoch



On Sun, 19 Mar 2006, Duncan Murdoch wrote:


On 3/18/2006 2:39 PM, Duncan Murdoch wrote:

On 3/17/2006 9:44 AM, Jeffrey Racine wrote:

Hi, and thanks in advance for your time.

Background - I am working on a package and wish to have a routine's
progress reported. The routine can take some time, and I would like to
inform the user about the routine's progress. I have scoured the
archives but to no avail, so would like to solicit input from this list.

I am successfully using

cat(\rBootstrap replication , i,  of , boot.num,)
flush.console() # To flush stdout on windows systems

which works as expected on *NIX systems and using Rterm under windows.
However, under Rgui the carriage return \r is ignored, and I certainly
don't want to use the newline escape sequence \n. Under Rgui it appears
as

Bootstrap replication 1 of 399Bootstrap replication 2 of 399Bootstrap...

but I want it to function properly if at all possible.

My question is simply whether there is a portable way to implement this
so that it works regardless of the R platform the user may be working
on?

Many thanks for any/all suggestions.

I've just been looking at the source code for this.  I think it will be
relatively easy to make \r in Rgui do a destructive CR (i.e. it will
return to the start of the line, but clear any existing characters).
I'll play around a bit and then do that for R-devel.

Oops, this was a bad idea.  I did commit the change for a while, but
have reverted it now.

It seems that the help system displays help pages by writing CR LF at
the end of each line; the CR is \r, and my change above caused it to
wipe out the line it had just written.  The help pages ended up
completely blank.

I may look into supporting \r as a non-destructive CR, but that's
harder, because it means low-level changes to the console display.
Right now it only writes to the end of the text buffer; this would mean
it would sometimes write to a spot before the end.  I don't think it
would be impossible to do, but it will take more time than I have right 
now.

Duncan Murdoch

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





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


Re: [R] S-PLUS 8 beta program [repost]

2006-03-29 Thread Philippe Grosjean
This is an excellent initiative! But how can you integrate GPL code in a 
software that is not GPL? As far as I understand it, GPL is a 
contaminant license, imposing to the whole software to be GPL too (or 
providing at least similar freedom). I have no doubt that you solved 
this problem. I am just curious about the solution you found.
Best regards,

Philippe Grosjean

..°}))
  ) ) ) ) )
( ( ( ( (Prof. Philippe Grosjean
  ) ) ) ) )
( ( ( ( (Numerical Ecology of Aquatic Systems
  ) ) ) ) )   Mons-Hainaut University, Pentagone (3D08)
( ( ( ( (Academie Universitaire Wallonie-Bruxelles
  ) ) ) ) )   8, av du Champ de Mars, 7000 Mons, Belgium
( ( ( ( (
  ) ) ) ) )   phone: + 32.65.37.34.97, fax: + 32.65.37.30.54
( ( ( ( (email: [EMAIL PROTECTED]
  ) ) ) ) )
( ( ( ( (web:   http://www.umh.ac.be/~econum
  ) ) ) ) )  http://www.sciviews.org
( ( ( ( (
..

David Smith wrote:
 [Sorry about the duplicate posting; this one comes from the correct address.
 Please respond to me with any questions about this -- David.]
 
 Dear R-help readers, 
 
   As Insightful announced at the DSC2005 meeting in Seattle, the next
 release of S-PLUS will introduce a new package system. Our goal is to provide
 package authors the means to create cutting-edge statistical methods
 currently available either as R packages or as S-PLUS library sections and
 deliver them to the entire community of S-PLUS and R users.
 
   In this release of S-PLUS, we plan to implement many low-level
 utility functions with the same API as R. Just as many R functions originated
 in S-PLUS, we plan on re-implementing many R functions in S-PLUS to provide
 S-PLUS users the ability to create packages of their work and distribute them
 to others as R users have done for many years. In the future, we expect
 package authors will be able to create a single package that will run in both
 environments. The actual package system would be a port of the R package
 system code, which furthers the exchangeability of S-PLUS and R code. The
 ported code will be available in a GPL library called Rcompat
 
   To demonstrate that R packages can now be ported to S-PLUS, we have -
 with the permissions of the authors - ported several R packages to run as
 S-PLUS packages. We are planning to make these packages available for
 download from an Insightful-hosted website (called csan.insightful.com for
 consistency with the CRAN site of R packages). The license terms of the
 source packages will always be respected, and these packages will all be
 available under their original open-source license. Any improvements to
 open-source packages, whether by Insightful or by others, will remain
 open-source. Our intent will be to grow the list of open-source,
 cross-system-compatible packages over time. 
 
   While most existing R packages will not run automatically in S-PLUS,
 with some effort, a user should be able to port an existing R package to an
 S-PLUS package. More important, by using functions and interfaces now
 available in both systems, a user should be able to create a single package
 that will run in both S-PLUS and R in the future. (The judicious use of some
 system-specific if(is.R()) statement will help to this end.) As a proof of
 concept, we are developing a package that will run on both systems.  In the
 future, we hope to post this package on both CSAN and CRAN sites. We are also
 working to provide S-PLUS library sections from our research group as S-PLUS
 packages that would also work in R. 
 
   Our work on the S-PLUS package functionality is ongoing. We expect to
 begin beta testing in April. We invite R package authors who are interested
 in testing their packages in S-PLUS to participate in the beta test. As a
 beta participant, you will receive a beta version of S-PLUS that will be
 fully functional until the end of the beta period. You will also be able to
 send input to the development team regarding the S-PLUS package system. If
 you are a package author, and you are interested in participating in the beta
 test, see the full details on the S-PLUS 8 beta test and complete the
 registration form at the Insightful website:
 
 
   http://www.insightful.com/support/splus8beta/

 
   Best regards from the S-PLUS product management team,
 
   Patrick Aboyoun (S-PLUS Platform)
   Michael O'Connell (Life Sciences) 
   David Smith (Finance)
 
 --
 David M Smith [EMAIL PROTECTED]
 Senior Product Manager, Insightful Corp, Seattle WA
 Tel: +1 (206) 802 2360
 Fax: +1 (206) 283 6310
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
 


__
R-help@stat.math.ethz.ch mailing list
https

Re: [R] S-PLUS 8 beta program [repost]

2006-03-29 Thread Philippe Grosjean
David Smith wrote:
 The GPL code is available as separately-downloaded packages for S-PLUS, as
 has been done for many years. My own Oswald library for S-PLUS was published
 under the GPL in 1997, for example, and many other authors produce
 open-source libraries for S-PLUS under a variety of licenses.  The only
 difference is that they will be packaged as, well, packages rather than
 libraries.
 
 # David Smith

Thank you for the explanation. The fact that GPL code is distributed 
*separately* from S-PLUS is the key point here.

PhG

__
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 create a directoy with R

2006-03-27 Thread Philippe Grosjean
See ?dir.create, and take care at the 'recursive' argument in case you 
have to create several subdir levels at once.
Best,

Philippe Grosjean

Sarah Goslee wrote:
 I think you need to use system(mkdir) or whatever is appropriate
 for your OS. Making directories is a function of the OS, not of R. If
 you need to make a truly cross-platform solution, you might need
 to check within your code what OS is being used, and call the
 appropriate system statement. (I think you can do this, but have
 never needed to.) That would be particularly important if you need to
 specify paths.
 
 Sarah
 
 On 3/27/06, pau carre [EMAIL PROTECTED] wrote:
 
Hello, I am trying to create directories with R. I would like R to
create directories because it is platform independent. I tried using
file() and searching in R Data Import/Export but I did not succeed.
I think it must be some function since exists the unlink to remove
directories (and files).

Pau

__
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

 
 
 
 
 --
 Sarah Goslee
 http://www.stringpage.com
 
   [[alternative HTML version deleted]]
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
 


__
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] MenuRead() Question

2006-03-26 Thread Philippe Grosjean
Hi Keith,

If you want to define a Tk menu using MenuRead() and a text file to 
define your menu, you have to start it with Tk.. That way, MenuRead() 
recognizes that it is a Tk menu. So, rewrite your menu definition file as:

  menu.txt - in RHOME
  $Tk.KSesnMain
  |$MenuTest
  ||Objects~~ ls()
  ||-
  ||Path  ~~ search()

Note also that KSesnMain must point to a valid Tk window previously 
constructed.
Best,

Philippe Grosjean


Keith Chamberlain wrote:
 Dear List-mates,
 
 I think the difficulty I'm having is localized to the MenuType() call made
 from within MenuRead(). I'm not used to seeing text operations such as ^
 or [], so am having trouble understanding what's going on.
 
 I'm interested in understanding the regular expression:
 regexpr(^[$]Tk[.].+/, menu), and why it my menus.txt file is not returning
 at that point. 
 
 ?regex explains that the ^ symbol excludes the text enclosed in brackets
 what is in the character string in following brackets, so a bunch of
 matching on string vectors going on that I don't understand well enough yet.
 Do I need to install PCRE-6.6 for this to start working?
 
 Rgds,
 KeithC.
 
 
 
 -Original Message-
 From: Keith Chamberlain [mailto:[EMAIL PROTECTED] 
 Sent: Saturday, March 25, 2006 4:26 PM
 To: 'r-help@stat.math.ethz.ch'
 Cc: 'Philippe Grosjean'
 Subject: MenuRead() Question
 
 Dear List-mates,
 
 I'm trying to read a tk window menu from a file using {svWidgets} and
 'menus.txt' but am receiving Warnings without seeing the desired
 consequences of the call.
 
 library(svWidgets)
 tkWinAdd(KSesnMain,title=kLab Session Manager for R, pos=+0+0)
 MenuRead(file=menus.txt)
 
 Warning messages:
 1: Unrecognized menu type for $KSesnMain/MenuTest in: MenuType(menu) 
 2: Unrecognized menu type for $KSesnMain/MenuTest in: MenuType(menu) 
 3: Unrecognized menu type for $KSesnMain/MenuTest in: MenuType(menu) 
 4: Unrecognized menu type for $KSesnMain/MenuTest in: MenuType(menu)
 
 menu.txt - in RHOME
 $KSesnMain
 |$MenuTest
 ||Objects  ~~ ls()
 ||-
 ||Path   ~~ search()
 
 Please Advise,
 KeithC.
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
 


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


Re: [R] RGui: windows-record and command history

2006-03-23 Thread Philippe Grosjean
Duncan Murdoch wrote:
 On 3/23/2006 7:35 AM, Thomas Steiner wrote:
 
a) How can I set the recording of all windows()-history forever to
true? I want something like windows(record = TRUE) but not just for
the window that opens then, but for all windows I will open ever.
 
 
 options(graphics.record=TRUE)
 
 will make that happen for the rest of the session.  To really make it 
 happen forever, you need to put this line in your Rprofile (see 
 ?Rprofile for where that comes from).
 
 Watch out though:  the graphics history is stored in your current 
 workspace in memory, and it can get big.  You might find you're running 
 out of memory if you store everything, and you'll find your .RData files 
 quite large if you save your workspace.

And also, remember that a single graph history is shared by the various 
graph windows. This may lead to unexpected results in you work with 
several devices at once.

 On my todo list (but not for 2.3.0) is the possibility of setting a 
 default history length, perhaps defaulting to saving the last 2 or 3 
 pages.

That would be really great!

Philippe Grosjean

 
b) Scrolling up in RGui (windows 2000) to see past commands is nice,
but: Is it possible to type eg wi and the arrow up and see the
last command that started with wi (like windows()). I know this
feature from Matlab (Uops, one of the forbidden words here? ;) ) and
it's nice to have it.
 
 
 We have things like that on platforms that use the readline library for 
 input, but Rgui doesn't.  It would be nice, but it's a fair bit of work 
 to implement properly and it's not on my todo list.
 
 Duncan Murdoch
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
 


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


Re: [R] Classifying time series by shape over time

2006-03-22 Thread Philippe Grosjean
Hi,

turnpoints() in library(pastecs) determines if the succession of peaks 
and pits is random, or not. I think that the hypothesis here is little 
bit stronger: it should fit a Gaussian.

I just think a little bit to this problem, and I don't get a simple 
solution. Here is what I got, but this is subject certainly to many 
criticisms (feel free to do so!). The idea is to draw the cumulative 
distribution of the hits and fit it with a logistic curve. Then, 
predicted hits are back calculated (knowind that the logistic curve is 
symmetrical around 'xmid'), and the observed and predicted distributions 
of the hits are compared using a Kolmogorv-Smirnov goodness-of-fit test:

# Enter example data
id1 - data.frame(
   dates = as.Date(c(2004-12-01, 2005-01-01, 2005-02-01,
   2005-03-01, 2005-04-01, 2005-05-01, 2005-06-01,
   2005-07-01, 2005-08-01, 2005-09-01, 2005-10-01,
   2005-11-01, 2005-12-01)),
   hits  = c(3, 4, 10, 6, 35, 14, 33, 13, 3, 9, 8, 4, 3))
id2 - data.frame(
   dates =  as.Date(c(2001-01-01, 2001-02-01, 2001-03-01,
2001-04-01, 2001-05-01, 2001-06-01, 2001-07-01,
2001-08-01, 2001-09-01, 2001-10-01, 2001-11-01,
2001-12-01, 2002-01-01, 2002-02-01, 2002-03-01,
2002-04-01, 2002-05-01, 2002-06-01, 2002-07-01,
2002-08-01, 2002-09-01, 2002-10-01, 2002-11-01,
2002-12-01, 2003-01-01, 2003-02-01, 2003-03-01)),
   hits  = c(6, 5, 5, 6, 2, 5, 1, 6, 4, 10, 0, 3, 6,
 5, 1, 2, 4, 4, 0, 1, 0, 2, 2, 2, 2, 3, 7))

# How does it look like?
plot(id1$dates, id1$hits, type = l)
plot(id2$dates, id2$hits, type = l)

# Cumsum of hits and fit models
id1$datenum - as.numeric(id1$dates)
id1$cumhits - cumsum(id1$hits)
id1.fit - nls(cumhits ~ SSlogis(datenum, Asym, xmid, scal), data = id1)
summary(id1.fit)
plot(id1$dates, id1$cumhits)
lines(id1$dates, predict(id1.fit))

id2$datenum - as.numeric(id2$dates)
id2$cumhits - cumsum(id2$hits)
id2.fit - nls(cumhits ~ SSlogis(datenum, Asym, xmid, scal), data = id2)
summary(id2.fit)
plot(id2$dates, id2$cumhits)
lines(id2$dates, predict(id2.fit))

# Get xmid and recalculate predicted values for hits
xmid1 - coef(id1.fit)[xmid]
id1$hitspred - predict(id1.fit,
 newdata = data.frame(datenum = xmid1 - abs(id1$datenum - xmid1)))
plot(id1$dates, id1$hits, ylim = range(c(id1$hits, id1$hitspred)))
lines(id1$dates, id1$hitspred)

xmid2 - coef(id2.fit)[xmid]
id2$hitspred - predict(id2.fit,
 newdata = data.frame(datenum = xmid2 - abs(id2$datenum - xmid2)))
plot(id2$dates, id2$hits, ylim = range(c(id2$hits, id2$hitspred)))
lines(id2$dates, id2$hitspred)

# A two samples Kolmogorov-Smirnov test of goodness-of-fit
ks.test(id1$hits, id1$hitspred)  # H0 not rejected
ks.test(id2$hits, id2$hitspred)  # H0 rejected


Best,

Philippe Grosjean


Kjetil Brinchmann Halvorsen wrote:
 Andreas Neumann wrote:
 
Dear all,

I have hundreds of thousands of univariate time series of the form:
character seriesid, vector of Date, vector of integer
(some exemplary data is at the end of the mail)

I am trying to find the ones which somehow have a shape over time that
looks like the histogramm of a (skewed) normal distribution:

 hist(rnorm(200,10,2))

The mean is not interesting, i.e. it does not matter if the first
nonzero observation happens in the 2. or the 40. month of observation.
So all that matters is: They should start sometime, the hits per month
increase, at some point they decrease and then they more or less
disappear.

Short Example (hits at consecutive months (Dates omitted)):
1. series: 0 0 0 2 5 8 20 42 30 19 6 1 0 0 0- Good
2. series: 0 3 8 9 20 6 0 3 25 67 7 1 0 4 60 20 10 0 4  - Bad

Series 1 would be an ideal case of what I am looking for.

Graphical inspection would be easy but is not an option due to the huge
amount of series.

 
 
 Does function turnpoints)= in package pastecs help_
 
 Kjetil
 
 
Questions:

1. Which (if at all) of the many packages that handle time series is
appropriate for my problem?

2. Which general approach seems to be the most straightforward and best
supported by R?
- Is there a way to test the time series directly (preferably)?
- Or do I need to type-cast them as some kind of histogram
  data and then test against the pdf of e.g. a normal distribution (but
  how)?
- Or something totally different?


Thank you for your time,

 Andreas Neumann




Data Examples (id1 is good, id2 is bad):


id1

dates   hits
1  2004-12-01 3
2  2005-01-01 4
3  2005-02-0110
4  2005-03-01 6
5  2005-04-0135
6  2005-05-0114
7  2005-06-0133
8  2005-07-0113
9  2005-08-01 3
10 2005-09-01 9
11 2005-10-01 8
12 2005-11-01 4
13 2005-12-01 3



id2

dates   hits
1  2001-01-01 6
2  2001-02-01 5
3  2001-03-01 5
4  2001-04-01 6
5  2001-05-01 2
6  2001-06-01 5
7  2001-07-01 1
8  2001-08

Re: [R] which.minimums not which.min

2006-03-20 Thread Philippe Grosjean
Fred J. wrote:
 
 Philippe Grosjean [EMAIL PROTECTED] wrote: What Fred is looking for is 
 local minima/maxima, also known as turning 
 points, or pits/peaks in a series.  You can look at ?turnpoints in 
 pastecs library.
 
   x - c(1:4,0:5, 4, 11)
   x
   [1]  1  2  3  4  0  1  2  3  4  5  4 11
   tp - turnpoints(x)
   summary(tp)
 Turning points for: x
 
 nbr observations  : 12
 nbr ex-aequos : 0
 nbr turning points: 4 (first point is a peak)
 E(p) = 6.67 Var(p) = 1.81 (theoretical)
 
point type   proba  info
 1 4 peak 0.1 3.3219281
 2 5  pit 0.002380952 8.7142455
 310 peak 0.005952381 7.3923174
 411  pit 0.7 0.5849625
   plot(tp) # Only useful for a longer and more complex series!
   # Get the position of peaks
   (1:length(x))[extract(tp, no.tp = FALSE, peak = TRUE, pit = FALSE)]
 [1]  4 10
 Warning message:
 arguments after the first two are ignored in: UseMethod(extract, e, n, 
 ...)
   (1:length(x))[extract(tp, no.tp = FALSE, peak = FALSE, pit = TRUE)]
 [1]  5 11
 Warning message:
 arguments after the first two are ignored in: UseMethod(extract, e, n, 
 ...)
   # By the way, there are warnings although it works well (I ask on R-Help)
 
 Now, you can easily code your which.minima() function using turnpoints:
 
 x - c(1:4,0:5, 4, 11)
 x
 tp - turnpoints(x)
 summary(tp)
 plot(tp) # Only useful for a longer and more complex series!
 # Get the position of peaks
 (1:length(x))[extract(tp, no.tp = FALSE, peak = TRUE, pit = FALSE)]
 (1:length(x))[extract(tp, no.tp = FALSE, peak = FALSE, pit = TRUE)]
 # By the way, there are warnings although it works well (I ask on R-Help)
 
 which.minima - function(x) {
  if (!require(pastecs)) stop(pastecs library is required!)
  x - as.vector(x)
  (1:length(x))[extract(turnpoints(x), no.tp = FALSE, peak = FALSE, pit = 
 TRUE)]
 }
 
 which.minima(x)
 
 Of course, you could optimize this code. This is just a rough solution!
 Best,
 
 Philippe Grosjean
 
 ..�}))
   ) ) ) ) )
 ( ( ( ( (Prof. Philippe Grosjean
   ) ) ) ) )
 ( ( ( ( (Numerical Ecology of Aquatic Systems
   ) ) ) ) )   Mons-Hainaut University, Pentagone (3D08)
 ( ( ( ( (Academie Universitaire Wallonie-Bruxelles
   ) ) ) ) )   8, av du Champ de Mars, 7000 Mons, Belgium
 ( ( ( ( (
   ) ) ) ) )   phone: + 32.65.37.34.97, fax: + 32.65.37.30.54
 ( ( ( ( (email: [EMAIL PROTECTED]
   ) ) ) ) )
 ( ( ( ( (web:   http://www.umh.ac.be/~econum
   ) ) ) ) )  http://www.sciviews.org
 ( ( ( ( (
 ..
 
   Is there a limit as far as the data input to the function turnpoints? It 
 seams to be unable to process a vector with 15000 records with number in the 
 form of 734.2983, the data is known to have picks and pits

   The steps: 
   Where pp is the vector with data of the above-mentioned style.
   
  tp - turnpoints(rev(pp))
mx_id_rev - (1:length(pp))[extract(tp, no.tp = FALSE, peak = TRUE, pit = 
 FALSE)]
tp
   Turning points for: rev(pp) 

   nbr observations  : 11745 
   nbr ex-aequos : 10273 
   nbr turning points: 1231 (first point is a pit)
   E(p) = 7828.667 Var(p) = 2087.678 (theoretical)
mx_id_rev
   numeric(0)

   Regards,

There is certainly a limit, but not that low. My test gives (R under Win
XP with 1Gb RAM):

 x - rnorm(15000)
 library(pastecs)
Loading required package: boot
 tp -turnpoints(rev(x))
 tp
Turning points for: rev(x)

nbr observations  : 15000
nbr ex-aequos : 0
nbr turning points: 10079 (first point is a peak)
E(p) = 9998.667 Var(p) = 2666.344 (theoretical)

 res - (length(x):1)[extract(tp, no.tp = FALSE, peak = TRUE, pit = FALSE)]
 length(res)
[1] 6250
 res - (length(x):1)[extract(tp, n= 15000, no.tp = FALSE, peak = TRUE, pit = 
 FALSE)]
 length(res)

[1] 6250
[1] 5040
  plot(x[1:500], type = l)
  points(res, x[res], col = 2)

That seems to work. So, there is a bug when you don't specify 'n'. I 
work on a patch for that and upload the new version of pastecs package 
soon. Thanks for pointing me this bug.
Best,

Philippe Grosjean

__
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] Platform independent dialogs menus?

2006-03-20 Thread Philippe Grosjean
Keith Chamberlain wrote:
 Dear list mates,
 
 Are {utils} dialog box functions, and winMenuAdd... functions used to change
 (e.g. Console) menus, platform dependent? 

Yes, Windows-only as the 'win' prefix suggests it.

 I'm writing a script loaded with .First that provides first time users in a
 lab course with the ability to select, load, and change between what I
 called a 'session' (more specific save that focuses on the session object I
 defined rather than the whole workspace,  intended to run many different
 sessions through the course of what would be one workspace).

See also the 'session' package on CRAN for that.

 I'm using winMenuAdd() calls to generate their 'Session' menu at startup,
 the menus call functions sourced in for the menu actions. In the menu
 actions, I call routines that use select.list() and file.choose() calls to
 interact with users. 
 
 I do not work with Macs often, and from what I've gathered today in posts
 about cross-platform difficulties, my sense of being intimidated seems
 well placed to me (then again, breaks  some sleep would probably help). I
 have not had the chance to test routines on a Mac yet, so I have no idea
 what to expect. Is this tract I took with winMenuAdd()  related [{utils}
 windows build] an appropriate route to take wrt the Mac build of R, or would
 I be better off using another package? 

For a platform-independent way of defining menus (you will have a 
floating window with your menu), look at ?MenuAdd in package svWidgets 
(SciViews bundle). With these functions, you even have more control on 
the menus (define shortcuts, trigger the menus through R code, for 
instance), and you can define your menu in one R instruction and a 
simple text file to describe the menu structure, like this:

# Create a Tk window then add a menu to it
$MyTkWindow
|$MenuTest
||Objects  ~~ ls()
||-
||Path ~~ search()

# Add menus to the RGui console (Windows only)
$ConsoleMain
|$Testit
||One ~~ cat(One triggered!\n)
||-
||Two ~~ cat(Two triggered!\n)  ~~ state = disable
||$SubMenu
|||Three  ~~ cat(Three triggered!\n)
|||Four   ~~ cat(Four triggered!\n)
||Five~~ cat(Five triggered!\n)

# Add menu to the RGui console popup (Windows only)
$ConsolePopup
|$TestitPopup
||Six ~~ cat(Six triggered!\n)

If the preceeding menu definition is in a file named Menus.txt in the 
/gui subdirectory of your MyPackage package, you can do:

library(svWidgets)
  tkWinAdd(MyTkWindow, title = Menu window, pos =-40+20)
  MenuReadPackage(MyPackage)

... and you got all your menus configured at once (for MyTkWindows + 
RGui console + RGui console popup menu

Best,

Philippe Grosjean

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


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


Re: [R] Platform independent dialogs menus?

2006-03-20 Thread Philippe Grosjean
Keith Chamberlain wrote:
 Dear Philippe, ( list)
 
 I am not sure what is meant by 'floating window' but thank you for
 clarifying the 'win' prefix. I had been considering different possible
 senses of that prefix: win as in 'ts' window  windowing functions (clearly
 not), a generic 'win'dow function (abbreviated) for some GUI, or ms windows
 GUI windowing function in particular. I'm noticing that the description in
 {utils:winMenuAdd} indicates 'for windows', and it's quite clear (now,
 anyway) that it is to be taken as ms windows. But cool, I WAS barking down
 the wrong tree  can now refocus efforts. Curious how the correct meaning
 did not pop out at me. 
 
 I was not aware of the {Session} package. What I've merely glanced at
 suggests the package is exactly (or really, really darn close) to what I had
 in mind. I appreciate the suggestion.

You're welcome. You will often notice that it worth doing a search on 
CRAN -well, as simple as looking at a couple of well-choosen keywords 
with RSiteSearch()-, before programming something new. Often, the 
functionnality already exists somewhere, or at least, a good starting 
point for your own development. Note that I am also working on possible 
improvements of 'session'. If you like, I can send you my code.

 I downloaded SciViews  Tinn-R 2 days ago, and LOVE Tinn-R so far; syntax
 highlighting, oh yes! My rudimentary understanding, however, was that
 SciViews was only compiled for MS Windows so far. Can I run SciViews
 natively on a Mac now, or is the cross-platform part specific to some of the
 routines? 

Well, it is moving vey slowly to a platform-independent (and 
graphical widgets-independent) solution with the SciViews bundle on 
CRAN. This move is slow because, as a Windows user, I am satisfied by 
the current SciViews-R + R Commander + Tinn-R implementation for 
Windows, and I also have many priority tasks over this one.

Also for Tinn-R, Jose-Claudio Faria and myself consider to reimplement 
it in a platform-independent editor (using jEdit or Eclipse as a 
starting basis), but we still haven't time to start doing it. There are 
still many improvements to be done on the actual Tinn-R. For instance, 
Jose-Claudio is currently working on nice Sweave extensions for Tinn-R.
Best,

Philippe Grosjean

 Respecftully,
 KeithC.
 
 -Original Message-
 From: Philippe Grosjean [mailto:[EMAIL PROTECTED] 
 Sent: Monday, March 20, 2006 6:18 AM
 To: Keith Chamberlain
 Cc: r-help@stat.math.ethz.ch
 Subject: Re: [R] Platform independent dialogs  menus?
 
 Keith Chamberlain wrote:
 
Dear list mates,

Are {utils} dialog box functions, and winMenuAdd... functions used to
change (e.g. Console) menus, platform dependent? 
 
 
 Yes, Windows-only as the 'win' prefix suggests it.
 
 
I'm writing a script loaded with .First that provides first time users in 
a lab course with the ability to select, load, and change between what I
called a 'session' (more specific save that focuses on the session object 
I defined rather than the whole workspace,  intended to run many 
different sessions through the course of what would be one workspace).
 
 
 See also the 'session' package on CRAN for that.
 
 
I'm using winMenuAdd() calls to generate their 'Session' menu at startup,
the menus call functions sourced in for the menu actions. In the menu
actions, I call routines that use select.list() and file.choose() calls to
interact with users. 

I do not work with Macs often, and from what I've gathered today in posts
about cross-platform difficulties, my sense of being intimidated seems
well placed to me (then again, breaks  some sleep would probably help). I
have not had the chance to test routines on a Mac yet, so I have no idea
what to expect. Is this tract I took with winMenuAdd()  related [{utils}
windows build] an appropriate route to take wrt the Mac build of R, or
 
 would
 
I be better off using another package? 
 
 
 For a platform-independent way of defining menus (you will have a 
 floating window with your menu), look at ?MenuAdd in package svWidgets 
 (SciViews bundle). With these functions, you even have more control on 
 the menus (define shortcuts, trigger the menus through R code, for 
 instance), and you can define your menu in one R instruction and a 
 simple text file to describe the menu structure, like this:
 
 # Create a Tk window then add a menu to it
 $MyTkWindow
 |$MenuTest
 ||Objects  ~~ ls()
 ||-
 ||Path   ~~ search()
 
 # Add menus to the RGui console (Windows only)
 $ConsoleMain
 |$Testit
 ||One   ~~ cat(One triggered!\n)
 ||-
 ||Two   ~~ cat(Two triggered!\n)  ~~ state = disable
 ||$SubMenu
 |||Three  ~~ cat(Three triggered!\n)
 |||Four ~~ cat(Four triggered!\n)
 ||Five  ~~ cat(Five triggered!\n)
 
 # Add menu to the RGui console popup (Windows only)
 $ConsolePopup
 |$TestitPopup
 ||Six   ~~ cat(Six triggered!\n)
 
 If the preceeding menu definition is in a file named Menus.txt in the 
 /gui subdirectory of your MyPackage

Re: [R] cat(), Rgui, and support for carriage return \r...

2006-03-19 Thread Philippe Grosjean
How did you look in the archives? It is already a dozen times that I answer:
  library(svMisc) # SciViews bundle
  ?progress
on this list for a similar question.
If you do:
  RSiteSearch(progress)
you have hundreds of results, with several items in the first page that 
point to this function.
(actually, this function repeatedly uses \b which works on all system 
tested (Linux console, RTerm, RGui, SciViews-R).
Best,

Philippe Grosjean

Duncan Murdoch wrote:
 On 3/17/2006 9:44 AM, Jeffrey Racine wrote:
 
Hi, and thanks in advance for your time.

Background - I am working on a package and wish to have a routine's
progress reported. The routine can take some time, and I would like to
inform the user about the routine's progress. I have scoured the
archives but to no avail, so would like to solicit input from this list.

I am successfully using

cat(\rBootstrap replication , i,  of , boot.num,)
flush.console() # To flush stdout on windows systems

which works as expected on *NIX systems and using Rterm under windows.
However, under Rgui the carriage return \r is ignored, and I certainly
don't want to use the newline escape sequence \n. Under Rgui it appears
as

Bootstrap replication 1 of 399Bootstrap replication 2 of 399Bootstrap...

but I want it to function properly if at all possible.

My question is simply whether there is a portable way to implement this
so that it works regardless of the R platform the user may be working
on?

Many thanks for any/all suggestions.
 
 
 I've just been looking at the source code for this.  I think it will be 
 relatively easy to make \r in Rgui do a destructive CR (i.e. it will 
 return to the start of the line, but clear any existing characters). 
 I'll play around a bit and then do that for R-devel.
 
 In the meantime, \b does a destructive backspace, so you can get the 
 effect you want with something like this:
 
 msg - 
 for (i in 1:1000) {
 cat(rep(\b, nchar(msg)), sep=)
 msg - paste(Message , i)
 cat(msg)
 flush.console()
 }
 
 This seems to work in Rgui, Rterm, (and R on Unix, if you get rid of the 
 flush.console call).
 
 Duncan Murdoch
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
 


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


Re: [R] Additional arguments in S3 method produces a warning

2006-03-16 Thread Philippe Grosjean
I totally agree with these considerations. However, there is another 
point to consider: any existing definition of a generic function.

At the time I programmed this in pastecs (first under S-PLUS), I found 
an already defined extract(e, n, ...) generic function. So, I decided to 
stick with the original definition, even if 'e' or 'n' did not mean 
anything special for my own use.

Ironically, doing a quick search on R, it appears that extract() is 
defined only in pastecs library...
Best,

Philippe Grosjean

Martin Maechler wrote:
HenrikB == Henrik Bengtsson [EMAIL PROTECTED]
on Thu, 16 Mar 2006 07:48:49 +0100 writes:
 
 
 HenrikB It is even better/more generic(!) to have: 
 HenrikB extract - function(...) UseMethod(extract)
 
 HenrikB Specifying the object argument or the method
 HenrikB arguments of a generic function will restrict any
 HenrikB other methods with the same name to have the same
 HenrikB argument. By also excluding the object argument,
 HenrikB default functions such as search() will also be
 HenrikB called if the generic function is called without
 HenrikB any arguments.
 HenrikB [http://www.maths.lth.se/help/R/RCC/]
 
 HenrikB /Henrik
 
 Hmm, sorry, but that is Henrik's own ``style sheet'' which
 contains some views that I (and AFAIK other R-core members) 
 do not share.
 
 The grain of truth in Henrik's statement is that for a generic
 function, S3 or S4, one should carefully consider which
 arguments should be shared by all methods and which not.
 But having at least one  `` non-... '' argument should be the
 rule, and is even a necessity for S4.
 Hence I'd strongly discourage defining generic functions with
 only a (...) argument list.
 
 HenrikB On 3/15/06, Gabor Grothendieck
 HenrikB [EMAIL PROTECTED] wrote:
  Define extract like this:
  
  extract - function(e, n, ...) UseMethod(extract)
  
  # test -- no warning 
  extract(tp, no.tp = FALSE, peak = TRUE, pit = FALSE)
 
 yes, I agree with Gabor
 
 Martin Maechler,
 ETH Zurich
 
 
On 3/15/06, Philippe Grosjean [EMAIL PROTECTED] wrote:

Hello,
I just notice this:
  x - c(1:4,0:5, 4, 11)
  library(pastecs)
Loading required package: boot
  tp - turnpoints(x)
  extract(tp, no.tp = FALSE, peak = TRUE, pit = FALSE)
 [1] FALSE FALSE FALSE  TRUE FALSE FALSE FALSE FALSE FALSE  TRUE FALSE
FALSE
Warning message:
arguments after the first two are ignored in: UseMethod(extract, e, n,
...)
  extract(tp)
 [1]  0  0  0  1 -1  0  0  0  0  1 -1  0
Warning message:
arguments after the first two are ignored in: UseMethod(extract, e, n,
...)

My extract.turnpoints() function produces warnings. I can easily spot
the origin of this warning:

  extract
function (e, n, ...)
UseMethod(extract, e, n, ...)
  extract.turnpoints
function (e, n, no.tp = 0, peak = 1, pit = -1, ...)
{
if (missing(n))
n - length(e)
res - rep(no.tp, length.out = e$n)
res[e$pos[e$peaks]] - peak
res[e$pos[e$pits]] - pit
if (n  length(res)  n  0)
res - res[1:n]
res
}

This is because my extract.turnpoints() method defines more arguments
than 'e' and 'n' in the generic function. However,

1) I though that the '...' argument in S3 generic function was there to
allow defining/passing additional arguments in/to S3 methods. Is this
correct? If yes, why the warning?

2) Despite the warning says arguments after the first two are ignored,
this appears not to be the case: in this example, 'no.tp', 'peak' and
'pit' arguments are taken into account, as you can see (different
behaviour if you give other values to them).

I am a little bit lost. Could someone help me, please.

Best,

Philippe Grosjean

 
 


__
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] matrix indexing

2006-03-15 Thread Philippe Grosjean
This is really elementary indexing in S language:

matA[matB]

Best,

Philippe Grosjean

tom wright wrote:
 Can someone please give me a pointer here.
 I have two matrices
 
 matA
   A   B   C
 1 5   2   4
 2 2   4   3
 3 1   2   4
 
 matB
   A   B   C
 1 TRUEFALSE   TRUE
 2 FALSE   TRUETRUE
 3 FALSE   FALSE   FALSE
 
 how do I extract all the values from matA where the coresponding entry
 in matB == TRUE (or FALSE), perferably in vector form.
 
 Many thanks
 tom
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
 


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


Re: [R] which.minimums not which.min

2006-03-15 Thread Philippe Grosjean
What Fred is looking for is local minima/maxima, also known as turning 
points, or pits/peaks in a series.  You can look at ?turnpoints in 
pastecs library.

  x - c(1:4,0:5, 4, 11)
  x
  [1]  1  2  3  4  0  1  2  3  4  5  4 11
  tp - turnpoints(x)
  summary(tp)
Turning points for: x

nbr observations  : 12
nbr ex-aequos : 0
nbr turning points: 4 (first point is a peak)
E(p) = 6.67 Var(p) = 1.81 (theoretical)

   point type   proba  info
1 4 peak 0.1 3.3219281
2 5  pit 0.002380952 8.7142455
310 peak 0.005952381 7.3923174
411  pit 0.7 0.5849625
  plot(tp) # Only useful for a longer and more complex series!
  # Get the position of peaks
  (1:length(x))[extract(tp, no.tp = FALSE, peak = TRUE, pit = FALSE)]
[1]  4 10
Warning message:
arguments after the first two are ignored in: UseMethod(extract, e, n, 
...)
  (1:length(x))[extract(tp, no.tp = FALSE, peak = FALSE, pit = TRUE)]
[1]  5 11
Warning message:
arguments after the first two are ignored in: UseMethod(extract, e, n, 
...)
  # By the way, there are warnings although it works well (I ask on R-Help)

Now, you can easily code your which.minima() function using turnpoints:

x - c(1:4,0:5, 4, 11)
x
tp - turnpoints(x)
summary(tp)
plot(tp) # Only useful for a longer and more complex series!
# Get the position of peaks
(1:length(x))[extract(tp, no.tp = FALSE, peak = TRUE, pit = FALSE)]
(1:length(x))[extract(tp, no.tp = FALSE, peak = FALSE, pit = TRUE)]
# By the way, there are warnings although it works well (I ask on R-Help)

which.minima - function(x) {
if (!require(pastecs)) stop(pastecs library is required!)
x - as.vector(x)
(1:length(x))[extract(turnpoints(x), no.tp = FALSE, peak = FALSE, pit = 
TRUE)]
}

which.minima(x)

Of course, you could optimize this code. This is just a rough solution!
Best,

Philippe Grosjean

..°}))
  ) ) ) ) )
( ( ( ( (Prof. Philippe Grosjean
  ) ) ) ) )
( ( ( ( (Numerical Ecology of Aquatic Systems
  ) ) ) ) )   Mons-Hainaut University, Pentagone (3D08)
( ( ( ( (Academie Universitaire Wallonie-Bruxelles
  ) ) ) ) )   8, av du Champ de Mars, 7000 Mons, Belgium
( ( ( ( (
  ) ) ) ) )   phone: + 32.65.37.34.97, fax: + 32.65.37.30.54
( ( ( ( (email: [EMAIL PROTECTED]
  ) ) ) ) )
( ( ( ( (web:   http://www.umh.ac.be/~econum
  ) ) ) ) )  http://www.sciviews.org
( ( ( ( (
..

Marc Schwartz (via MN) wrote:
 On Wed, 2006-03-15 at 11:32 -0800, Fred J. wrote:
 
  Hi
   
  Is there a function which determines the location, i.e., index of
the all minimums or maximums of a numeric vector.
  Which.min(x) only finds the (first) of such.
   
   x - c(1:4,0:5, 4, 11)
   x
   [1]  1  2  3  4  0  1  2  3  4  5 4 11
   which.min(x)
  [1] 5
   which.max(x)
  [1] 11
  
   
  but I need 
  which.min(x)  to be 5 11
  which.max(x) to be 4 10
   
  thanks
   
 
 
 There is something wrong with your example code versus data here, since:
 
 
x
 
  [1]  1  2  3  4  0  1  2  3  4  5  4 11
 
 
which.min(x)
 
 [1] 5
 
 
which.max(x)
 
 [1] 12
 
 
 There is one one minimum value of 0 in that vector and only one maximum
 value of 11.
 
 If you had a vector 'x':
 
 
x - c(1:4, 0:5, 4, 0, 5)
 
 
x
 
  [1] 1 2 3 4 0 1 2 3 4 5 4 0 5
 
 
 You could then do the following to get the indices of the multiple
 min/max values:
 
 
which(x == min(x))
 
 [1]  5 12
 
 
which(x == max(x))
 
 [1] 10 13
 
 
 The only other thing that I can think you might be considering would be
 local minima/maxima in the vector and if that is what you want using:
 
   RSiteSearch(local minima)
 
 or
 
   RSiteSearch(peaks)
 
 
 should lead you to some solutions that have been discussed previously.
 
 HTH,
 
 Marc Schwartz
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
 


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


[R] Additional arguments in S3 method produces a warning

2006-03-15 Thread Philippe Grosjean
Hello,
I just notice this:
  x - c(1:4,0:5, 4, 11)
  library(pastecs)
Loading required package: boot
  tp - turnpoints(x)
  extract(tp, no.tp = FALSE, peak = TRUE, pit = FALSE)
  [1] FALSE FALSE FALSE  TRUE FALSE FALSE FALSE FALSE FALSE  TRUE FALSE 
FALSE
Warning message:
arguments after the first two are ignored in: UseMethod(extract, e, n, 
...)
  extract(tp)
  [1]  0  0  0  1 -1  0  0  0  0  1 -1  0
Warning message:
arguments after the first two are ignored in: UseMethod(extract, e, n, 
...)

My extract.turnpoints() function produces warnings. I can easily spot 
the origin of this warning:

  extract
function (e, n, ...)
UseMethod(extract, e, n, ...)
  extract.turnpoints
function (e, n, no.tp = 0, peak = 1, pit = -1, ...)
{
 if (missing(n))
 n - length(e)
 res - rep(no.tp, length.out = e$n)
 res[e$pos[e$peaks]] - peak
 res[e$pos[e$pits]] - pit
 if (n  length(res)  n  0)
 res - res[1:n]
 res
}

This is because my extract.turnpoints() method defines more arguments 
than 'e' and 'n' in the generic function. However,

1) I though that the '...' argument in S3 generic function was there to 
allow defining/passing additional arguments in/to S3 methods. Is this 
correct? If yes, why the warning?

2) Despite the warning says arguments after the first two are ignored, 
this appears not to be the case: in this example, 'no.tp', 'peak' and 
'pit' arguments are taken into account, as you can see (different 
behaviour if you give other values to them).

I am a little bit lost. Could someone help me, please.

Best,

Philippe Grosjean


-- 
..°}))
  ) ) ) ) )
( ( ( ( (Prof. Philippe Grosjean
  ) ) ) ) )
( ( ( ( (Numerical Ecology of Aquatic Systems
  ) ) ) ) )   Mons-Hainaut University, Pentagone (3D08)
( ( ( ( (Academie Universitaire Wallonie-Bruxelles
  ) ) ) ) )   8, av du Champ de Mars, 7000 Mons, Belgium
( ( ( ( (
  ) ) ) ) )   phone: + 32.65.37.34.97, fax: + 32.65.37.30.54
( ( ( ( (email: [EMAIL PROTECTED]
  ) ) ) ) )
( ( ( ( (web:   http://www.umh.ac.be/~econum
  ) ) ) ) )  http://www.sciviews.org
( ( ( ( (
..

__
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] lapply vs. for (was: Incrementing a counter in lapply)

2006-03-15 Thread Philippe Grosjean
the for() loop is very slow in S-PLUS. This is probably one of the 
motivation of developing the apply() family of functions (as well as the 
ugly For() loop) under this system.

Now, for() loops are much faster in R. Also, if you look at the R code 
in apply(), you will realize that there is a for() loop in it!

So, why would you prefer using apply() or the like?
1) If you write code to be run both in S-PLUS and R,

2) If you want more concise code (much housekeeping is done by apply() 
and co),

3) Because the apply() family is more in the phylosophy of vectorized 
calculation, that is, the favored approach in S language.

Take care, however, that the optimal approach is not just to replace 
for() loops with apply() and co, but to *rethink* completelly your 
algorithm in a vectorized way. This often ends up with a very different 
solution!
Best,

Philippe Grosjean

Gregor Gorjanc wrote:
From: Thomas Lumley

On Tue, 14 Mar 2006, John McHenry wrote:


Thanks, Gabor  Thomas.

Apologies, but I used an example that obfuscated the question that I
wanted to ask.

I really wanted to know how to have extra arguments in 

functions that

would allow, per the example code, for something like a 

counter to be 

incremented. Thomas's suggestion of using mapply 

(reproduced below with 

corrections) is probably closest.

It is probably worth pointing out here that the R 
documentation does not 
specify the order in which lapply() does the computation.

If you could work out how to increment a counter (and you could, with 
sufficient effort), it would not necessarily work, because the 'i'th 
evaluation would not necessarily be of the 'i'th element.

[lapply() does in fact start at the beginning, go on until it 
gets to the 
end, and then stop, but this isn't documented.   Suppose R became 
multithreaded, for example]

The corollary, it seems to me, is that sometimes it's better to leave the
good old for loop alone.  It's not always profitable to turn for loops into
some *apply construct.  The trick is learning to know when to do it and when
not to.
 
 
 Can someone share some of this tricks with me? Up to now I have always
 done things with for loop. Just recently I started to pay attention to
 *apply* constructs and I already wanted to start implementing them
 instead of good old for, but then a stroke of lightning came from this
 thread. Based on words from Thomas, lapply should not be used for tasks
 where order is critical. Did I get this clear enough. Additionally, I
 have read notes (I lost link, but was posted on R-help, I think) from
 Thomas on R and he mentioned that it is commonly assumed that *apply* (I
 do not remember which one of *apply*) is faster than loop, but that this
 is not true. Any additional pointers to literature?


__
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 GUI's on a Mac?

2006-03-14 Thread Philippe Grosjean
Anyone who responds to Berton, please, CC me: I am also interested.
Best,

Philippe Grosjean

Berton Gunter wrote:
 Folks:
 
 A question for R users on Macs. AFAIK,  R's Tcl/TK tools allow one to build
 GUI interfaces to R's functionality across all platforms. My question: How
 well do the TK widget tools work on a Mac? More specifically, is there any
 extra difficulty or complication in porting such applications to a Mac? Is
 there any special requirement for the Mac OS or version? Any glitches that
 should give one pause?
 
 Please reply privately, as this is not of general interest to the list. Many
 thanks.
 
 -- Bert Gunter
 Genentech
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
 


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


Re: [R] irregular time series

2006-03-14 Thread Philippe Grosjean
One solution is to convert an irregular time series into a regular one, 
interpolating missing values. Obviously, it is only acceptable if the 
number of missing items is low. See ?regul in pastecs, for instance.
Best,

Philippe Grosjean

alessandro carletti wrote:
 Hi everybody,
 I'm currently working with time series: do you know if
 there's something like stl(package stats, seasonal
 decomposition of time series by loess) working also
 with objects of class irts?
 Thanks
 
 Alessandro
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
 


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


Re: [R] Multi-line paste function

2006-03-14 Thread Philippe Grosjean
I am not sure I clearly understand what you want, but getting the string 
returned by your multi.line.paste() function is straightforward using 
gsub():

gsub(\n, , 
SELECT *
FROM estimates a, newtable b
WHERE a.Ticker=b.Ticker
AND a.Fiscal_Year=b.Fiscal_Year
AND a.EPSb.EPS
AND a.Date_Last_change-1.9b.Date_Last_change
)

If you really want a custom function for that, then, define:

multi.line.paste - function(str) gsub(\n, , str)

Best,

Philippe Grosjean

Lapointe, Pierre wrote:
 Here's my contribution to R.
 
 When R interacts with external programs (MySQL, cURL, etc.), it often
 requires a pasted string that is sent to these programs. For readability
 reasons, it is often preferable to have complex commands (SQL for example)
 spread on several lines. However, the normal paste function requires to add
 additional ' , ' at the end of each line and another '  ' at the beginning
 of each new line.  It becomes fastidious for long commands.
 
 Multi-line paste function:
 
 multi.line.paste -function (..., sep =  , collapse = NULL) 
 {
 args - list(...)
 if (length(args) == 0) 
 if (length(collapse) == 0) 
 character(0)
 else 
 else {
 for (i in seq(along = args)) args[[i]] -
 gsub(\n,,as.character(args[[i]]))
 .Internal(paste(args, sep, collapse))
 }
 }
 
 Example with a SQL command on multiple lines:
 
 multi.line.paste(
 SELECT * 
 FROM estimates a, newtable b 
 WHERE a.Ticker=b.Ticker 
 AND a.Fiscal_Year=b.Fiscal_Year 
 AND a.EPSb.EPS 
 AND a.Date_Last_change-1.9b.Date_Last_change
 )
 
 Regards,
 
 Pierre
 
 
 **
 AVIS DE NON-RESPONSABILITE: Ce document transmis par courrie...{{dropped}}
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
 


__
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] Multi-line paste function

2006-03-14 Thread Philippe Grosjean
Lapointe, Pierre wrote:
 Hello Phillipe
 
 1-You are right that for a simple example as the one I provided, paste and
 gsub give the same result.
 2-For a more complex case, where let's say, I'd like to include a variable
 in my SQL statement, the multi.line.paste command is essential.
 
 variable -1.9
 multi.line.paste(
 SELECT * 
 FROM estimates3 a, newtable b 
 WHERE a.Ticker=b.Ticker 
 AND a.Fiscal_Year=b.Fiscal_Year
 AND a.EPSb.EPS 
 AND a.Date_Last_change_or_conf-,variable,b.Date_Last_change_or_conf
 ,sep=)
 
 Regards,
 
 Pierre 

Still simpler than your function:

variable - 1.9
gsub(\, , paste(
SELECT *
FROM estimates3 a, newtable b
WHERE a.Ticker=b.Ticker
AND a.Fiscal_Year=b.Fiscal_Year
AND a.EPSb.EPS
AND a.Date_Last_change_or_conf-,variable,b.Date_Last_change_or_conf
, sep=))

Philippe Grosjean

__
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] count pixels of same color in pixmap object?

2006-03-09 Thread Philippe Grosjean
Another solution is to use external tools. It really depends on what you 
have to do: if it is to count pixels of one, or a few gray levels, it 
could be fine to do it in R,... but if you want to count *all* pixels, 
this could be more efficient using a C program, especially if you work 
with 16bit images! You can find something in ImageMagick or in Netpbm. 
Here is a solution using pgmhist from Netpbm 
(http://netpbm.sourceforge.net/). This implies that you first converted 
your image in PGM format (the Netpbm library provides all tools required 
for that conversion).
Here is the R code, assuming pgmhist or pgmhist.exe (Windows) is 
installed and accessible from the path:

# Get statistics about pixel in graylevel pgm images
pixelStats - function(imagePgm, pgmhist =
 if (.Platform$OS.type == windows) pgmhist.exe else pgmhist) {
 # Get pixel count for each gray level
 pix - system(paste(pgmhist, imagePgm),
 intern = TRUE, invisible = TRUE)
 if (pix[1] != value\tcount\tb%\tw%)
 stop(Error when running 'pgmhist' on the image ,
 imagePgm, \n\n, pix)
 pix - pix[-(1:2)]
 getPixCount - function(str)
 as.numeric(strsplit(str, \t)[[1]][1:2])
 pix2 - t(sapply(pix, getPixCount, USE.NAMES = FALSE))
 colnames(pix2) - c(pixel.value, count)
 return(pix2)
}

pixelStats(myimage.pgm)

Depending on the treatment you have to do, it is sometimes better to 
delegate it to specialized programs (ImageMagick, Netpbm, ImageJ, etc.) 
instead of using pixmap. The best is to try both and to determine which 
solution is faster for your particular application. I am working with 
very large images (hundreds of megabytes) for the ZooImage application 
(http://www.sciviews.org/zooimage), and I delegate 100% of the work done 
on these images to external programs, because R is not designed to 
handle them efficiently.
Best,

Philippe Grosjean


Roger Bivand wrote:
 On Thu, 9 Mar 2006, Christian Jost wrote:
 
 
Dear all,

I try to figure out how to use R to count the number of pixels of the 
same color in some gray-level picture. I managed to read it in either 
tiff or jpeg format, but the returned pixmap object keeps its 
information out of (my) reach. Is there an easy way to tabulate the 
different color/graylevel pixels and their numbers? Or should I use a 
completely different (free) software?
 
 
 The objects are new-style class objects, so they are documented internally 
 - query by getSlots() or from ?pixmap-class:
 
 library(pixmap)
 x - read.pnm(system.file(pictures/logo.ppm, package=pixmap)[1])
 z - as(x, pixmapGrey)
 class(z)
 getSlots(class(z)) # lets you know what the slots are
 greydata - slot(z, grey) # extract the slot object
 summary(c(greydata)) # c() to flatten a matrix
 length(unique(c(greydata)))
 length((c(greydata))) # rather a lot of different values, let's round:
 rgreydata - round(greydata*10)
 length(unique(c(rgreydata))) # looks good
 table(c(rgreydata))
 
 I assume that you converted from tiff or jpeg to pnm outside pixmap.
 
 
Thanks for any hint, Christian.

 


__
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 close all windows?

2006-02-21 Thread Philippe Grosjean
?graphics.off is for graphic windows only. You don't tell us, but I 
assume you are working with RGui under Windows. If you don't want many 
help windows, you can still change it in Edit - GUI preferences - 
Pager style - single window.
Best,

Philippe Grosjean



Uwe Ligges wrote:
 Michael wrote:
 
Hi all,

I have 10+ graphic windows and 10+ R help window opening now...

How do I close them all at once?

Thanks a lot!

  [[alternative HTML version deleted]]

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


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


Re: [R] Transferring R results to word prosessors

2006-02-11 Thread Philippe Grosjean
The copy to clipboard feature is written (by Eric Lecoutre  myself) 
since a couple of years. It is in the SciViews bundle, library svIO. In 
this library, you have:
- copy() that copies an object to the clipboard in various formats 
(icluding HTML, by using R2HTML and LaTeX),


- export() does the same, but save to a file on disk,

- you have also clippaste() to paste data from the clipboard.

Moreover, in the SciViews bundle, you have also svViews that provides 
further interesting functions for reporting:

- view() allows to generate different rich-formatted views on objects,

- report() sends a view to a reporting application (but see hereunder 
the note about SciViews-R),


- reportGraph() is the same for R graphs,

... All these functions exist on CRAN since at least two years. They are 
programmed under Windows(), but most of them should be working on other 
platforms (I would gladly consider patches, of course, if required).


Now, if you want a convenient point and click approach to write a 
report, you should use SciViews-R (http://www.sciviews.org/SciViews-R). 
It has a nice GUI interface on top of these functions. For instance, you 
can access them from the context menu of the object explorer (but see 
the SciViews-R manual at http://www.sciviews.org/SciViews-R/Manual.pdf).


SciViews-R is Windows only, but I am gradually moving code to a 
platform-independent solution (lot of code, lack of time, other 
priorities,... so, you have to be patient!).


Finally, I uploaded the latest version of SciViews this week on CRAN. 
Now, the svViews package has a suite of WordXXX() functions. There are 
intended for sending nicely formatted data to Word. The next version of 
SciViews-R (next week, or so) included the functionnalities in the GUI.


Regarding reproducibility of results, the strategy here is to write a 
template in Word with bookmarks at the locations where you want to put 
material coming from R. Once it is done, you can control entirely the 
process of filling the Word document from within a R script. For 
instance (extracted and reworked from the example in ?WordOpen):



# Install SciViews bundle from CRAN, then...
library(svViews)
repdir - c:/temp # Adapt this for you
WordOpen(file.path(repdir, report.doc)) # Open your template

# Code to create a graph in a file, for instance
graphfile - file.path(repdir, figure1.emf)
win.metafile(filename = graphfile, width = 7, height = 5)
hist(rnorm(500))
dev.off()

# Insert that graph in Word at a location named picture1:
WordGoto(figure1) # Move to the picture1 bookmark
WordInsertPictureFile(graphfile, TRUE) # Insert the graph

# Create a view in HTML (rich-formatted) and insert it in Word
# for instance, for a simple linear regression, you can do:
data(trees)
trees.lm - lm(Volume ~ Girth, data = trees)
viewfile - view(trees.lm, type = summary, browse = FALSE)
WordGoto(view1) # Go to the regression1 bookmark in your report
WordInsertFile(viewfile, TRUE) # Insert the view in the report

# This is done!
WordActivate(async = TRUE) # Show your report in Word.
# and allow to refine it (add comments according to the results)

# -- or --
# WordExit()  # Close word, possibly prompting to save the doc.


(note that I appended a suitable myreport.doc to this email, but it 
will probably be eliminated on the mailing list. so, ask me if you need it).

Best,

Philippe Grosjean

P.S.: the formatting of text and tables in the views is managed through 
CSS files, independently from Word styles. So, you would presumably like 
to make a CSS file in accordance with the style you want in your report.



Gabor Grothendieck wrote:

Given that this may very well be the most common use of the
R2HTML package I wonder if the R2HTML package developer would
be interested in providing an HTML2clip convenience wrapper
as part of the R2HTML package like this:

   HTML2clip - function(x, file. = file(clipboard, w), append = FALSE, ...)
 HTML(x, file = file., append = append, ...)

so that one could just write:

   HTML2clip(summary(lm(rating ~., attitude)))

On 2/10/06, Tom Backer Johnsen [EMAIL PROTECTED] wrote:


Thank you all for very useful and interesting responses.  After reading the
comments and after some experiments, I added the following to a text I will
be handing out to the students (I would not mind comments):

QUOTEThe contents of the text output from R may be very sophisticated,
but the formatting of the texts is always very simple, with absolutely no
frills.  For instance, all formatting of columns is managed with spaces or
blanks, no tabs, nothing extra apart from line feeds.  This means that
transferring some types of output, like the summary of the multiple
regression in part 7.4 directly to MS Word or any other wordprocessor would
be far from optimal.  To make a decent table for presenting results in a
paper in APA format, we need a table in the word processing sense, an
arrangement of things in rows and columns.  With output as plain as in R, a
lot

Re: [R] Tranferring R results to word prosessors

2006-02-09 Thread Philippe Grosjean
I have added several convenient methods for sending data directly from R 
to Microsoft Word (report() function) in the svViews package (SciViews 
bundle). However, I still have to upload it to CRAN. I do it right now. 
It should be available in a couple of days.
Best,

Philippe Grosjean

Romain Francois wrote:
 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


__
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 Philippe Grosjean
Romain Francois wrote:
 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

Indeed! The pseudo-random number generator is initialized at the same 
state, and thus, returns the same 1000 pseudo-random numbers in both 
cases. So, no differences.
Best,

Philippe Grosjean

__
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] problem with simple if() statement

2006-02-06 Thread Philippe Grosjean
Norman Goodacre wrote:
 the following code apprantely, for some grand old reason, induces a syntax 
 error:
   
   if (seq[i] = A) m - trans[1,]
   
   where seq is a vector and trans is a matrix. I cannot for the life of me 
 see why this is wrong. Syntax error is: 
   
   Error: syntax error in if (seq[i] =
   
   Sincerely,
   
   Norman Goodacre

Please, read An Introduction to R provided with any version of R. The 
correct syntax for an equality condition is ==, not =, so:

  if (seq[i] == A) 

Best,

Philippe Grosjean

__
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] saving a character vector

2006-02-05 Thread Philippe Grosjean
If I understand the question correctly, both Jim Holtman's and John 
Fox's answers are correct solutions. However, they are not optimal ones 
(that was not the question -optimize my code, please-, but one can talk 
about it a little bit).

- Jim proposes (I rework a little bit his code):
generateIndex1 - function(n.item) {
 Res - character(0)  # initialize vector
 for (i in 1:(n.item - 1)) { # John Fox's correction introduced
 for (j in ((i+1):n.item)) {
 # concatenate the results
 Res - c(Res, paste(i, formatC(i, digits = 2, flag = 0),
 ., formatC(j, digits = 2, flag = 0), sep = ))
 }
 }
 Res
}

- John Fox proposes:
generateIndex2 - function(n.item) {
 result - rep(, n.item * (n.item - 1) / 2)
 index - 0
 for (i in 1:(n.item - 1)) {
 for (j in ((i + 1):n.item)) {
 index - index + 1
 result[index] - paste(i,
 formatC(i, digits = 2, flag = 0), .,
 formatC(j, digits = 2, flag = 0), sep = )
 }
 }
 result
}

The difference is that Jim creates an empty character vector and 
concatenate to it (simplest code), and John creates a vector of empty 
characters of the correct size [result - rep(, n.item * (n.item - 1) 
/ 2)]. The second solution is supposed to be better, because result is 
supposed to be of the right size, limiting useless memory pagination 
inside each loop iteration. However:

  system.time(generateIndex1(100))
[1] 4.86 0.00 4.86   NA   NA
  system.time(generateIndex2(100))
[1] 4.68 0.00 4.68   NA   NA

There is not much difference (well, indeed, the loops and what's 
calculated repreatedly inside takes much more time in this case). 
However, I wonder what happens if I allocate a vector of the right size 
with strings having also the right size:

generateIndex3 - function(n.item) {
 result - rep(i000.000, n.item * (n.item - 1) / 2)
 index - 0
 for (i in 1:(n.item - 1)) {
 for (j in ((i + 1):n.item)) {
 index - index + 1
 result[index] - paste(i,
 formatC(i, digits = 2, flag = 0), .,
 formatC(j, digits = 2, flag = 0), sep = )
 }
 }
 result
}

  system.time(generateIndex3(100))
[1] 4.63 0.02 4.66   NA   NA

... About the same. **Could someone explain me here, please?**

Now, where is the bottleneck?

  Rprof()
  res - generateIndex3(100)
  Rprof(NULL)
  ?summaryRprof
  summaryRprof()
$by.self
self.time self.pct total.time total.pct
formatC 0.48 10.5   4.30  93.9
paste   0.46 10.0   4.54  99.1
pmax0.44  9.6   0.66  14.4
as.integer  0.30  6.6   0.34   7.4
as.logical  0.24  5.2   0.34   7.4
names   0.20  4.4   0.24   5.2
...

Gosh! For sure: Why do I call FormatC() every time twice in the loop? I 
can increase speed by formatting my character strings only once!

generateIndex4 - function(n.item) {
 result - rep(i000.000, n.item * (n.item - 1) / 2)
 index - 0
 id - formatC(1:n.item, digits = 2, flag = 0)
 for (i in 1:(n.item - 1)) {
 for (j in ((i + 1):n.item)) {
 index - index + 1
 result[index] - paste(i, id[i], ., id[j], sep = )
 }
 }
 result
}

  system.time(generateIndex4(100))
[1] 0.33 0.00 0.33   NA   NA

Yes! That's much better.
Now, recall that it is better to use a vectorized algorithm than loops, 
could I get rid of these two ugly loops? Here is something using outer() 
and lower.tri():

generateIndex5 - function(n.item) {
 idx - function(x, y) paste(i, x, ., y, sep = )
 id - formatC(1:n.item, digits = 2, flag = 0)
 allidx - t(outer(id, id, idx))
 allidx[lower.tri(allidx)]
}

  system.time(generateIndex5(100))
[1] 0.02 0.00 0.02   NA   NA

Indeed! That code is much, much faster!
Now, let's compare generateIndex1() with generateIndex5().

- generateIndex5() is optimized for speed (4.86/0.02, about 250 times 
faster!)

- generateIndex5() is more concise code: 4 lines, no loops, compared to 
8 lines with two loops.

- but... generateIndex1() is the code that comes to mind more easily 
(except, perhaps for some R experts (?) because thinking with vectors is 
their second nature).

- but... generateIndex1() is much easier to understand, when someone 
else read the code (for the same reason).

Final conclusion:
generateIndex5() is a better R code (I am sure one can do even better!), 
but it is a little bit more intellectual work to arrive to this result 
(i.e., rethink the problem using matrix calculation). However, the 
result is worth the effort.

(note: this will be introduced in the future R Wiki. This is the reson 
why this email is so long: I took a good occasion to speak about code 
optimization).

Best,

Philippe Grosjean

Re: [R] R socket communication

2006-02-05 Thread Philippe Grosjean
See package svSocket in the SciViews bundle. It uses a socket server 
written in tcltk and it is not blocking the command line.

Philippe Grosjean

pau carre wrote:
 Hello, I tried to code a R socket server but I did not succeed.
 The problem is that once the R socket server is created,
 I call the readLines function and then R gets blocked.
 The client seems to work fine since I tested it with a PERL server.
 I tried many combination of params in the socketConnection but
 none of them worked.
 
 I have seen some examples where the server sends something to a
 client but I need the opposite example.
 
 Thanks,
 Pau.
 
 The R server
 
 FSsocket() - function(){
 print(Creating server on localhost)
 conn - socketConnection(server = TRUE, port = 7890, open = r+)
 print(Reading data)
 aa - readLines(conn)
 print(end reading lines)
 close(conn)
 pirnt(Connection closed)
 }
 Note: I receive a Creating server on localhost and a Reading data
 in the R console, but nothing else.
 
 The PERL client
 
 #! /usr/bin/perl
 use strict;
 use Socket;
 
 # initialize host and port
 my $host = shift || 'localhost';
 my $port = shift || 7890;
 
 my $proto = getprotobyname('tcp');
 
 my $iaddr = inet_aton($host);
 my $paddr = sockaddr_in($port, $iaddr);
 
 socket(SOCKET, PF_INET, SOCK_STREAM, $proto) or die socket: $!;
 connect(SOCKET, $paddr) or die connect: $!;
 print SOCKET Hello \n;
 close SOCKET or die close: $!;
 
 The PERL server
 
 #! /usr/bin/perl -w
 
 use strict;
 use Socket;
 
 my $port = shift || 7890;
 my $proto = getprotobyname('tcp');
 
 socket(SERVER, PF_INET, SOCK_STREAM, $proto) or die socket: $!;
 setsockopt(SERVER, SOL_SOCKET, SO_REUSEADDR, 1) or die setsock: $!;
 
 my $paddr = sockaddr_in($port, INADDR_ANY);
 
 bind(SERVER, $paddr) or die bind: $!;
 listen(SERVER, SOMAXCONN) or die listen: $!;
 print SERVER started on port $port ;
 
 my $client_addr;
 while ($client_addr = accept(CLIENT, SERVER))
 {
 my ($client_port, $client_ip) = sockaddr_in($client_addr);
 my $client_ipnum = inet_ntoa($client_ip);
 my $client_host = gethostbyaddr($client_ip, AF_INET);
 print Connection from: $client_host,[$client_ipnum] ;
 while(CLIENT){
 print $_;
 }
 close CLIENT;
 }
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
 


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


Re: [R] R command line: need intelligent command history recall?

2006-02-04 Thread Philippe Grosjean
Michael wrote:
 Hi all,
 
 I am not sure if this feature exists in the R-console command line prompt:
 
 In Matlab, if I want to enter a command which is similar to what I have
 entered before,
 
 I can enter a few prefix, then press -, the previous command that matches
 with this prefix will then appear on this command line, and it saves a lot
 of our time.
 
 For example:
 
 
abline(lm(new~old))
cor(new, old)
 
 ...
 ...
 ... many lines entered
 ...
 ...
 
 now I want to reuse abline(lm(new~old)),
 
 R-console provides - functionality to recall old commands, but it trace
 back one by one, it is slow if abline is way back, say 50 lines above my
 current command line... it is too slow.
 
 In Matlab, I just need to enter ab, then press -, if there is no other
 ab** between the abline and my current command line, then the
 console will intelligently recall abline back to me... Very convinient.
 
 Does this feature exist in R?
 
 Any other good Integrated Developement Environment for R?
 
 Perhaps R users are mathematicians and statisticians; but as a software
 engineer myself, I found a Visual C++-like integrated developement
 environment is really efficient and time-saving. It and Borland C++ Builder
 basically sets standard for modern UI design for programming IDEs.
 
 To be a good IDE, it really needs to have an embedded inline debugger. I've
 asked a statistician, he said he never debugged using a break-point,
 line-by-line execution debugger -- I cannot imagine this. Where is the
 productivity?
 
 I've used Tinn-R. Frankly it is quite creative. It solved the line-by-line
 execution problem by copying the line and pasted it to R-console
 automatically. But a lot of times clipboard generates error. And often times
 the copy and paste within Tinn editor itself are problemetic. For example, I
 have been never able to select a portion of a line. When I paste a
 paragraph, it always erases the current line and the following lines,
 instead of inserting, ...  and if I want to select one line, it always
 select two lines for me... etc.
 
 Anyway, I hope there is IDEs that are better than Tinn-R.
 
 Thanks a lot!

Please, submit a bug report to Tinn-R authors, if you want to see it 
improved.
Best,

Philippe Grosjean

__
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] matlab-like constant matrix initialization?

2006-01-30 Thread Philippe Grosjean
Sorry Michael, but I don't understand your question.
If you want to intialize a constant matrix (there is not such thing in 
R, just create a numerical matrix and use it without changing its 
values), you just use matrix(). For help and arguments of the function, 
type:

  ?matrix

Best,

Philippe Grosjean


Michael wrote:
 Hi all,
 
 Suppose I have the following matrix which is a constant matrix I've copied
 from some other document:
 
 1.2  3.4 1.4 ...
 2.3  3.7 2.6 ...
 ...
 
 How do I make it into a matrix or array in R?
 
 What is the fastest way of initializing a constant matrix with this
 copy/pasted values?
 
 Thanks a lot!
 
   [[alternative HTML version deleted]]
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
 


__
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] yet another vectorization question

2006-01-30 Thread Philippe Grosjean
Hello,

Not exactly the same. By the way, why do you use do.call()? Couldn't you 
do simply:

expand.grid(split(t(replicate(3, c(0, 1, NA))), 1:3))

Best,

Philippe Grosjean


Jacques VESLOT wrote:
 this looks similar:
 do.call(expand.grid,split(t(replicate(3,c(0,1,NA))),1:3))
 
 
 Adrian DUSA a écrit :
 
 
Dear R-helpers,

I'm trying to develop a function which specifies all possible expressions 
that 
can be formed using a certain number of variables. For example, with three 
variables A, B and C we can have
- presence/absence of A; B and C
- presence/absence of combinations of two of them
- presence/absence of all three

   A   B   C
1   0
2   1
3   0
4   1
5   0
6   1
7   0   0
8   0   1
9   1   0
10  1   1
11  0   0
12  0   1
13  1   0
14  1   1
15  0   0
16  0   1
17  1   0
18  1   1
19  0   0   0
20  0   0   1
21  0   1   0
22  0   1   1
23  1   0   0
24  1   0   1
25  1   1   0
26  1   1   1

My function (pasted below) while producing the desired result, still needs 
some more vectorizing; in particular, I can't figure out how could one modify 
the element of a matrix using apply on a different matrix...
To produce the above outcome, I use:
 


all.expr(LETTERS[1:3])
   


all.expr -
function(column.names) {
   ncolumns - length(column.names)
   return.matrix - matrix(NA, nrow=(3^ncolumns - 1), ncol=ncolumns)
   colnames(return.matrix) - column.names
   rownames(return.matrix) - 1:nrow(return.matrix)
   start.row - 1
   all.combn - sapply(1:ncolumns, function(idx) {
   as.matrix(combn(ncolumns, idx))
   }, simplify=FALSE)
   for (j in 1:length(all.combn)) {
   idk - all.combn[[j]]
   tt - matrix(NA, ncol=nrow(idk), nrow=2^nrow(idk))
   for (i in 1:nrow(idk)) {
   tt[,i] - c(rep(0, 2^(nrow(idk) - i)), rep(1, 2^(nrow(idk) - i)))
   }

   ## This is _slow_ part, where I don't know how to vectorize:
   for (k in 1:ncol(idk)) {
   end.row - start.row + nrow(tt) - 1
   return.matrix[start.row:end.row, idk[ , k]] - tt
   start.row - end.row + 1
   }
   ## How can one modify return.matrix using apply on idk?
   }
   return.matrix[is.na(return.matrix)] - 
   return.matrix
   }
}

Thank you in advance,
Adrian

 

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


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


Re: [R] Help with R: functions

2006-01-30 Thread Philippe Grosjean
# Here it is (using the formula interface):
dats - data.frame(visual24 = rnorm(30, 3, 5),
visual52 = rt(30, 7))

st - function(formula, data, ...) {
# Just use the formula to specify which variables to use
rcc - coef(lm(formula, data))
# Make sure to keep only variable used in the data frame
plot(data[ , rev(all.vars(formula))])
# Draw the line. Note the ... that allows to change
#lines features
abline(coef = rcc, ...)
# Return the coefficients invisibly
return(invisible(rcc))
}

st(visual52 ~ visual24, data = dats)
# Change style and color of the line (thanks to '...')
st(visual52 ~ visual24, data = dats, lty = 2, col = red)

Best,

Philippe Grosjean


Pryseley Assam wrote:
 Hello R-users

   I am new to R and trying to write some functions. I have problems writing 
 functions that takes a data set as an arguement and uses variables in the 
 data. I illustrate my problem with a small example below:

sample data   #--
   visual24-rnorm(30,3,5)
   visual52-rt(30,7)
   dats- data.frame(cbind(visual24,visual52))
   remove(visual24, visual52)

   # first code
   #--
   st -function(data,x,y){
   rcc-coef(lm(y~x))
   plot(x,y)
   abline(rcc[1],rcc[2])
   }
   st(data=dats,x=dats$visual24,y=dats$visual52)

   This code works fine, but with such a code the data as an arguement to the 
 funtion is not necessary. 
   However, i wish to write a function that reads the variables from the data 
 directly.
   I tried using the function below but it does not work. 

   # second code
   #--
   st -function(data,x,y){
   rcc-coef(lm(data$y~data$x))
   plot(data$x,data$y)
   abline(rcc[1],rcc[2])
   }
   st(dats,visual24,visual52)

   I wish to inquire if any one has an idea of what i need to adjust in the 
 function so that it works.
   I believe that the referencing $x or $y in the function is not doing the 
 correct thing.

   Better still, will it be a problem if i code the functions as in the first 
 code above?
   I mean given that they will be used to create a library

   Best regards
   Pryseley

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


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


Re: [R] What's wrong with Rcmdr?

2006-01-27 Thread Philippe Grosjean
Michael wrote:
 thanks everyone, another problem is I cannot load Rcmdr at all in SCIView...
 what might be the problem?

Not a problem, but a version incompatibility: SciViews is compiled for a 
given version of R and Rcmdr (the one on the Web site is for R 2.2.0 and 
Rcmdr 1.0-3... that is, not the latest ones). I still have to upload 
latest SciViews version compatible with both latest versions.
Best,

Philippe Grosjean

 On 1/26/06, John Fox [EMAIL PROTECTED] wrote:
 
Dear Michael,

To elaborate slightly: You can't load the same package twice in an R
session. As mentioned, used Commander() to restart the Rcmdr GUI.

I hope this helps,
John


John Fox
Department of Sociology
McMaster University
Hamilton, Ontario
Canada L8S 4M4
905-525-9140x23604
http://socserv.mcmaster.ca/jfox



-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Stefano Calza
Sent: Thursday, January 26, 2006 4:23 AM
To: r-help@stat.math.ethz.ch
Subject: Re: [R] What's wrong with Rcmdr?

Try using

Commander()

but, obviously, the first time.

HIH,
Ste

On Thu, Jan 26, 2006 at 01:11:23AM -0800, Michael wrote:
MichaelHi all,
Michael
MichaelI successfully installed Rcmdr. And I type
library(Rcmdr), nothing Michaelhappened; Michael
Michaelor if I select menu item load package and select
Rcmdr, still nothing Michaelhappened...
Michael
MichaelWhy didn't Rcmdr start?
Michael
MichaelVery strangely, if I close the R console and restart
R console, every first Michaeltime I load Rcmdr, it
starts! But not second, third time...
Michael
MichaelWhat's wrong with it?
Michael
MichaelThanks a lot!
Michael
MichaelMichael.
Michael
Michael [[alternative HTML version deleted]]
Michael
Michael__
MichaelR-help@stat.math.ethz.ch mailing list
Michaelhttps://stat.ethz.ch/mailman/listinfo/r-help
MichaelPLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html

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


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


__
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] [Q] extracting lower diagonal elements of a matrix

2006-01-27 Thread Philippe Grosjean
Try:
  data[lower.tri(data)]

(the same as data[col(data)  row(data)], but using the dedicated function).
Best,

Philippe Grosjean

Christos Hatzis wrote:
 Try
 
 s - matrix(rnorm(36,0,1),nrow=6)
 s[col(s)row(s)]
 
 Courtesy of VR.
 
 -Christos 
 
 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On Behalf Of Taka Matzmoto
 Sent: Friday, January 27, 2006 1:13 AM
 To: r-help@stat.math.ethz.ch
 Subject: [R] [Q] extracting lower diagonal elements of a matrix
 
 Hi R users
 
 I like to extract lower diagonal elements of a matrix in such a way like,
 data[1,2], data[1,3], , data[5,6] are extracted from a matrix called
 'data'
 
 This short script below is what I have written so far.
 
 ##
 data - matrix(rnorm(36,0,1),nrow=6)
 temp-c()
 for (i in 1:(nrow(data)-1))
 {
 for (j in (i+1):nrow(data))
 {
 temp-append(temp,data[j,i])
 }
 }
 ##
 
 Is there any function for this?  or is there any elegant way to do this
 task?
 
 Thanks in advance.
 
 TM
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide!
 http://www.R-project.org/posting-guide.html
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
 


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


Re: [R] regular expressions, sub

2006-01-27 Thread Philippe Grosjean
Hello,

Here is what I got after playing a little bit with your problem:

# First of all, if you prefer 'ln' instead of 'log', why not to define:
ln - function(x) log(x)
ln2 - function(x) log(x)^2
ln3 - function(x) log(x)^3
ln4 - function(x) log(x)^4
# ... as many function as powers you need

# Then, your formula is now closer to what you want
# which makes the whole code easier to read for you:

Form - ln(D) ~ ln(N) + ln2(N) + ln(t) # Same as your original formula

# Here is the function to transform it in a more readable string:
formulaTransform -
function(form, as.expression = FALSE) {
 if (!inherits(form, formula))
 stop('form' must be a 'formula' object!)

 # Transform the formula into a string (is it a better way?)
 Res - paste(as.character(form)[c(2, 1, 3)], collapse =  )

 if (as.expression) { # Transform the formula in a nice expression
 # Change '~' into '=='
 Res - sub(~, %~~%, Res) # How to do '~' in an expression?
 # Eliminate brackets
 Res - gsub([(]([A-Za-z0-9._]*)[)],  ~ \\1, Res)
 # Transform powers
 Res - gsub(ln([2-9]), ln^\\1, Res)
 Res - eval(parse(text = Res))
 } else { # Make a nicer string
 # Eliminate brackets
 Res - gsub([(]([A-Za-z0-9._]*)[)],  \\1, Res)
 # Transform powers
 Res - gsub(ln([2-9]), ln^\\1, Res)
 }

 # Return the result
 return(Res)
}

# Here is a nicer presentation as a string
formulaTransform(Form)

# Here is an even nicer presentation (creating an expression)
plot(1:3, type = n)
text(2, 2, formulaTransform(Form, TRUE))

# The later form is really interesting when you use, for instance,
# greek letters for variables, or so...
Form2 - ln(alpha) ~ ln(beta) + ln2(beta) + ln3(beta)

formulaTransform(Form2)
plot(1:3, type = n)
text(2, 2, formulaTransform(Form2, TRUE))

# ... but this could be refined even more!

Best,

Philippe Grosjean

..°}))
  ) ) ) ) )
( ( ( ( (Prof. Philippe Grosjean
  ) ) ) ) )
( ( ( ( (Numerical Ecology of Aquatic Systems
  ) ) ) ) )   Mons-Hainaut University, Pentagone (3D08)
( ( ( ( (
..

Christian Hoffmann wrote:
 Hi,
 
 I am trying to use sub, regexpr on expressions like
 
 log(D) ~ log(N)+I(log(N)^2)+log(t)
 
 being a model specification.
 
 The aim is to produce:
 
 ln D ~ ln N + ln^2 N + ln t
 
 The variable names N, t may change, the number of terms too.
 
 I succeded only partially, help on regular expressions is hard to 
 understand for me, examples on my case are rare. The help page on R-help 
 for grep etc. and regular expressions
 
 What I am doing:
 
 (f - log(D) ~ log(N)+I(log(N)^2)+log(t))
 (ft - sub(,,f))   # creates string with parts of formula, how to do 
 it simpler?
 (fu - paste(ft[c(2,1,3)],collapse= ))  # converts to one string
 
 Then I want to use \1 for backreferences something like
 
 (fv - sub(log( [:alpha:] N  )^ [:alpha:),ln \\1^\\2,fu))
 
 to change log(g)^7 to ln^7 g,
 
 and to eliminate I(): sub(I(blabla),\\1,fv)  # I(xxx) - xxx
 
 The special characters are making trouble, sub acceps (, ) only in 
 pairs. Code for experimentation:
 
 trysub - function(s,t,e) {
 ii-0; for (i1 in c(TRUE,FALSE)) for (i2 in c(TRUE,FALSE)) for (i3 in 
 c(TRUE,FALSE)) for (i4 in c(TRUE,FALSE)) 
 print(paste(ii-ii+1,ifelse(i1,  , ~),ext,ifelse(i2,  , 
 ~),perl,ifelse(i3,  , ~),fixed ,ifelse(i4,  , ~),useBytes: 
 , try(sub(s,t,e, extended=i1, perl=i2, fixed=i3, 
 useBytes=i4)),sep=));invisible(0) }
 
 trysub(I(log(N)^2),ln n^2,fu) # A: desired result for cases 
 5,6,13..16, the rest unsubstituted
 
 trysub(log(,ln ,fu)   # B: no substitutions; errors for 
 cases 1..4,7.. 12   # typical errors:
 3  ext  perl ~fixed   useBytes: Error in sub.perl(pattern, replacement, 
 x, ignore.case, useBytes) : \n\tinvalid regular expression 'log('\n
 
 trysub(log\(,ln ,fu)  # C: same as A
 
 trysub(log\\(,ln ,fu) # D: no substitutions; errors for 
 cases 15,16# typical errors:
 15 ~ext ~perl ~fixed   useBytes: Error in sub(pattern, replacement, x, 
 ignore.case, extended, fixed, useBytes) : \n\tinvalid regular expression 
 'log\\('\n
 
 trysub(log\\(([:alpha:]+)\\),ln \1,fu) # no substitutions, no errors
 # E: typical errors:
 3  ext  perl ~fixed   useBytes: Error in sub.perl(pattern, replacement, 
 x, ignore.case, useBytes) : \n\tinvalid regular expression 
 'log\\(([:alpha:]+)\\)'\n
 
 
 
 Thanks for help
 Christian
 
 PS. The explanations in the documents

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


Re: [R] What's wrong with Rcmdr?

2006-01-26 Thread Philippe Grosjean
I am afraid that you must be a little bit more verbose on your 
problem. You do not provide enough information to spot your problem.
Best,

Philippe Grosjean

Michael wrote:
 Hi all,
 
 I successfully installed Rcmdr. And I type library(Rcmdr), nothing
 happened;
 
 or if I select menu item load package and select Rcmdr, still nothing
 happened...
 
 Why didn't Rcmdr start?
 
 Very strangely, if I close the R console and restart R console, every first
 time I load Rcmdr, it starts! But not second, third time...
 
 What's wrong with it?
 
 Thanks a lot!
 
 Michael.
 
   [[alternative HTML version deleted]]
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
 


__
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] reducing learning curves?

2006-01-26 Thread Philippe Grosjean
Michael wrote:
 Hi all,
 
 Are there any R addon/pluggins with the following feature:
 
 (1) command history? even stores the command history many days ago? Like
 Matlab does?

See ?history, and also, menu entries File - Load/Save history... in 
Rgui (you use R under windows, isn't it?). also, if you answer Yes at 
the question Save workspace image? when you quit R, the history of 
commands is saved and resored next time you start R from the same 
directory.

 (2) online help? for example, as I see it, the Rcmdr is a good companian for
 a newbie like me who just touched R for 1.5 days. I can use Rcmdr to guide
 me to learn the commands to use for data analysis. However, Rcmdr does not
 have online help reference for R commands. For example, I saw the command
 abline and I want to know how to use it, I have to copy/type it in
 R-console, and do ?abline things, so that I can obtain help. But this is
 troublesome, does any editor offer online-help for commands, so I just need
 to hover my mouse on abline and then press F1 key then a help window will
 open automatically?

Well, it is not much work to type

  ?abline

However, if you want a button that you can click to do so, then look at 
http://www.sciviews.org/Tinn-R. That editor is definitely for you!
Best,

Philippe Grosjean

 Thanks a lot!
 
 On 1/25/06, Michael [EMAIL PROTECTED] wrote:
 
Hi all,

I am really new to the R language. I am a long time Matlab and C++ user
and I was forced to learn R because I am taking a statistics class.

I am seeking to reduce the learning curve to as smooth as possible.

Are there any addon/plug-in features that can reduce the learning curve,
for example, the following features can be very helpful for new learners:

1. Matlab-like command line auto-completion: Matlab has huge amount of
command and nobody is able to remember them off the head. So a nice feature
of Matlab command line is that I just need to type the first a few letters
and then I press TAB key, there will be a list of possible commands
popping up so I just need to select one. This helps a lot in terms of
learning for new comers. A more advanced command auto-completion is Visual
C++-like, which is implemented in program editor. It helps a lot while doing
programming;

2. A good IDE editor with embedded inline debugger: can be as good as
VC++, but also can be as simple as Matlab's debugger, which can breakpoint
and trace line-by-line... the editor can do syntax correction, syntax check,
syntax highlighting, code formatting, etc.

Could you please recommend some good addon/plugins that have the above
features?

Could you please also suggest some tips/tools/tricks that can help me
reduce the learning curve?

Thank you very much!

Michael.



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


__
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] efficiency with %*%

2006-01-26 Thread Philippe Grosjean
Excellent, but...

  x - rnorm(100)
  y - rnorm(100)
  system.time(x%*%y)
[1] 0.03 0.00 0.03   NA   NA
  system.time(sum(x*y))
[1] 0.05 0.00 0.04   NA   NA
  system.time(crossprod(x, y))
[1]  0  0  0 NA NA

So, to paraphrase a well-known contributor on this mailing list:
Excellent! So, what did you decided to do during the next 30 
milliseconds you will save by using crossprod() instead of x%*%y?
(joke)

Best,

Philippe Grosjean

P.S.: Uwe, perhaps you should consider buying a faster computer, isn't 
it? :-()

Uwe Ligges wrote:
 [EMAIL PROTECTED] wrote:
 
 
Hi,

x and y are (numeric) vectors. I wonder if one of the following is more
efficient than the other:

x%*%y

or

sum(x*y)
?
 
 
 I'd try
 
x - rnorm(100)
y - rnorm(100)
system.time(x%*%y)
system.time(sum(x*y))
 
 and finally (hint, hint!):
 
system.time(crossprod(x, y))
 
 Uwe Ligges
 
 
 
Thanks,
Dimitri Szerman

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


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


Re: [R] reducing learning curves?

2006-01-25 Thread Philippe Grosjean
Hello,
If you work under Windows, you can find a lot of useful tools in 
SciViews-R (http://www.sciviews.org/SciViews-R) and Tinn-R 
(http://www.sciviews.org/Tinn-R). For instance, you have:
- syntax coloring,
- code completion,
- calltips (tips displaying the syntax of a function as you type it),
- object explorer with lots of useful shortcuts in the object's context 
menu,
- electronic reference cards,
- viewing and reproting features,
- etc...

For a nice, graphical, debugger, look at debug package (you have to 
install it from CRAN and load it using:
  library(debug)
Then, try:
  ?mtrace

Best,

Philippe Grosjean

Michael wrote:
 Hi all,
 
 I am really new to the R language. I am a long time Matlab and C++ user and
 I was forced to learn R because I am taking a statistics class.
 
 I am seeking to reduce the learning curve to as smooth as possible.
 
 Are there any addon/plug-in features that can reduce the learning curve, for
 example, the following features can be very helpful for new learners:
 
 1. Matlab-like command line auto-completion: Matlab has huge amount of
 command and nobody is able to remember them off the head. So a nice feature
 of Matlab command line is that I just need to type the first a few letters
 and then I press TAB key, there will be a list of possible commands
 popping up so I just need to select one. This helps a lot in terms of
 learning for new comers. A more advanced command auto-completion is Visual
 C++-like, which is implemented in program editor. It helps a lot while doing
 programming;
 
 2. A good IDE editor with embedded inline debugger: can be as good as VC++,
 but also can be as simple as Matlab's debugger, which can breakpoint and
 trace line-by-line... the editor can do syntax correction, syntax check,
 syntax highlighting, code formatting, etc.
 
 Could you please recommend some good addon/plugins that have the above
 features?
 
 Could you please also suggest some tips/tools/tricks that can help me reduce
 the learning curve?
 
 Thank you very much!
 
 Michael.
 
   [[alternative HTML version deleted]]
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
 


__
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] read.table problem

2006-01-25 Thread Philippe Grosjean
Hello,
Well... the error message is explicit enough: number of items read is 
not a multiple of the number of columns means that you do not have the 
right number of items around line 11975 (not the same number as in the 
11974 previous lines)! This is an error in you file.
Best,

Philippe Grosjean

Andrej Kastrin wrote:
 Dear R useRs,
 
 I have big (23000 rows), vertical bar delimited file:
 
 e.g.
 A1|Text a,Text b, Text c|345
 A2|Text bla|456
 ...
 ..
 .
 
 Try using
 
 A - read.table('filename.txt', header=FALSE,sep='\|')
  
 process stop at line 11975 with warning message:
 number of items read is not a multiple of the number of columns
 
 I have no problems with processing similar file, which is only 1 
 rows long?
 
 Any suggestion what's the problem here. Thank's in advance.
 
 Cheers, Andrej
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
 


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


Re: [R] paste - eliminate spaces?

2006-01-25 Thread Philippe Grosjean
Just read more carefully the online help for paste (?paste).
You have:

sep: a character string to separate the terms.

and the default value for sep is   (a space).
So, just use:

  paste(test, 1, sep = )

Best,

Philippe Grosjean

r user wrote:
 I am trying to combine the value of a variable and
 text.
 
 e.g.
 I want “test1”, with no spaces.
 
 I try:
 
 h=1
 paste(‘test’,1)
 
 But get:
 [1] test 1
 
 (i.e. there is a space between “test’“ and “1”)
 
 Is there a way to eliminate the space?
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
 


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


Re: [R] Can R handle medium and large size data sets?

2006-01-24 Thread Philippe Grosjean
Hello,

This is not true that R cannot handle matrices of 100 000's 
observations... but:
- Importation (typically using read.table() and the like) saturates 
much faster. Solution: use scan() and fill a preallocated matrix, or 
better, use a database.

- Data frames are very nice objects, but if you handle only numeric 
data, do prefer matrices: they consume less memory. Also, avoid using 
row/column names for very large matrices/data frames.

- Finally, of course, your mileage varies greatly depending on the 
calculation you do on your data.

In general, the relatively widely admitted idea that R cannot handle 
large datasets originates from: using read.table() / data frames / non 
optimized code.

As an example, I can create a matrix of 150 000 observations (you don't 
tell us how many variables, so, I took 20 columns) filled with random 
numbers, and calculate the mean for each variable very easily. Here it is:

  gc()
  used (Mb) gc trigger (Mb) max used (Mb)
Ncells 168994  4.6 35  9.4   35  9.4
Vcells  62415  0.5 786432  6.0   290343  2.3
  system.time(a - matrix(runif(15 * 20), ncol = 20))
[1] 0.48 0.05 0.55   NA   NA
  # Just a little bit more than half a second to create a table of
  # 3 millions entries filled with random numbers (P IV, 3Ghz, Win XP)
  dim(a)
[1] 15 20

  system.time(print(colMeans(a)))
  [1] 0.4998859 0.5004760 0.4994155 0.5000711 0.5005029
  [6] 0.4999672 0.5003233 0.5000419 0.4997827 0.5004858
[11] 0.5004905 0.4993428 0.4991187 0.5000143 0.5016212
[16] 0.4988943 0.4990586 0.5009718 0.4997235 0.5001220
[1] 0.03 0.00 0.03   NA   NA
  # 30 milliseconds to calculate the mean of all 20
  # variables over 150 000 observations

  gc()
   used (Mb) gc trigger (Mb) max used (Mb)
Ncells  169514  4.6 35  9.4   35  9.4
Vcells 3062785 23.49317558 71.1  9062793 69.2
  # Less than 30 Mb used (with a peak at 80 Mb)

Isn't it manageable?
Best,

Philippe Grosjean

Gueorgui Kolev wrote:
 Dear R experts,
 
 Is it true that R generally cannot handle  medium sized data sets(a
 couple of hundreds of thousands observations) and threrefore large
 date set(couple of millions of observations)?
 
 I googled and I found lots of questions regarding this issue, but
 curiously there were no straightforward answers what can be done to
 make R capable of handling data.
 
 Is there sth inherent in the structure of R that makes it impossible
 to work with say 100 000observations and more? If it is so, is there
 any hope that R can be fixed in the future?
 
 My experience is rather limited---I tried to load a Stata data set of
 about 15observations(which Stata handles instantly) using the
 library foreign. After half an hour R was still thinking so I
 stopped the attempts.
 
 Thank you in advance,
 
 Gueorgui Kolev
 
 Department of Economics and Business
 Universitat Pompeu Fabra
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
 


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


Re: [R] Image Processing packages

2006-01-23 Thread Philippe Grosjean
Hello,

There are a couple of things for image processing in R (look at pixmap 
and Rimage, for instance). However, R is *not* a good software for 
processing images (nor is Matlab, Octave, IDL: they use to have specific 
packages for image processing and analysis, but resulting applications 
are way to slow in comparison to dedicated software).

A good approach is to mix ImageJ and R, if you are looking for an Open 
Source solution. You could look at ZooImage for an example application 
using these two software (analysis of digital zooplankton images, see: 
http://www.sciviews.org/zooimage).

Best,

Philippe Grosjean


Thomas Kaliwe wrote:
 Hi,
  
 I've been looking for Image Processing packages. Thresholding, Edge
 Filters, Dct, Segmentation, Restoration. I'm aware, that Octave, Matlab
 etc. would be a good address but then I'm missing the statistical
 power  of R. Does anybody know of packages, projects etc. Comments on
 wether the use of R for such matters is useful are welcome.
  
 Greetings
  
 Thomas Kaliwe
 
   [[alternative HTML version deleted]]
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
 


__
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] Image Processing packages

2006-01-23 Thread Philippe Grosjean
[EMAIL PROTECTED] wrote:
 Philippe, I am trying to get there but I keep on receiving a blank file after 
 5
 minutes, is there something wrong with the site?
 H.Ghezzo
 McGill University
 Montreal - Canada

Well, I am trying myself. Indded, it seems that my server is down, or 
very busy. I will look at this tomorrow.
Best,

Philippe Grosjean

 Quoting Philippe Grosjean [EMAIL PROTECTED]:
 
 
Hello,

There are a couple of things for image processing in R (look at pixmap
and Rimage, for instance). However, R is *not* a good software for
processing images (nor is Matlab, Octave, IDL: they use to have specific
packages for image processing and analysis, but resulting applications
are way to slow in comparison to dedicated software).

A good approach is to mix ImageJ and R, if you are looking for an Open
Source solution. You could look at ZooImage for an example application
using these two software (analysis of digital zooplankton images, see:
http://www.sciviews.org/zooimage).

Best,

Philippe Grosjean


Thomas Kaliwe wrote:

Hi,

I've been looking for Image Processing packages. Thresholding, Edge
Filters, Dct, Segmentation, Restoration. I'm aware, that Octave, Matlab
etc. would be a good address but then I'm missing the statistical
power  of R. Does anybody know of packages, projects etc. Comments on
wether the use of R for such matters is useful are welcome.

Greetings

Thomas Kaliwe

 [[alternative HTML version deleted]]

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

http://www.R-project.org/posting-guide.html


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

 
 
 
 


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


Re: [R] In which application areas is R used?

2006-01-23 Thread Philippe Grosjean
You could probably add:
- Fisheries modelling
- Oceanography

Although there is still resistance of other software there, R is gaining 
more and more users in these fields.
Best,

Philippe Grosjean

P.S.: if you need actual examples, just ask... ;-)

John Maindonald wrote:
 If anyone has a list of application areas where there is
 extensive use of R, I'd like to hear of it. My current
 short list is:
 
 Bioinformatics
 Epidemiology
 Geophysics
 Agriculture and crop science
 
 John Maindonald
 Mathematical Sciences Institute, Australian National University.
 [EMAIL PROTECTED]
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
 


__
R-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] Easy, Robust and Stable GUI???

2006-01-23 Thread Philippe Grosjean
Yes, Rcmdr is certainly the closest match. Note, however, that there are 
good reasons not to replicate SPSS style of GUI. This is because driving 
an analysis using scripts has three major advantages:

- flexibility: a good, high-level programming language allows to do much 
more than even the best GUI. This is because, as soon as you have 
programmed a dialog box, you restrict possibilities to the couple of 
choices that you hardcoded in that dialog box. With R, the only limit is 
your imagination (if something does not exist, you can program it by 
yourself).

- traceability: with a GUI, how do you remember all the mouse clicks 
that led you to a given analysis? On the contrary, a script is an 
accurate record of all steps.

- comprehension: to construct a R script, you must understand the 
analysis. R forces to learn the logic behind *before* you can run that 
analysis. With a menu/dialog box interface, you can click everywhere and 
get results by chance. Statistical packages with intuitive GUIs tend 
to stimulate lazyness: here, come! Look like I am a sexy GUI! Look, I 
am sooo easy to use! And I can deliver you plenty of results, ... No, 
no, don't be afraid, you don't need to understand what you're doing. 
Just click me!.

So, all GUIs proposed for R are just ways to learn in an easier way how 
to write R scripts. Even R Commander tries hard to stimulate use of R 
scripts... and you should consider a lack of a good GUI for R as a 
sign of quality and nothing else.

Best,

Philippe Grosjean

Achim Zeileis wrote:
 On Mon, 23 Jan 2006 12:44:49 -0800 (PST) pat_primate (sent by
 Nabble.com) wrote:
 
 
I know that this isn't really a R help question, but I am a
psychology student at TRU (tru.ca) and my psych department is going
to be switching statistical software in the near future.  I thought
this might be a good oppertunity to advocate for open source if an
acceptable option is available.  I have looked around a bit and R
seems to be the most stable and mature (not to mention powerful) open
source statistical program going.  The only downfall is that the
school has been using spss for years and would demand a similarly
user friendly GUI based statistical program to replace it.  I have
looked at a few of the R guis and most of them look like they are
just command line interfaces in pretty desktop windows and not really
a gui like spss.  If anyone knows of any stable, userfriendly and
robust guis for R that would be similar to using spss please let me
know, as I would love for my school to start embracing open source
software.
 
 
 Have you looked at John Fox's Rcmdr package?
 See
   http://socserv.mcmaster.ca/jfox/Misc/Rcmdr/
 and
   John Fox (2005). The R Commander: A Basic-Statistics Graphical User
   Interface to R, Journal of Statistical Software, 14(9). URL
   http://www.jstatsoft.org/
 
 Also look at http://www.sciviews.org/_rgui/ for an overview of other
 GUI projects.
 
 Best,
 Z
 
 
Thanks

Pat
--
View this message in context:
http://www.nabble.com/Easy%2C-Robust-and-Stable-GUI--t982193.html#a2543480
Sent from the R help forum at Nabble.com.

  [[alternative HTML version deleted]]

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

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


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


Re: [R] function for rowMedian?

2006-01-22 Thread Philippe Grosjean
Prof Brian Ripley wrote:
 Interchange 1 and 2 (see ?apply: Andy was answering the subject line, not 
 that in the body).
 
 However, Max asked also for column medians of a data frame, for which use 
 sapply(DF, median)

By the way, what is the preferred code for column-wise calculation on 
*all numeric* data in a data frame?
  sapply(DF, median)
which considers the list and then simplifies the results down to a 
vector or matrix,... or
  apply(DF, 2, median)
which first convert into a matrix and then do the calculation on it?
Best,

Philippe Grosjean


 I didn't understand the question, and it seems I was not alone :)
 
 On Fri, 20 Jan 2006, Philippe Grosjean wrote:
 
 
Note that there is a confusion here: 1st dimension is row, 2nd dimension
is column for matrix  data.frame.
 
 
 And the dim arg to apply is the one you want the answer to have.
 
 A - matrix(runif(6), 2, 3)
 apply(A, 1, median) # row medians
 apply(A, 2, median) # col medians
 
 
 
So, if the question is about rowMedian, you have:


rowMedian - function(x, na.rm = FALSE)
apply(x, 2, median, na.rm = na.rm)

Now, you ask for the median for specified columns, which should be as
Andy proposes you, or, if you really want a colMedian function:


colMedian - function(x, na.rm = FALSE)
apply(x, 1, median, na.rm = na.rm)

Best,

Philippe Grosjean

Liaw, Andy wrote:

apply(x, 1, median) should do it.  If not, you need to explain why.

Andy

-Original Message-
From: Max Kauer
Sent: Friday, January 20, 2006 10:24 AM
To: r-help@stat.math.ethz.ch
Subject: [R] function for rowMedian?


Hi
is anybody aware of a function to calculate a the median for specified
columns in a dataframe or matrix - so analogous to rowMeans?
Thanks
Max
 


__
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] function for rowMedian?

2006-01-20 Thread Philippe Grosjean
Note that there is a confusion here: 1st dimension is row, 2nd dimension 
is column for matrix  data.frame.
So, if the question is about rowMedian, you have:

  rowMedian - function(x, na.rm = FALSE)
  apply(x, 2, median, na.rm = na.rm)

Now, you ask for the median for specified columns, which should be as 
Andy proposes you, or, if you really want a colMedian function:

  colMedian - function(x, na.rm = FALSE)
  apply(x, 1, median, na.rm = na.rm)

Best,

Philippe Grosjean

Liaw, Andy wrote:
 apply(x, 1, median) should do it.  If not, you need to explain why.
 
 Andy
 
 -Original Message-
 From: Max Kauer
 Sent: Friday, January 20, 2006 10:24 AM
 To: r-help@stat.math.ethz.ch
 Subject: [R] function for rowMedian?
 
 
 Hi
 is anybody aware of a function to calculate a the median for specified
 columns in a dataframe or matrix - so analogous to rowMeans?
 Thanks
 Max
 
 --
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide!
 http://www.R-project.org/posting-guide.html
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
 


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


[R] R Wiki and R-sig-wikii

2006-01-18 Thread Philippe Grosjean
Hello all,

This is to announce the creation of R-sig-wiki, a new R SIG (Special 
Interest Group) mailing list dedicated to the elaboration and 
maintenance of a R Wiki. You can subscribe at: 
https://stat.ethz.ch/mailman/listinfo/r-sig-wiki. There is currently a 
prototype for a new R Wiki at http://www.sciviews.org/_rgui/wiki 
(temporary address). The main idea is to offer a site where users could 
collaborate in writting various kind of documentation for R. It mainly 
targets R beginners, but is left open for more advanced sections. Any R 
user interested in the setting up of this Wiki is warmly welcome to 
participate and to subscribe to R-sig-wiki. For the others, we will send 
an announcement for the final R Wiki on this list when it will be ready. 
Hereunder is a (rather long) summary of the discussion we had so far on 
this topic.
Best,

Philippe Grosjean

==
There is a proposition to create a R Wiki, stimulated essentially by two 
facts:

1) The traffic in R-Help is very high, with many trivial questions 
asked repeatedly. Obviously, searching in R-Help archives is not so 
obvious for some R users. Perhaps another presentation, like plain HTML 
pages would be fine. Since the building of these HTML pages should be a 
collaborative work, a Wiki seems to be a possible solution (recall that 
a Wiki is essentially a simple way to collaborate on writting Web pages; 
see Wikipedia definition at http://en.wikipedia.org/wiki/Wiki).

2) Some threads in R-Help are very long and difficult to follow in the 
form of a succession of emails. Again, a more structured presentation, 
allowed by HTML / Wiki pages is suggested as a possible solution.

There is already one attempt to build a Wiki by Detlef Steuer at: 
http://fawn.unibw-hamburg.de/cgi-bin/Rwiki.pl. Despite not much effort 
was put in this wiki, several people collaborated to it with time, but 
it appears that it was below the minimum required to make it fly as it 
should.

Being unaware of that Wiki, I proposed recently (beginning of January 
2006) a prototype of another R Wiki, just to explore if and how it could 
answer those two problems on R-Help. The prototype is at 
http://www.sciviews.org/_rgui/wiki (temporary address).

There is a couple of other Wikis dedicated to R floating around, like: 
http://www.okada.jp.org/RWiki/ (in Japanese) and 
http://learnserver.csd.univie.ac.at/rcomwiki dedicated to R(D)COM and 
RExcel essentially.

After a discussion, the R-Core Team decided to give support to one or 
several intiatives to make a R Wiki, with a big concern about the 
quality of information in the Wiki and how to keep it in phase with the 
rapid development of R. Here is the mail send by Martin Maechler:


Martin Maechler wrote:
 We've had a small review time within R-core on this topic,
 amd would like to state the following:
 
 
  The R-core team welcomes proposals to develop an R-wiki.
 
 - We would consider linking a very small number of Wikis (ideally one)
   from www.r-project.org and offering an address in the r-project.org
   domain (such as 'wiki.r-project.org').
 
 - The core team has no support time to offer, and would be looking for
   a medium-term commitment from a maintainer team for the Wiki(s).
 
 - Suggestions for the R documentation would best be filtered through
   the Wiki maintainers, who could e.g. supply suggested patches during
   the alpha phase of an R release.
 --
 
 Our main concerns have been about ensuring the quality of such extra
 documentation projects, hence the 2nd point above.
 Several of our more general, not mainly R, experiences have been
 of outdated web pages which are continued to be used as
 reference when their advice has long been superseded.
 I think it's very important to try ensuring that this won't
 happen with an R Wiki.
===

After that announcement, several people started to discuss the structure 
and content of the Wiki (Tony Plate and Ben Bolker took the initiative 
to propose one structure on the experimental R Wiki at: 
http://www.sciviews.org/_rgui/wiki/doku.php?id=varia:organization_discussion, 
and I propose to leave it open until the end of February. At that time, 
we will implement the proposed structure as a proof-of-concept.

Another topic is about how to allow discussion on the R documentation in 
the Wiki. This topic was fed by Frank Harrell Jr, Gabor Grothendieck and 
others and it leads to a trial on: 
http://www.sciviews.org/_rgui/wiki/doku.php?id=varia:test_include. 
Basically, all CRAN and Bioconductor .Rd files would be converted 
automatically to read-only Wiki pages (regularly updated) that are 
themselves included in  fully

Re: [R] A comment about R:

2006-01-05 Thread Philippe Grosjean
David Forrest wrote:
  [...]
  Any volunteers?

Yes, me (well, partly...)! Here is what I propose: this is a very 
lengthy thread in R-Help, with many interesting ideas and suggestions. I 
fear that, as it happens too often, those nice ideas will be lost 
because of the support used: email! By nature, emails are read and then 
deleted (well, there is the R-Help archive, but anyway, threads in a 
mailing list is not at all the best tool to make collaborative documents 
like those tutorials and co).

I just cooked a little Wiki *dedicated to R beginners* (meaning they can 
contribute too, and are very welcome to discuss their problems -possibly 
trivial for others-). It is available at 
http://www.sciviews.org/_rgui/wiki. For the moment, everyone can edit 
and add pages, but I will restrict rights in the future to logged users 
only (with everybody allowed to log in at any time). So that we will be 
able to track who made changes (authorship).

For those who do not know the Wiki concept, it is a very simple way of 
working together in the same documents. The concept has proven very 
powerful with a good example being Wikipedia, that is becoming one of 
the largest encyclopedia in the world... and also as accurate as 
Encyclopedia Britannica (but read this: 
http://www.nature.com/news/2005/051212/full/438900a.html).

Here is the introduction of the R (GUI) Wiki:

This Wiki is mainly dedicated to deal with R beginners problems. 
Although we would like to emphasize using R GUIs (Graphical User 
Interfaces), this Wiki is not restricted to those GUIs: one can also 
deal with command-line approaches. The main idea is thus to have 
material contributed by both beginners, and by more advanced R users, 
that will help novices or casual users of R (http://www.r-project.org).

Overview

* The various documents in the [[wiki section]] explain how to use 
DokuWiki to edit documents in this site.

* The [[beginners section]] is dedicated to... beginners (share 
experience, expose problems and difficulties useful to share with other 
beginners, or to get help from more advanced people).

* The [[tutorials section]] is the place where you can put various R 
session examples, or short tutorials on either general or specific use of R.

* The [[easier section]] aims to collect together various pieces of R 
code that simplifies various tasks (especially for beginners) and that 
will ultimately be compiled in a “easieR” R packages on CRAN.

* The [[varia section]] is for any material that does not fit in the 
previous sections.


Final note: working with Wikis requires some learning... So, I am not 
sure at all that many R beginners will contribute to this wiki, but, of 
course, I hope so. Just let's pretend that it is a small experiment to 
try answering requests for another Internet space than R-Help, 
specifically dedicated to beginners...

A good starting point would be the following: all people that expressed 
interesting points in this thread could copy and paste their ideas to 
new pages in the Wiki.

Best,

Philippe Grosjean

..°}))
  ) ) ) ) )
( ( ( ( (Prof. Philippe Grosjean
  ) ) ) ) )
( ( ( ( (Numerical Ecology of Aquatic Systems
  ) ) ) ) )   Mons-Hainaut University, Pentagone (3D08)
( ( ( ( (Academie Universitaire Wallonie-Bruxelles
  ) ) ) ) )   8, av du Champ de Mars, 7000 Mons, Belgium
( ( ( ( (
  ) ) ) ) )   phone: + 32.65.37.34.97, fax: + 32.65.37.30.54
( ( ( ( (email: [EMAIL PROTECTED]
  ) ) ) ) )
( ( ( ( (web:   http://www.umh.ac.be/~econum
  ) ) ) ) )  http://www.sciviews.org
( ( ( ( (
..

David Forrest wrote:
 On Tue, 3 Jan 2006, Gabor Grothendieck wrote:
 ...
 
In fact there are some things that are very easy
to do in Stata and can be done in R but only with more difficulty.
For example, consider this introductory session in Stata:

http://www.stata.com/capabilities/session.html

Looking at the first few queries,
see how easy it is to take the top few in Stata whereas in R one would
have a complex use of order.  Its not hard in R to write a function
that would make it just as easy but its not available off the top
of one's head though RSiteSearch(sort.data.frame) will find one
if one knew what to search for.
 
 
 This sort of thing points to an opportunity for documentation.  Building a
 tutorial session in R on how one would do a similar analysis would provide
 another method of learning R.  An Introduction to R is a good bottom-up
 introduction, which if you work through it does teach you how to do
 several things.  Adapting other tutorials or extended problems, like the
 Stata session, to R would give additional entry points.  A few end-to-end
 tutorials on some interesting analyses would be helpful.
 
 Any volunteers?
 
 Dave

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE

Re: [R] A comment about R:

2006-01-03 Thread Philippe Grosjean
Roland,

Yes, indeed, you are perfectly right. The problem is that R richness 
means R complexity: many different data types, sub-languages like 
regexp or the formula interface, S3/S4 objects, classical versus lattice 
(versus RGL versus iplots) graphs, etc. During translation of R in 
French, I was thinking of a subset of one or two hundreds of functions 
that would be enough for beginners to start with, and to propose a 
translation of that small subset of the online help in French. This is 
still on my todo list, but I must admit it is not an easy task to decide 
which function should be kept in the subset and which should not!

In fact, that idea could be, perhaps, generalized into the whole online 
help. It would be sufficient to add a flag somewhere (perhaps a keyword) 
telling that page is fundamental and to allow filtering index and pages 
  (fundamental only or full help). Even for advanced users, it 
should be nice to have such a filter to display only the two or three 
most important functions in a new packages that proposes perhaps hundred 
online help pages...

Using R Commander is also an interesting experiment. R Commander 
simplifies the use of R down to the manipulation of a single data frame 
(the so-called active dataset) + optionally one or two model objects. 
Just look at all you can do just with one active data frame with R 
Commander, and you will realize that it is perfectly manageable to learn 
R that way.

Best,

Philippe Grosjean


Rau, Roland wrote:
   -Original Message-
 
From: [EMAIL PROTECTED] 
[mailto:[EMAIL PROTECTED] On Behalf Of Gabor 
Grothendieck
Sent: Monday, January 02, 2006 4:59 PM
To: Philippe Grosjean
Cc: Kort, Eric; Kjetil Halvorsen; R-help@stat.math.ethz.ch
Subject: Re: [R] A comment about R:


Probably what is needed is for someone familiar with both Stata and R
to create a lexicon in the vein of the Octave to R lexicon

   http://cran.r-project.org/doc/contrib/R-and-octave-2.txt

to make it easier for Stata users to understand R.  Ditto for 
SAS and SPSS.


 
 IMO this is a very good proposal but I think that the main problem is
 not the translation of one function in SPSS/Stata/SAS to the
 equivalent in R.
 Remembering my first contact with R after using SPSS for some years (and
 having some experience with Stata and SAS) was that your mental
 framework is different. You think in SPSS-terms (i.e. you expect that
 data are automatically a rectangular matrix, functions operate on
 columns of this matrix, you have always only one dataset available,
 ...). This is why jumping from SPSS to Stata is relatively easy. But
 to jump from any of the three to R is much more difficult. 
 This mental barrier is also the main obstacle for me now when I try to
 encourage the use of R to other people who have a similar background as
 I had.
 What can be done about it? I guess the only answer is investing time
 from the user which implies that R will probably never become the
 language of choice for casual users. But popularity is probably not
 the main goal of the R-Project (it would be rather a nice side-effect).
 
 Just a few thoughts ...
 
 Best,
 Roland
 
 +
 This mail has been sent through the MPI for Demographic Rese...{{dropped}}
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
 


__
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] A comment about R:

2006-01-02 Thread Philippe Grosjean
Kort, Eric wrote:
 
Kjetil Halvorsen wrote...

Readers of this list might be interested in the following commenta about R.


In a recent report, by Michael N. Mitchell
http://www.ats.ucla.edu/stat/technicalreports/
says about R:
Perhaps the most notable exception to this discussion is R, a language for
statistical computing and graphics.

 
 ---8-
 
 After reading this commentary a couple of times, I can't quite figure 
 out if he is damning with faint praise, or praising with faint damnation.
 
 (For example, after observing how many researchers around me approach
 statistical analysis, I'd say discouraging casual use is a _feature_.)

There are numerous reasons why people tend to consider R as too 
complicate for them (or even worse, say peremptively to others that R is 
too complicate for them!). But one must decrypt the real reasons behind 
what they say. Mostly, it is because R imposes to think about the 
analysis we are doing. As Eric says, it is a _feature_ (well, not 
discouraging casual use, but forcing to think about what we do, which 
in turn forces to learn R a little deeper to get results... which in 
turn may discourage casual users, as an unwanted side-effect). According 
to my own experience with teaching to students and to advanced 
scientists in different environments (academic, industry, etc.), the 
main basic reason why people are reluctant to use R is lazyness. People 
are lazy by nature. They like course where they just sit and snooze. 
Unfortunatelly, this is not the right way to learn R: you have to dwell 
on the abondant litterature about R and experiment by yourself to become 
a good R user. This is the kind of thing people do not like at all! 
Someone named Dr Brian Ripley wrote once something like:
`They' did write documentation that told you [...], but `they'
can't read it for you.

It is already many years that I write and use tools supposed to help 
beginners to master R: menu/dialog boxes approach, electronic reference 
cards, graphical object explorer, code tips, completion lists, etc... 
Everytime I got the same result: either these tools are badly designed 
because they hide the 'horrible code' those casual users don't want to 
see, and they make them *happy bad R users*, or they still force them to 
write code and think at what they exactly do (but just help them a bit), 
and they make them *good R users, but unhappy, poor, tortured 
beginners*! So, I tend to agree now: there is probably no way to instil 
R into lazy and reluctant minds.

That said, I think one should interpret Mitchell's paper in a different 
way. Obviously, he is an unconditional and happy Stata user (he even 
wrote a book about graphs programming in Stata). His claim in favor of 
Stata (versus SAS and SPSS, and also, indirectly, versus R) is to be 
interpreted the same way as unconditional lovers of Macintoshes or PCs 
would argue against the other clan. Both architectures are good and have 
strengths and weaknesses. Real arguments are more sentimental, and could 
resume in: The more I use it, the more I like it,... and the aliens are 
bad, ugly and stupid! Would this apply to Stata versus R? I don't know 
Stata at all, but I imagine it could be the case from what I read in 
Mitchell's paper...
Best,

Philippe

..°}))
  ) ) ) ) )
( ( ( ( (Prof. Philippe Grosjean
  ) ) ) ) )
( ( ( ( (Numerical Ecology of Aquatic Systems
  ) ) ) ) )   Mons-Hainaut University, Pentagone (3D08)
( ( ( ( (Academie Universitaire Wallonie-Bruxelles
  ) ) ) ) )   8, av du Champ de Mars, 7000 Mons, Belgium
( ( ( ( (
  ) ) ) ) )   phone: + 32.65.37.34.97, fax: + 32.65.37.30.54
( ( ( ( (email: [EMAIL PROTECTED]
  ) ) ) ) )
( ( ( ( (web:   http://www.umh.ac.be/~econum
  ) ) ) ) )  http://www.sciviews.org
( ( ( ( (
..

__
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] Age of an object?

2005-12-14 Thread Philippe Grosjean
Martin Maechler wrote:
Trevor == Trevor Hastie [EMAIL PROTECTED]
on Tue, 13 Dec 2005 12:51:34 -0800 writes:
 
 
 Trevor It would be nice to have a date stamp on an object.
 
 Trevor In S/Splus this was always available, because objects were files.
 
[are you sure about always available? 
 In any case, objects were not single files anymore for a
 long time, at least for S+ on windows, and AFAIK also on
 unixy versions recently ]
 
 This topic has come up before.
 IIRC, the answer was that for many of us it doesn't make sense
 most of the time: 

I remember it was discussed several times. I don't remember why it was 
considered too difficult to do.

 If you work with *.R files ('scripts') in order to ensure
 reproducibility, you will rerun -- often source() -- these files,
 and the age of the script file is really more interesting.
 Also, I *always* use the equivalent of  q(save = no) and
 almost only use save() to particularly save the results of
 expensive  computations {often, simulations}.

OK, now let me give examples where having such an information would ease 
the work greatly: you have a (graphical) view of the content of an 
object (for instance, the one using the view button in R commander), 
or you have a graphical object explorer that has a cache to speed up 
display of information about objects in a given workspace (for instance, 
the SciViews-R object explorer). What a wonderful feature it will be to 
tell if an object was changed since last query. In the view, one could 
have a visual clue if it is up-to-date or not. In the object explorer, I 
could update information only for objects that have changed...

 Trevor I have looked around, but I presume this information is not 
 available.
 
 I assume you will get other answers, more useful to you, which
 will be based on a class of objects which carry an
 'creation-time' attribute.  

Yes, but that would work only for objects designed that way, and only if 
the methods that manipulate that object do the required housework to 
update the 'last-changed' attribute (the question was about last access 
of an object, not about its creation date, so 'last-changed' is a better 
attribute here). If you access the object directly with, let's say, 
[EMAIL PROTECTED] - newvalue, that attribute is not updated, isn't it?

Best,

Philippe Grosjean

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


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


Re: [R] R for Windows server

2005-12-14 Thread Philippe Grosjean
Hello,

You don't tell us much info (what processor(s) are exactly in your 
server?). You must know the following:

1) Windows server prioritizes client accesses over local running 
programs (but you say there is no other process slowing down R... is it 
deconnected from the network?),

2) Rgui uses only one processor (at least, if you did not customized the 
default installation). Take care that, for instance, with an Intel 
HyperThreading (HT) Pentium IV processor, the system is working as if it 
was a bi-processor config with a single processor... and the task 
manager will not report more than 50% of CPU use for RGui.exe. Thus, I 
can imagine that, if you have a bi-processor hyperthreading config, it 
could report only 25% of CPU use.
Best,

Philippe Grosjean

..°}))
  ) ) ) ) )
( ( ( ( (Prof. Philippe Grosjean
  ) ) ) ) )
( ( ( ( (Numerical Ecology of Aquatic Systems
  ) ) ) ) )   Mons-Hainaut University, Pentagone (3D08)
( ( ( ( (Academie Universitaire Wallonie-Bruxelles
  ) ) ) ) )   8, av du Champ de Mars, 7000 Mons, Belgium
( ( ( ( (
  ) ) ) ) )   phone: + 32.65.37.34.97, fax: + 32.65.37.30.54
( ( ( ( (email: [EMAIL PROTECTED]
  ) ) ) ) )
( ( ( ( (web:   http://www.umh.ac.be/~econum
  ) ) ) ) )  http://www.sciviews.org
( ( ( ( (
..

Marco Geraci wrote:
 Hi,
   I need to run a burdensome simulation. I'm using a Dell PowerEdge 2850, 3.8 
 Ghz CPU, 2 Gb RAM, Windows server 2003, 32 bit. The task manager indicates 
 that Rgui.exe is using 25% of the CPU speed. There is no other process that 
 is slowing down R.
   Does anyone know if it's a limitation of R? If so, can I set up the program 
 for the CPU usage like I do for the memory usage? Is there a version of R for 
 servers?
   Thank you in advance,
   Marco Geraci
 
   
 -
 
 
   [[alternative HTML version deleted]]
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
 


__
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   3   >