Hello R users, I have a basic "computer programing" question. I am a student currently taking a course that uses Fortran as the main programming language, but the instructors are open to students using any language they are familiar with. I have used R previously, and am wondering if there is any benefit to my learning Fortran, or whether I should stick with R for this class. Any advice? Are there clear benefits to using Fortran, or things Fortran can do that R cannot? Thank you very much for any thoughts! Sincerely, Paul S.
On 9/23/2009 11:13 AM, Paul Simonin wrote:> Hello R users, > I have a basic "computer programing" question. I am a student > currently taking a course that uses Fortran as the main programming > language, but the instructors are open to students using any language > they are familiar with. I have used R previously, and am wondering if > there is any benefit to my learning Fortran, or whether I should stick > with R for this class. Any advice? Are there clear benefits to using > Fortran, or things Fortran can do that R cannot?They are very different languages. For many things Fortran will be much faster than R: so much so that you might find R is too slow to use for some of your assignments. On the other hand, R has much better support for many high level things, so you will find it much easier to do some of those: preparing graphs, etc. My advice would be to use the class as an opportunity to learn Fortran. Seeing things from more than one point of view is always a good thing. This might not be relevant to this class, but it is possible to use Fortran to write functions which are called from R: so you get the best of both worlds. That's another reason to learn Fortran. Duncan Murdoch
---------- Forwarded message ---------- From: Charlie Sharpsteen <chuck@sharpsteen.net> Date: Wed, Sep 23, 2009 at 8:47 AM Subject: Re: [R] Fortran vs R To: Paul Simonin <paul.simonin@uvm.edu> Cc: r-help@r-project.or On Wed, Sep 23, 2009 at 8:13 AM, Paul Simonin <paul.simonin@uvm.edu> wrote:> Hello R users, > I have a basic "computer programing" question. I am a student currently > taking a course that uses Fortran as the main programming language, but the > instructors are open to students using any language they are familiar with. > I have used R previously, and am wondering if there is any benefit to my > learning Fortran, or whether I should stick with R for this class. Any > advice? Are there clear benefits to using Fortran, or things Fortran can do > that R cannot? > Thank you very much for any thoughts! > Sincerely, > Paul S. > >Hello Paul, Like you, I learned Fortran as my first programming language. After a few years and a few more languages I can say that the answer to this question depends largely on what you think you may be doing with your programming skills. I will shamelessly use myself as an example- I am studying Environmental Resources Engineering. One of the biggest reasons we are taught Fortran is because the overwhelming percentage of software that solves problems in our field of concern is written in Fortran. Most importantly, many models produced by the US government-- such as the groundwater models maintained by the USGS-- are written in Fortran. The language used to write government models is significant because the soundness of those computer programs is legally defensible in court. Generally speaking, Fortran is used to write models of physical systems such as the flow of water (HEC-RAS), movement of contaminants in air (CARMA), development of tidal currents (ADCIRC) and propagation of ocean waves (SWAN). This is because Fortran is very matrix-oriented and very fast at what it does. Many, many toolkits for performing computations in linear algebra are written in Fortran. Bottom line on Fortran's area of use: if you think you will be using your programming skills to implement numerical solutions to things such as Partial Differential Equations, then Fortran could be a very valuable investment. As far as Fortran vs. R is concerned-- the two compliment each other very well. R is very flexible and can be enhanced with just about any bell or whistle you could possible want-- but being a scripting language, it can run into performance issues-- especially during large loops. Fortran is a very, very, straightforward language because it does not have many "bells and whistles" to speak of-- it does one thing and one thing best and that is to crunch absurdly large amounts of numbers as fast as it possibly can. Fortran also happens to be one of the compiled languages that R is designed to work with, it is amazing how easy it is to add Fortran routines to an R package and then load and use them from within R. I usually write my numerical computations in Fortran, load them as an R package and then: - Use R to feed Fortran simulations with random numbers drawn from different distributions (Monte Carlo Analysis). - Use R to perform statistical analysis on the results of Fortran simulations. - Use R to aggregate, format and graph the results of Fortran simulations. So, the decision on what languages to learn depends very much on what problems you think will require your programming skills. R and Fortran compliment each other extremely well-- so learning Fortran may be a wise investment. Hope this helps! -Charlie [[alternative HTML version deleted]]
WARNING! Biased opinion. I'm an old guy who learned programming nearly 50 years ago when FORTRAN (IV) was it, unless you wanted to write machine language which, being an engineer, I was less interested in than in getting an answer so I could get on with things. I like FORTRAN, but I can't think of anything that R couldn't do better and easier. R is interpreted and thus is slower than compiled FORTRAN but unless you have a very (very, very) specific application where you need compiled speed, R wins by a mile. Don't learn FORTRAN. Invest your time in Python if you must learn another language. R would be my choice if I were you. Mister Know-It-All Charles Annis, P.E. Charles.Annis at StatisticalEngineering.com phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -----Original Message----- From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of Paul Simonin Sent: Wednesday, September 23, 2009 11:13 AM To: R Help Listserve Subject: [R] Fortran vs R Hello R users, I have a basic "computer programing" question. I am a student currently taking a course that uses Fortran as the main programming language, but the instructors are open to students using any language they are familiar with. I have used R previously, and am wondering if there is any benefit to my learning Fortran, or whether I should stick with R for this class. Any advice? Are there clear benefits to using Fortran, or things Fortran can do that R cannot? Thank you very much for any thoughts! Sincerely, Paul S. ______________________________________________ R-help at r-project.org 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.
On Wed, 23 Sep 2009, Paul Simonin wrote:> Hello R users, > I have a basic "computer programing" question. I am a student currently taking > a course that uses Fortran as the main programming language, but the > instructors are open to students using any language they are familiar with. I > have used R previously, and am wondering if there is any benefit to my learning > Fortran, or whether I should stick with R for this class. Any advice? Are there > clear benefits to using Fortran, or things Fortran can do that R cannot?There is almost no overlap between programs that can sensibly be written in R and those that can sensibly be written in Fortran, and good coding styles in the two languages are very different. For these reasons I would take the opportunity to learn Fortran, and hope that the instructor has used examples for which Fortran is a sensible choice. It's a good idea to learn some statically typed, compiled language, partly because you sometimes need one and partly for what it teaches you about programming. Even if you don't end up writing Fortran in the future, you may well up reading it -- there's lots of numerical code out there (including in R) written in Fortran. -thomas Thomas Lumley Assoc. Professor, Biostatistics tlumley at u.washington.edu University of Washington, Seattle
Because Fortan is a complied language, as opposed to R which is an interpreter, Fortran is orders of magnitude faster than R Because R is a high level programming language developed for statistical analyses, for many problems it is much easier, and faster, to program statistical analyses wtih R than Fortran. John John David Sorkin M.D., Ph.D. Chief, Biostatistics and Informatics University of Maryland School of Medicine Division of Gerontology Baltimore VA Medical Center 10 North Greene Street GRECC (BT/18/GR) Baltimore, MD 21201-1524 (Phone) 410-605-7119 (Fax) 410-605-7913 (Please call phone number above prior to faxing)>>> Paul Simonin <paul.simonin at uvm.edu> 9/23/2009 11:13 AM >>>Hello R users, I have a basic "computer programing" question. I am a student currently taking a course that uses Fortran as the main programming language, but the instructors are open to students using any language they are familiar with. I have used R previously, and am wondering if there is any benefit to my learning Fortran, or whether I should stick with R for this class. Any advice? Are there clear benefits to using Fortran, or things Fortran can do that R cannot? Thank you very much for any thoughts! Sincerely, Paul S. ______________________________________________ R-help at r-project.org 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. Confidentiality Statement: This email message, including any attachments, is for th...{{dropped:6}}