Re: [R] open source and R

2005-11-15 Thread Barry Rowlingson
Liaw, Andy wrote:
 However code readability can not be over-emphasized.  I must admit to have
 written R code in such a supposedly `clever' way that I can't figure out
 what I was trying to do (or how I did it) a week later...

  The solution to that is to make sure this sort of code is adequately 
commented! Be as clever as you like - make your R look like a runner-up 
in the obfuscated perl programming contest if you want - but a 
well-placed comment will hopefully prevent that stupid feeling a week later.

Baz

__
R-help@stat.math.ethz.ch 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] open source and R

2005-11-15 Thread Jari Oksanen
On Tue, 2005-11-15 at 09:54 +, Barry Rowlingson wrote:
 Liaw, Andy wrote:
  However code readability can not be over-emphasized.  I must admit to have
  written R code in such a supposedly `clever' way that I can't figure out
  what I was trying to do (or how I did it) a week later...
 
   The solution to that is to make sure this sort of code is adequately 
 commented! Be as clever as you like - make your R look like a runner-up 
 in the obfuscated perl programming contest if you want - but a 
 well-placed comment will hopefully prevent that stupid feeling a week later.
 
Unfortunately the comments don't stick well with the R code. They would
if you always edit the source code, but not with my preferred toolbox.
For me the most natural way to work on a function is to install the
package with the function, and then use Emacs+ESS to edit, test and
debug the the function within an R session. That really ruins all decent
commenting: comments may be misplaced, and the default formatting of
comments is really bad in ESS. So my choice is to uncomment R code, but
comment C (and Fortran).

cheers, jari oksanen

__
R-help@stat.math.ethz.ch 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] open source and R

2005-11-15 Thread Martin Maechler
 Jari == Jari Oksanen [EMAIL PROTECTED]
 on Tue, 15 Nov 2005 12:25:17 +0200 writes:

Jari On Tue, 2005-11-15 at 09:54 +, Barry Rowlingson wrote:
 Liaw, Andy wrote:

 However code readability can not be over-emphasized.  I
 must admit to have written R code in such a supposedly
 `clever' way that I can't figure out what I was trying
 to do (or how I did it) a week later...

Baz The solution to that is to make sure this sort of code
Baz is adequately commented! Be as clever as you like -
Baz make your R look like a runner-up in the obfuscated
Baz perl programming contest if you want - but a
Baz well-placed comment will hopefully prevent that stupid
Baz feeling a week later.

Exactly!

Jari Unfortunately the comments don't stick well with the R
Jari code. They would if you always edit the source code,
Jari but not with my preferred toolbox.  For me the most
Jari natural way to work on a function is to install the
Jari package with the function, and then use Emacs+ESS to
Jari edit, test and debug the the function within an R
Jari session. 

But why?  Why on earth are you not working with the *.R files in your
pkg/R/ directory?
Or make a copy of these and work with the copy?

Also, you can use  library(,  keep.source = TRUE)
and this helps for all those packages that did *not* use
lazy-loading or saved images at their installation time;
unfortunately, that excludes many packages.

Once you've seen the light, i.e. ESS :-) ,
using edit() , fix() and all those abominations is just plainly
wrong in my (biased) view!

Jari session. That really ruins all decent commenting:
Jari comments may be misplaced, and the default formatting
Jari of comments is really bad in ESS. 

Huh??  I'd have expected you to say the contrary here.
I assume you have never heard of the difference between #, ##
and ### in comments.  Most of the R core developers adhere to
it which you can see when browsing the R source files.

Since one version of the ESS manual is online, look here:
http://ESS.R-project.org/Manual/ess.html#index-comments-in-S-154

Jari So my choice is to uncomment R code, but comment C
Jari (and Fortran).

ooh;  I hope you can be convinced to use comments in R code...
and maybe adapt to the ## vs # (or ###) scheme.

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


Re: [R] open source and R

2005-11-14 Thread Ted Harding
On 14-Nov-05 Prof Brian Ripley wrote:
 On Sun, 13 Nov 2005 [EMAIL PROTECTED] wrote:
 
 [...]
 
 There is one aspect though where R users are in the cold when
 it comes to C and FORTAN. If you want to understand the function
 'eigen', say, then you can ?eigen to learn about its usage.
 You can enter eigen to see the R code, and indeed that is
 not too imcomprehensible. But then you find

  .Fortran(ch, n, n, xr, xi, values = dbl.n,
   !only.values, vectors = xr, ivectors = xi, dbl.n,
   dbl.n, double(2 * n), ierr = integer(1),
   PACKAGE = base)

 and similar for rs, cg and rg. Where's the help for
 these? Nowhere obvious! In fact you have to go to the source
 code, locate the FORTRAN routines, and study these, hoping
 that enough helpful comments have been included to steer
 your study. So it is a much more formidable task, especially
 if you are having to learn the language at the same time.
 
 That is an unfair comment.  The help page for eigen explains what 
 routines are used and gives you references to books describing them.
 So the help _is_ in the most obvious place.

Apologies for misleading wording. This was not meant as a criticism
of R in any way, but as an illustration of the theme that, sooner
or later, you drop through the floor of what R can provide in
the way of explicit explanation. So, while R's help is indeed helpful
in this case in indicating an orientation for your travels in that
outside world, out in the cold as it were, users are then on
their own as far as R is concerned. This is of course inevitable,
and the comment was intended as part of the general response to
Robert that if you want to study how R does things you are led
to study how other software, on which R depends, does things.

Best wishes,
Ted.



E-Mail: (Ted Harding) [EMAIL PROTECTED]
Fax-to-email: +44 (0)870 094 0861
Date: 14-Nov-05   Time: 08:55:35
-- XFMail --

__
R-help@stat.math.ethz.ch 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] open source and R

2005-11-14 Thread Liaw, Andy
Here comes a not-so-nice one:  Sorry to be blunt, but I think the current
reality is that one's effectiveness in scientific computing is not likely to
be high if s/he can't read C for Fortran code.

The mode of development for new methods, I believe, should be:

- Write it in R (or S-PLUS or Matlab or ...) because one can usually do that
quite quickly.

- Check and make sure the code produces correct result.

- See if the code can be improved for efficiency.  Use the profiling
facility in R to see where the bottlenecks really are, and try to improve
those parts.

- If no significant improvement is possible in R, move only the
time-consuming part of the computation to C/Fortran/C++.

The above mode is not always followed, because many of the packages on CRAN
are simply R interfaces to _existing_ C/Fortran code.  One would be happy to
be able to use them at the R level, but to rewrite the whole thing in R, one
better have _very_ good reason!

For some algorithms, efficient code can be written in pure R, but the
resulting code can be less readable than one written more legibly in C for
Fortran.

Just my $0.02...

Andy

 From: Robert
 
 Thanks for all the nice discussions. 
   Though different users have various needs from R, It's 
 always good to stand on the shoulders of giants (as roger 
 said). How far we will see depends our ability to understand 
 what have been done by other languages. 
   The package written in pure R might be good for education 
 in starting OOP in research but not effective in scientific 
 computing as suggested.
   
 
 [EMAIL PROTECTED] wrote:
   On 13-Nov-05 Roger Bivand wrote:
  On Sun, 13 Nov 2005, Robert wrote:
  
  If I do not know C or FORTRAN, how can I fully understand 
 the package
  or possibly improve it?
  
  By learning enough to see whether that makes a difference for your 
  purposes. Life is hard, but that's what makes life interesting ...
  
  Robert.
  
  Roger Bivand wrote:
  On Sun, 13 Nov 2005, Robert wrote:
  
   Roger Bivand wrote: 
   On Sun, 13 Nov 2005, Robert wrote:
   
It uses FORTRAN code and not in pure R.
   
   The same applies to deldir - it also includes Fortran. So the
   answer seems to be no, there is no voronoi function only
   written in R.
   
  
  Robert wrote:
  
   
   I am curious about one thing: since the reason for using r
   is r is a easy-to-learn language and it is good for getting
   more people involved.
  
   Why most of the packages written in r use other languages
   such as FORTRAN's code? I understand some functions have
   already been written in other language or it is faster to
   be implemented in other language.
  
   But my understanding is if the user does not know that
   language (for example, FORTRAN), the package is still a
   black box to him because he can not improve the package and
   can not be involved in the development. 
  
   When I searched the packages of R, I saw many packages with
   duplicated or similar functions. the main difference among
   them are the different functions implemented using other
  languages, which are always a black box to the users. So it
   is very hard for users to believe the package will run
   something they need, let alone getting involved in the
   development. My comments are not to disregard these efforts.
   But it is good to see the packages written in pure R.
   
  
  Although surprisingly much of R is written in R, quite a lot is
  written in Fortran and C. One very good reason, apart from
  efficiency, is code
  re-use
  - BLAS and LAPACK among many others are excellent implementations
  of what we need for numerical linear algebra. R is very typical
  of good scientific software, it tries to avoid re-implementing
  functions that are used by the community, are well-supported by
  the community, and work. Packages by and large do the same - if
  existing software does the required job, package authors attempt
  to port that software to R, providing interfaces to underlying
  C or Fortran libraries. 
  
  It's about standing on the shoulders of giants.
 
 Those are very strong points. Some comments:
 
 It would be possible to implement in pure R a matrix inversion
 or eigenvalue/vector function, for instance, and I'm sure it would
 be done (if it were done) to very high quality. However, it would
 run like an elephant in quicksands. BLAS and LAPACK have, over the
 years, become highly optimised not just for accuracy and robustness,
 but for speed and efficiency.
 
 Also, you will hit the other language problem sooner or
 later. Robert's complaint is that he does not like black
 boxes. But R itself is a black box. You cannot write R in R,
 all the way down to the bottom. At the bottom is machine
 code, and languages like assember, C, C++, FORTRAN and
 their compilers provide black box wrappers for this.
 
 That is not a whimsical comment either -- all those discussions
 about why 2 - sqrt(2)^2 is not equal to 0 come down to this
 sort of issue. Sooner or later, if 

Re: [R] open source and R

2005-11-14 Thread Liaw, Andy
However code readability can not be over-emphasized.  I must admit to have
written R code in such a supposedly `clever' way that I can't figure out
what I was trying to do (or how I did it) a week later...

Andy

 From: Ernesto Jardim 
 
 Hi,
 
 One single comment about the subject of this message. Open source is 
 about making the code _available_ for all, not making the code 
 _understandable_ for all.
 
 Regards
 
 EJ
 


__
R-help@stat.math.ethz.ch 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] open source and R

2005-11-14 Thread Berton Gunter
Andy:

Ah, don't feel bad, Andy; this is a universal problem in programming that
despite all kinds of efforts in lucid programming, OOP, etc. no one has
figured out. So while code readability cannot be overemphasized, what this
actually means also apparently cannot be defined.

From: http://www.jeffgainer.com/lucid_code/lc_cover.html

If you are a software professional, you know how software is created.
Surely you recognize it. Chances are you live it: chaos.

;-)

-- Bert
 

 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of Liaw, Andy
 Sent: Monday, November 14, 2005 2:46 PM
 To: 'Ernesto Jardim'
 Cc: [EMAIL PROTECTED]; r-help@stat.math.ethz.ch
 Subject: Re: [R] open source and R
 
 However code readability can not be over-emphasized.  I must 
 admit to have
 written R code in such a supposedly `clever' way that I can't 
 figure out
 what I was trying to do (or how I did it) a week later...
 
 Andy
 
  From: Ernesto Jardim 
  
  Hi,
  
  One single comment about the subject of this message. Open 
 source is 
  about making the code _available_ for all, not making the code 
  _understandable_ for all.
  
  Regards
  
  EJ
  
 
 
 __
 R-help@stat.math.ethz.ch 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] open source and R

2005-11-13 Thread Robert
Roger Bivand [EMAIL PROTECTED] wrote: 
On Sun, 13 Nov 2005, Robert wrote:

 It uses FORTRAN code and not in pure R.

The same applies to deldir - it also includes Fortran. So the answer seems 
to be no, there is no voronoi function only written in R.


I am curious about one thing: since the reason for using r is r is a 
easy-to-learn language and it is good for getting more people involved. Why 
most of the packages written in r use other languages such as FORTRAN's code? I 
understand some functions have already been written in other language or it is 
faster to be implemented in other language. But my understanding is if the user 
does not know that language (for example, FORTRAN), the package is still a 
black box to him  because he can not improve the package and can not be 
involved in the development. 
When I searched the packages of R, I saw many packages with duplicated or 
similar functions. the main difference among them are the different functions 
implemented using other languages, which are always a black box to the users. 
So it is very hard for users to believe the package will run something they 
need, let alone getting involved in the development.
My comments are not to disregard these efforts. But it is good to see the 
packages written in pure R.

 




-

[[alternative HTML version deleted]]

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


Re: [R] open source and R

2005-11-13 Thread Roger Bivand
On Sun, 13 Nov 2005, Robert wrote:

 Roger Bivand [EMAIL PROTECTED] wrote: 
 On Sun, 13 Nov 2005, Robert wrote:
 
  It uses FORTRAN code and not in pure R.
 
 The same applies to deldir - it also includes Fortran. So the answer seems 
 to be no, there is no voronoi function only written in R.
 

Robert wrote:

 
 I am curious about one thing: since the reason for using r is r is a
 easy-to-learn language and it is good for getting more people involved.
 Why most of the packages written in r use other languages such as
 FORTRAN's code? I understand some functions have already been written in
 other language or it is faster to be implemented in other language. But
 my understanding is if the user does not know that language (for
 example, FORTRAN), the package is still a black box to him because he
 can not improve the package and can not be involved in the development.  
 When I searched the packages of R, I saw many packages with duplicated
 or similar functions. the main difference among them are the different
 functions implemented using other languages, which are always a black
 box to the users. So it is very hard for users to believe the package
 will run something they need, let alone getting involved in the
 development. My comments are not to disregard these efforts. But it is
 good to see the packages written in pure R.
 

Please indent your replies, they are very difficult to read sensibly.

Although surprisingly much of R is written in R, quite a lot is written in
Fortran and C. One very good reason, apart from efficiency, is code re-use
- BLAS and LAPACK among many others are excellent implementations of what
we need for numerical linear algebra. R is very typical of good scientific
software, it tries to avoid re-implementing functions that are used by the
community, are well-supported by the community, and work. Packages by and
large do the same - if existing software does the required job, package
authors attempt to port that software to R, providing interfaces to
underlying C or Fortran libraries. 

It's about standing on the shoulders of giants.

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: [EMAIL PROTECTED]

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


Re: [R] open source and R

2005-11-13 Thread Robert
If I do not know C or FORTRAN, how can I fully understand the package or 
possibly improve it?
Robert.

Roger Bivand [EMAIL PROTECTED] wrote:
On Sun, 13 Nov 2005, Robert wrote:

 Roger Bivand wrote: 
 On Sun, 13 Nov 2005, Robert wrote:
 
  It uses FORTRAN code and not in pure R.
 
 The same applies to deldir - it also includes Fortran. So the answer seems 
 to be no, there is no voronoi function only written in R.
 

Robert wrote:

 
 I am curious about one thing: since the reason for using r is r is a
 easy-to-learn language and it is good for getting more people involved.
 Why most of the packages written in r use other languages such as
 FORTRAN's code? I understand some functions have already been written in
 other language or it is faster to be implemented in other language. But
 my understanding is if the user does not know that language (for
 example, FORTRAN), the package is still a black box to him because he
 can not improve the package and can not be involved in the development. 
 When I searched the packages of R, I saw many packages with duplicated
 or similar functions. the main difference among them are the different
 functions implemented using other languages, which are always a black
 box to the users. So it is very hard for users to believe the package
 will run something they need, let alone getting involved in the
 development. My comments are not to disregard these efforts. But it is
 good to see the packages written in pure R.
 

Please indent your replies, they are very difficult to read sensibly.

Although surprisingly much of R is written in R, quite a lot is written in
Fortran and C. One very good reason, apart from efficiency, is code re-use
- BLAS and LAPACK among many others are excellent implementations of what
we need for numerical linear algebra. R is very typical of good scientific
software, it tries to avoid re-implementing functions that are used by the
community, are well-supported by the community, and work. Packages by and
large do the same - if existing software does the required job, package
authors attempt to port that software to R, providing interfaces to
underlying C or Fortran libraries. 

It's about standing on the shoulders of giants.

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: [EMAIL PROTECTED]


-

[[alternative HTML version deleted]]

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


Re: [R] open source and R

2005-11-13 Thread Roger Bivand
On Sun, 13 Nov 2005, Robert wrote:

 If I do not know C or FORTRAN, how can I fully understand the package or
 possibly improve it?

By learning enough to see whether that makes a difference for your 
purposes. Life is hard, but that's what makes life interesting ...

 Robert.
 
 Roger Bivand [EMAIL PROTECTED] wrote:
 On Sun, 13 Nov 2005, Robert wrote:
 
  Roger Bivand wrote: 
  On Sun, 13 Nov 2005, Robert wrote:
  
   It uses FORTRAN code and not in pure R.
  
  The same applies to deldir - it also includes Fortran. So the answer seems 
  to be no, there is no voronoi function only written in R.
  
 
 Robert wrote:
 
  
  I am curious about one thing: since the reason for using r is r is a
  easy-to-learn language and it is good for getting more people involved.
  Why most of the packages written in r use other languages such as
  FORTRAN's code? I understand some functions have already been written in
  other language or it is faster to be implemented in other language. But
  my understanding is if the user does not know that language (for
  example, FORTRAN), the package is still a black box to him because he
  can not improve the package and can not be involved in the development. 
  When I searched the packages of R, I saw many packages with duplicated
  or similar functions. the main difference among them are the different
  functions implemented using other languages, which are always a black
  box to the users. So it is very hard for users to believe the package
  will run something they need, let alone getting involved in the
  development. My comments are not to disregard these efforts. But it is
  good to see the packages written in pure R.
  
 
 Please indent your replies, they are very difficult to read sensibly.
 
 Although surprisingly much of R is written in R, quite a lot is written in
 Fortran and C. One very good reason, apart from efficiency, is code re-use
 - BLAS and LAPACK among many others are excellent implementations of what
 we need for numerical linear algebra. R is very typical of good scientific
 software, it tries to avoid re-implementing functions that are used by the
 community, are well-supported by the community, and work. Packages by and
 large do the same - if existing software does the required job, package
 authors attempt to port that software to R, providing interfaces to
 underlying C or Fortran libraries. 
 
 It's about standing on the shoulders of giants.
 
 

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: [EMAIL PROTECTED]

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


Re: [R] open source and R

2005-11-13 Thread roger koenker

 On Nov 13, 2005, at 3:24 PM, Robert wrote:


 I am curious about one thing: since the reason for using r is r is  
 a easy-to-learn language and it is good for getting more people  
 involved. Why most of the packages written in r use other  
 languages such as FORTRAN's code? I understand some functions have  
 already been written in other language or it is faster to be  
 implemented in other language. But my understanding is if the user  
 does not know that language (for example, FORTRAN), the package is  
 still a black box to him  because he can not improve the package  
 and can not be involved in the development.
 When I searched the packages of R, I saw many packages with  
 duplicated or similar functions. the main difference among them  
 are the different functions implemented using other languages,  
 which are always a black box to the users. So it is very hard for  
 users to believe the package will run something they need, let  
 alone getting involved in the development.



 No, the box is not black, it is utterly transparent.  Of course,  
 what you can recognize and understand
 inside depends on you,.  Just say no  to linguistic chauvinism   
 -- even R-ism.


 url:www.econ.uiuc.edu/~rogerRoger Koenker
 email   [EMAIL PROTECTED]   Department of  
 Economics
 vox:217-333-4558University of Illinois
 fax:217-244-6678Champaign, IL 61820



__
R-help@stat.math.ethz.ch 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] open source and R

2005-11-13 Thread Mike Miller
On Sun, 13 Nov 2005, Roger Bivand wrote:

 On Sun, 13 Nov 2005, Robert wrote:

 If I do not know C or FORTRAN, how can I fully understand the package 
 or possibly improve it?

 By learning enough to see whether that makes a difference for your 
 purposes. Life is hard, but that's what makes life interesting ...


None of us fully understands what we are doing with computer software. 
If you understand R code, that's great, but then there is the R 
interpreter -- do you understand how it works?  That interpreter was 
written in another language that was then compiled by a compiler which was 
written by someone else for some other purpose -- do you understand the 
compiler?  Then it all gets processed by some very complex hardware that 
practically none of us *fully* understands.  We have to accept that we 
can't have a complete grasp of what R is doing, but we can still read the 
R docs and test R in many ways.

When functions are written in R, they may be easier for you to read, but 
they may run much slower than code written in C, C++ or FORTRAN.  I don't 
think it is wise to forgo the speed improvement so that people who don't 
know FORTRAN can enjoy contributing to R development.  The contribution of 
FORTRAN libraries R functionality and efficiency is probably much greater 
than the contributions would be from any group of people who could code in 
R but could't code in C or FORTRAN.

That said, I appreciate the sentiment and I think we should prefer 
straight R code for many functions, but some things just run too slowly 
when written that way.

Mike

__
R-help@stat.math.ethz.ch 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] open source and R

2005-11-13 Thread Ted Harding
On 13-Nov-05 Roger Bivand wrote:
 On Sun, 13 Nov 2005, Robert wrote:
 
 If I do not know C or FORTRAN, how can I fully understand the package
 or possibly improve it?
 
 By learning enough to see whether that makes a difference for your 
 purposes. Life is hard, but that's what makes life interesting ...
 
 Robert.
 
 Roger Bivand [EMAIL PROTECTED] wrote:
 On Sun, 13 Nov 2005, Robert wrote:
 
  Roger Bivand wrote: 
  On Sun, 13 Nov 2005, Robert wrote:
  
   It uses FORTRAN code and not in pure R.
  
  The same applies to deldir - it also includes Fortran. So the
  answer seems to be no, there is no voronoi function only
  written in R.
  
 
 Robert wrote:
 
  
  I am curious about one thing: since the reason for using r
  is r is a easy-to-learn language and it is good for getting
  more people involved.
 
  Why most of the packages written in r use other languages
  such as FORTRAN's code? I understand some functions have
  already been written in other language or it is faster to
  be implemented in other language.
 
  But my understanding is if the user does not know that
  language (for example, FORTRAN), the package is still a
  black box to him because he can not improve the package and
  can not be involved in the development. 
 
  When I searched the packages of R, I saw many packages with
  duplicated or similar functions. the main difference among
  them are the different functions implemented using other
 languages, which are always a black box to the users. So it
  is very hard for users to believe the package will run
  something they need, let alone getting involved in the
  development. My comments are not to disregard these efforts.
  But it is good to see the packages written in pure R.
  
 
 Although surprisingly much of R is written in R, quite a lot is
 written in Fortran and C. One very good reason, apart from
 efficiency, is code
 re-use
 - BLAS and LAPACK among many others are excellent implementations
 of what we need for numerical linear algebra. R is very typical
 of good scientific software, it tries to avoid re-implementing
 functions that are used by the community, are well-supported by
 the community, and work. Packages by and large do the same - if
 existing software does the required job, package authors attempt
 to port that software to R, providing interfaces to underlying
 C or Fortran libraries. 
 
 It's about standing on the shoulders of giants.

Those are very strong points. Some comments:

It would be possible to implement in pure R a matrix inversion
or eigenvalue/vector function, for instance, and I'm sure it would
be done (if it were done) to very high quality. However, it would
run like an elephant in quicksands. BLAS and LAPACK have, over the
years, become highly optimised not just for accuracy and robustness,
but for speed and efficiency.

Also, you will hit the other language problem sooner or
later. Robert's complaint is that he does not like black
boxes. But R itself is a black box. You cannot write R in R,
all the way down to the bottom. At the bottom is machine
code, and languages like assember, C, C++, FORTRAN and
their compilers provide black box wrappers for this.

That is not a whimsical comment either -- all those discussions
about why  2 - sqrt(2)^2 is not equal to 0 come down to this
sort of issue. Sooner or later, if you really want to understand
what is going on, you have to get beneath the shiny smooth
surface and swim amongst the molecules!

So, Robert, try to be positive about C and FORTRAN etc., rather
than feeling put off by the fact that they are yet more things
to learn and seem to get in the way of understanding how the
functions work. C and FORTRAN are your friends, as well as
the R langauge itself, and great deal more friemdly than
the raw machine code. 

There is one aspect though where R users are in the cold when
it comes to C and FORTAN. If you want to understand the function
'eigen', say, then you can ?eigen to learn about its usage.
You can enter eigen to see the R code, and indeed that is
not too imcomprehensible. But then you find

  .Fortran(ch, n, n, xr, xi, values = dbl.n, 
   !only.values, vectors = xr, ivectors = xi, dbl.n, 
   dbl.n, double(2 * n), ierr = integer(1),
   PACKAGE = base)

and similar for rs, cg and rg. Where's the help for
these? Nowhere obvious! In fact you have to go to the source
code, locate the FORTRAN routines, and study these, hoping
that enough helpful comments have been included to steer
your study. So it is a much more formidable task, especially
if you are having to learn the language at the same time.

Best wishes,
Ted.



E-Mail: (Ted Harding) [EMAIL PROTECTED]
Fax-to-email: +44 (0)870 094 0861
Date: 13-Nov-05   Time: 23:13:58
-- XFMail --

__
R-help@stat.math.ethz.ch 

Re: [R] open source and R

2005-11-13 Thread Robert
Thanks for all the nice discussions. 
  Though different users have various needs from R, It's always good to stand 
on the shoulders of giants (as roger said). How far we will see depends our 
ability to understand what have been done by other languages. 
  The package written in pure R might be good for education in starting OOP in 
research but not effective in scientific computing as suggested.
  

[EMAIL PROTECTED] wrote:
  On 13-Nov-05 Roger Bivand wrote:
 On Sun, 13 Nov 2005, Robert wrote:
 
 If I do not know C or FORTRAN, how can I fully understand the package
 or possibly improve it?
 
 By learning enough to see whether that makes a difference for your 
 purposes. Life is hard, but that's what makes life interesting ...
 
 Robert.
 
 Roger Bivand wrote:
 On Sun, 13 Nov 2005, Robert wrote:
 
  Roger Bivand wrote: 
  On Sun, 13 Nov 2005, Robert wrote:
  
   It uses FORTRAN code and not in pure R.
  
  The same applies to deldir - it also includes Fortran. So the
  answer seems to be no, there is no voronoi function only
  written in R.
  
 
 Robert wrote:
 
  
  I am curious about one thing: since the reason for using r
  is r is a easy-to-learn language and it is good for getting
  more people involved.
 
  Why most of the packages written in r use other languages
  such as FORTRAN's code? I understand some functions have
  already been written in other language or it is faster to
  be implemented in other language.
 
  But my understanding is if the user does not know that
  language (for example, FORTRAN), the package is still a
  black box to him because he can not improve the package and
  can not be involved in the development. 
 
  When I searched the packages of R, I saw many packages with
  duplicated or similar functions. the main difference among
  them are the different functions implemented using other
 languages, which are always a black box to the users. So it
  is very hard for users to believe the package will run
  something they need, let alone getting involved in the
  development. My comments are not to disregard these efforts.
  But it is good to see the packages written in pure R.
  
 
 Although surprisingly much of R is written in R, quite a lot is
 written in Fortran and C. One very good reason, apart from
 efficiency, is code
 re-use
 - BLAS and LAPACK among many others are excellent implementations
 of what we need for numerical linear algebra. R is very typical
 of good scientific software, it tries to avoid re-implementing
 functions that are used by the community, are well-supported by
 the community, and work. Packages by and large do the same - if
 existing software does the required job, package authors attempt
 to port that software to R, providing interfaces to underlying
 C or Fortran libraries. 
 
 It's about standing on the shoulders of giants.

Those are very strong points. Some comments:

It would be possible to implement in pure R a matrix inversion
or eigenvalue/vector function, for instance, and I'm sure it would
be done (if it were done) to very high quality. However, it would
run like an elephant in quicksands. BLAS and LAPACK have, over the
years, become highly optimised not just for accuracy and robustness,
but for speed and efficiency.

Also, you will hit the other language problem sooner or
later. Robert's complaint is that he does not like black
boxes. But R itself is a black box. You cannot write R in R,
all the way down to the bottom. At the bottom is machine
code, and languages like assember, C, C++, FORTRAN and
their compilers provide black box wrappers for this.

That is not a whimsical comment either -- all those discussions
about why 2 - sqrt(2)^2 is not equal to 0 come down to this
sort of issue. Sooner or later, if you really want to understand
what is going on, you have to get beneath the shiny smooth
surface and swim amongst the molecules!

So, Robert, try to be positive about C and FORTRAN etc., rather
than feeling put off by the fact that they are yet more things
to learn and seem to get in the way of understanding how the
functions work. C and FORTRAN are your friends, as well as
the R langauge itself, and great deal more friemdly than
the raw machine code. 

There is one aspect though where R users are in the cold when
it comes to C and FORTAN. If you want to understand the function
'eigen', say, then you can ?eigen to learn about its usage.
You can enter eigen to see the R code, and indeed that is
not too imcomprehensible. But then you find

.Fortran(ch, n, n, xr, xi, values = dbl.n, 
!only.values, vectors = xr, ivectors = xi, dbl.n, 
dbl.n, double(2 * n), ierr = integer(1),
PACKAGE = base)

and similar for rs, cg and rg. Where's the help for
these? Nowhere obvious! In fact you have to go to the source
code, locate the FORTRAN routines, and study these, hoping
that enough helpful comments have been included to steer
your study. So it is a much more formidable task, especially
if you are having to learn the language at the same time.


Re: [R] open source and R

2005-11-13 Thread Prof Brian Ripley
On Sun, 13 Nov 2005 [EMAIL PROTECTED] wrote:

[...]

 There is one aspect though where R users are in the cold when
 it comes to C and FORTAN. If you want to understand the function
 'eigen', say, then you can ?eigen to learn about its usage.
 You can enter eigen to see the R code, and indeed that is
 not too imcomprehensible. But then you find

  .Fortran(ch, n, n, xr, xi, values = dbl.n,
   !only.values, vectors = xr, ivectors = xi, dbl.n,
   dbl.n, double(2 * n), ierr = integer(1),
   PACKAGE = base)

 and similar for rs, cg and rg. Where's the help for
 these? Nowhere obvious! In fact you have to go to the source
 code, locate the FORTRAN routines, and study these, hoping
 that enough helpful comments have been included to steer
 your study. So it is a much more formidable task, especially
 if you are having to learn the language at the same time.

That is an unfair comment.  The help page for eigen explains what 
routines are used and gives you references to books describing them.
So the help _is_ in the most obvious place.

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

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