Slashdot Mirror


The Power of the R Programming Language

BartlebyScrivener writes "The New York Times has an article on the R programming language. The Times describes it as: 'a popular programming language used by a growing number of data analysts inside corporations and academia. It is becoming their lingua franca partly because data mining has entered a golden age, whether being used to set ad prices, find new drugs more quickly or fine-tune financial models. Companies as diverse as Google, Pfizer, Merck, Bank of America, the InterContinental Hotels Group and Shell use it.'"

382 comments

  1. Only for certain kind of analyst... by Anonymous Coward · · Score: 2, Insightful

    ... most others keep thinking that M$ Excel is the silver bullet.

    Sad, but f****** true.

    1. Re:Only for certain kind of analyst... by Samschnooks · · Score: 5, Insightful

      ... most others keep thinking that M$ Excel is the silver bullet.

      The folks I know who use Excel for analysis use it because it's the package that everyone gets in their organization, there's a shit load of material on the web that uses excel, there's plenty of add-ons for it (no need to reinvent the wheel), and when sharing data and analysis, everyone is familiar with it. An engineer I know who uses excel chose it because it was the fastest way to connect to his testing equipment. R is relatively new and as more folks come into the workforce who know it, we'll see it replace Excel for functions that it is better suited for.

    2. Re:Only for certain kind of analyst... by Anonymous Coward · · Score: 4, Interesting

      I guess I was thinking of analysts using Excel to develop "complicated" statistical analyses. Sure, Excel is unbeatable at handling small, tabular datasets and doing basic or even considerable arithmetic with them.

      When it comes to do more elaborate analysis, using Excel IS reinventing the wheel. Plus, it is IMPOSSIBLE to understand later.

    3. Re:Only for certain kind of analyst... by jaxtherat · · Score: 5, Informative

      Sorry, but R is not relatively new, it's been around for at least 10 years, I was taught how to use R at University back in 2001, and S and later S+ (which R is a FOSS version of) has been around for even longer, since the mid 70's.

      --
      http://www.zombieapocalypse.tv/
    4. Re:Only for certain kind of analyst... by colinrichardday · · Score: 3, Interesting

      Has Microsoft corrected its percentile function? Or does it still put the largest datum in the 100th percentile, as well as assign fractional percentiles?

    5. Re:Only for certain kind of analyst... by Hatta · · Score: 2, Insightful

      Do analysts who use R get better returns than those who use Excel?

      --
      Give me Classic Slashdot or give me death!
    6. Re:Only for certain kind of analyst... by zippthorne · · Score: 4, Informative

      Pfft. Matlab is the fastest way to connect to his testing equipment.

      Well.. Labview, actually, but no one in their right mind would want to actually use it. Anyway, simulink gets you a lot of the graphical programming features if you need that.

      --
      Can you be Even More Awesome?!
    7. Re:Only for certain kind of analyst... by PachmanP · · Score: 5, Funny

      So we can the financial crisis on idiots who don't understand that GIGO applies in EVERY computer language?

      No, but we can the dropping of verbs on idiots who don't understand that they apply to EVERY sentence!

      --
      You're thinking small. Why miniaturize the laser, when we could instead enlarge the sharks? -John Searle
    8. Re:Only for certain kind of analyst... by cool_arrow · · Score: 1

      what's wrong with labview? Just curious - I thought I might use it for future project.

    9. Re:Only for certain kind of analyst... by Kyle3om · · Score: 5, Insightful

      The flowchart programming of labview is a pain in the butt for many looped programs and programs with complicated timings. Mablab is easier for most things (and more powerful) if you can get your external equipment to work with it without jumping through hoops.

    10. Re:Only for certain kind of analyst... by zippthorne · · Score: 1

      Yeah, what archie said. I was a little harsh. If your algorithmic need is simple, it's a pretty quick set up. Very intuitive: connect physical thing to computer, connect virtual block to processing block to the logging block. You can even do feedback, motor controls, and more.

      And it's technically quite powerful, but beyond a certain level of complexity, the flow-chart style starts to obscure what's really going on: you're eventually going to have nested blocks and code blocks (i think.. it's been a while). The learning curve is steep at first, then a long plateau.

      So, you'll probably end up falling back on your more comfortable languages if you have to do any post-processing anyway, and considering how easy it is to set up external interfaces with e.g. matlab, if you've already got experience with it, then you've already got that going for you.

      Oddly, though, they're both often a hard sell to the very people who would benefit most from it. Many people seem to want to go with a low level language even if it means they'll have to hire a programmer to write a driver.

      --
      Can you be Even More Awesome?!
    11. Re:Only for certain kind of analyst... by Anonymous Coward · · Score: 0

      Well.. Labview, actually, but no one in their right mind would want to actually use it.

      Please convince my boss of this.

    12. Re:Only for certain kind of analyst... by Anonymous Coward · · Score: 0

      We use labview almost exclusively in our physics laboratory. (Mostly 'cause it's what the boss prefers...) We mostly use it for data acquisition/hardware control, then use Matlab, Octave, or Mathematica to do data analysis. (Though we do have a few people who try to do _everything_ with Labview.)

      Upsides:
      easy to learn
      usually not too bad to figure out what someone else's code does
      good for data acquisition (particularly if you buy NI cards)
      can implement a useful GUI in a lot less time than any other language I know
      NI support forums tend to be well staffed

      Downsides:
      expensive (few thousand $)
      proprietary
      planned obsolesence (new DAQ cards don't have drivers for versions of Labview > ~ 4 years old...but in an industrial or lab environment, 4 years is _nothing_)
      easy to make hard-to-maintain code (the graphical paradigm only goes so far - doesn't do too well when stuff gets complicated)
      somewhat limited GUI (you can do anything you need to, but it won't feel "native" like the Windows API or GTK)

      I don't use Matlab much (maybe once every 3 years), but I don't remember being able to make a GUI. I've heard good things about Yorick on Linux for data acquisition, but haven't tried it. Sadly, the best tool I can think of (after Labview) for data acquisition is VB 6. Easy to talk to DLLs, simple to put together a full-featured GUI, and if you could code decently in any other language, you could write decent code in VB 6. (The bad reputation is just because it was the language of choice for people who couldn't program, too.) Unforunately, Microsoft replaced it with the useless monstrosity that is .NET.

    13. Re:Only for certain kind of analyst... by Undead+Waffle · · Score: 5, Interesting

      I use LabView on a daily basis. I hate it.

      My coworkers like it and what they seem to have in common is that they either don't know any other languages or aren't proficient in them.

      It is a language that aims to be very simple by removing as much typed code as possible. Because of this you will spend stupid amounts of time moving little wires around and trying to make your code not look like a tangled mess. And good luck changing it later.

      Since there are no functions and the only way to reuse code is to put it in a different file people tend not to do this. So if you want to use part of someone else's code you will usually have to copy and paste into a different file and spend a bunch of time reconnecting wires and dealing with references to variables you won't have access to in the new file.

      The visual style is also, in my opinion, much harder to read than typed code. If I'm trying to figure out some sort of formula it's easier to read it as text than try to figure out where all these wires are coming from that are connected to little "+" and "-" terminals. Also, since comments take space they tend to be short and are usually missing in more complicated sections because it's harder to route the wires around them. And control structures quickly make code virtually unreadable.

      There's also the part about writing most of your code with a mouse. Do you really enjoy having to navigate through a series of menus to do anything?

    14. Re:Only for certain kind of analyst... by dave1791 · · Score: 2, Informative

      >The folks I know who use Excel for analysis use it because it's the package that everyone gets in their organization, there's a shit load of material on the web that uses excel, there's plenty of add-ons for it (no need to reinvent the wheel), and when sharing data and analysis, everyone is familiar with it

      Back when I was in grad school, ten years ago, Excel was the preferred data analysis tool for most physical and biological scientists that I knew; even when they had high end analysis tools installed on their machines.

    15. Re:Only for certain kind of analyst... by Baseman · · Score: 0, Offtopic

      Do analysts who use R get better returns than those who use Excel?

      That they R :-)

    16. Re:Only for certain kind of analyst... by PeterBrett · · Score: 2, Insightful

      Pfft. Matlab is the fastest way to connect to his testing equipment.

      One of MATLAB's few redeeming features is the Instrument Control Toolbox, especially since it works well with most of the top-end Agilent/Tektronix kit. It's nice to be able to automate acquisition and analysis of instrument data from a single environment.

    17. Re:Only for certain kind of analyst... by pbrooks100 · · Score: 1

      After using LabVIEW for the last 10 years, I'll take it over Simulink any day...

    18. Re:Only for certain kind of analyst... by hot+soldering+iron · · Score: 1

      Did anyone else read this as "Has Microsoft corrected its PENILE function?"

      No, still hung like a squirrel...

      --
      When you want something built, come see me. If you want correct grammar and spelling, get a F*ing liberal arts student.
    19. Re:Only for certain kind of analyst... by sjwaste · · Score: 1

      R isn't relatively new, it's a derivative of S/S-Plus. Not 1:1, but S code will run on R. Personally, though, I like SAS better than I like R.

    20. Re:Only for certain kind of analyst... by jcupitt65 · · Score: 3, Informative
      I've come across a couple of examples of inappropriate use of Excel
      • A friend worked at the UK Treasury as a statistician. One of his jobs was testing and improving the Treasury's model of the UK enconomy. I was impressed and asked what tools they used for this. Erm, none, it's just a huge Excel spreadsheet.
      • One of my jobs is modelling for a project using FDG-PET to investiagate COPD and asthma. I was horrified to discover that these large 4D images were being analysed in ... Excel.
    21. Re:Only for certain kind of analyst... by Anonymous Coward · · Score: 1, Funny

      No, but we can the dropping of verbs on idiots who don't understand that they apply to EVERY sentence!

      Now, now; maybe he accidentally a coca-cola bottle.

    22. Re:Only for certain kind of analyst... by bozendoka · · Score: 0

      Once upon a time, a guy I worked with created an Excel workbook where the user would paste in a ginormous list of parts and it would go through about five minutes of gymnastics to parse it out into a bunch of shipping lists. After he left, guess who got to attempt to fix it when it (inevitably) broke?

      So many VLookups...

      --
      "You will soon be more aware of your growing awareness." - My first recursive fortune cookie!
    23. Re:Only for certain kind of analyst... by Anonymous Coward · · Score: 0

      "r is relatively new?"

      bell labs' S (the non-free predecessor of R) was available when i was in school. that was 28 years ago.

    24. Re:Only for certain kind of analyst... by Anonymous Coward · · Score: 0

      Wrong.

    25. Re:Only for certain kind of analyst... by s6135 · · Score: 0

      Excel is good in certain scenarios. Not so much in others. I use different tools for different problems. There is no one fit all.

    26. Re:Only for certain kind of analyst... by Kent+Recal · · Score: 1

      Ha! That's interesting, didn't know about it (maybe because I'm never using excel).
      Makes you wonder how many corporations and individuals have based their decisions on miscalculated data...

    27. Re:Only for certain kind of analyst... by Anonymous Coward · · Score: 0

      Is that 4D as in four-dimensional data? If so, I can only applaud the kind of single-minded dedication displayed there.

    28. Re:Only for certain kind of analyst... by arelas · · Score: 4, Funny

      I assumed it was the new pirate language everyone was raving about.

      --
      This is where my sig would go if I had one...

    29. Re:Only for certain kind of analyst... by pavon · · Score: 2, Insightful

      Since there are no functions and the only way to reuse code is to put it in a different file people tend not to do this.

      Oh yeah, and when you do so, you have to draw an icon to represent the function instead of just giving it a name, and many people don't do this (even though the icon could just be text in a box). And since the data-flow nature of the language also eliminates most intermediate variables, you end up with code that is nothing but unlabeled lines drawn between generic-looking boxes. In otherwords, the semi-self-documenting nature of function and variable names is lost because those names don't exist, or are not shown.

      Just another example of how LabView makes it easy for people to write bad code while being far more time-consuming to write good code than other languages.

    30. Re:Only for certain kind of analyst... by Anonymous Coward · · Score: 0

      You should try writing code with the new MacBook Wheel:

      http://www.theonion.com/content/video/apple_introduces_revolutionary

    31. Re:Only for certain kind of analyst... by dotancohen · · Score: 1

      Well.. Labview, actually, but no one in their right mind would want to actually use it.

      Why is that? I will start using Labview next semester and I could probably use whatever advice you will give.

      --
      It is dangerous to be right when the government is wrong.
    32. Re:Only for certain kind of analyst... by Mr.+Theorem · · Score: 2, Funny

      Labview: putting the spaghetti in spaghetti code.

      --
      *** Work like a king, command like a slave, create like a dog.
    33. Re:Only for certain kind of analyst... by przemekklosowski · · Score: 2, Funny
      The best characterization of LabView is:

      Finally we can write spaghetti code that looks like spaghetti.

    34. Re:Only for certain kind of analyst... by jcupitt65 · · Score: 1

      Yes, a set of volumetric images. Argh :-( I redid it in an image processing package and the run time went from a day to 20 seconds.

    35. Re:Only for certain kind of analyst... by blueskies · · Score: 2, Funny

      Why don't they just use Word if they need a database??

      http://www.neopoleon.com/home/blogs/neo/archive/2003/09/29/5458.aspx

    36. Re:Only for certain kind of analyst... by Anonymous Coward · · Score: 0

      I accidentally an entire Coca-cola bottle.

    37. Re:Only for certain kind of analyst... by retchdog · · Score: 1

      If they don't, it means that use and development of advanced statistical methods in finance, are as much smoke-and-mirrors as the rest of the finance "industry".

      It'd make a good test, actually...

      --
      "They were pure niggers." – Noam Chomsky
    38. Re:Only for certain kind of analyst... by zippthorne · · Score: 2, Interesting

      I was overly harsh. It has some good points. Just not compelling enough to bother to learn a whole new kind of language for, especially if you know about the powerful things in the matlab toolbox.

      But.. depending on what you're actually using it for next semester, I would venture to guess that you might not actually have to learn labview at all. My introduction to it was in a lab class where it was used to interface with a kind generic electronic projects daughter-board, and for the whole semester we never used it for anything more complicated than paring input to a log file (maybe ONE function filter) and output from a script.

      --
      Can you be Even More Awesome?!
    39. Re:Only for certain kind of analyst... by TheCouchPotatoFamine · · Score: 2, Interesting

      I made a living once reaching into excel spreadsheets from python to do math because excel was bone slow. A process that took *three* hours in excel took python about 45 seconds. Maybe my loops were smarter (hint) but it was still a very very dramatic experience. just sayin'

      --
      CS majors know the time/space tradeoff, but they never get taught the 3rd, crucial, tradeoff of the set: comprehension!
    40. Re:Only for certain kind of analyst... by kitecamguy · · Score: 1

      I used S in the 80s, it was a Bell Labs language, just like A, B, and finally C. So didn't they get the name wrong? Shouldn't it be T or maybe even U by now?

    41. Re:Only for certain kind of analyst... by hguorbray · · Score: 1

      Today's Main page fortune seems apt:

      Help stamp out Mickey-Mouse computer interfaces -- Menus are for Restaurants!

      I'm just sayin'

    42. Re:Only for certain kind of analyst... by gumbi+west · · Score: 1
      >R is relatively new

      R is a free software version of S, which initially appeared in 1975, about 10 years before Excel hit the shelves for the Mac in 1983 and DOS in 1985.

      The real difference is that R is a programing language, and looks sort of like one. Excel is a GUI for a very simple programing language, and looks like one.

      R only sort of looks like a programing language because lots of objects have custom print commands so that when you print them they print out a very pretty summary of themselves instead of just puking all over your screen like most OO languages do when you just print an object. This means that when you use it interactively, it feels like statistics software, but you can still use the programing language parts of it. When you use it non-interactively, it feels like a programing language that happens to have all sorts of statistical sugar.

    43. Re:Only for certain kind of analyst... by skeeto · · Score: 1

      The folks I know who use Excel for analysis use it because it's the package that everyone gets in their organization

      That's a shame, because Excel has some serious deficiencies when it comes to statistics and analysis. You simply can't trust any of the numbers it gives you. It's just flat out wrong a lot of the time.

      http://www.cs.uiowa.edu/~jcryer/JSMTalk2001.pdf
      http://pages.stern.nyu.edu/~jsimonof/classes/1305/pdf/excelreg.pdf

      Also, searching the interwebs will dig up all kinds of articles about problems with Excel doing odd things. Excel is the wrong tool for the job.

    44. Re:Only for certain kind of analyst... by Meski · · Score: 1

      And of course, it's a database engine par excellence. :^)

    45. Re:Only for certain kind of analyst... by Meski · · Score: 1

      I accidentally an entire Coca-cola bottle.

      And then cast it to VOID

    46. Re:Only for certain kind of analyst... by tehcyder · · Score: 1

      A friend worked at the UK Treasury as a statistician. One of his jobs was testing and improving the Treasury's model of the UK enconomy. I was impressed and asked what tools they used for this. Erm, none, it's just a huge Excel spreadsheet.

      But how do you know that it is inappropriate and not sufficient? I'm sure the government would happily pay tens of thousands for specialist software if it thought it necessary.

      Do you know what software other countries use for their economic models, for instance?

      I get the impression they might just as well write it in pencil on the back of a fag packet anyway.

      --
      To have a right to do a thing is not at all the same as to be right in doing it
  2. What's a pirate's favorite programming language? by Anonymous Coward · · Score: 5, Funny

    R!

  3. popular? no by geekoid · · Score: 4, Insightful

    Growing in use? sure.

    --
    The Kruger Dunning explains most post on /. http://en.wikipedia.org/wiki/Dunning%E2%80%93Kruger_effect
  4. Based on S by BadAnalogyGuy · · Score: 1

    Why they chose to go with R rather than T, I'll never know.

    1. Re:Based on S by drolli · · Score: 1

      The point is S is popular, but expensive. R gets some popularity from that. One could hope also S is made free at some point.

      And i also dont know why it is called R.... maybe because sounds starting with a vowel sound better.....

    2. Re:Based on S by irtza · · Score: 4, Funny

      Trying to find middle ground with C?

      --
      When all else fails, try.
    3. Re:Based on S by Anonymous Coward · · Score: 3, Informative

      And i also dont know why it is called R

      The guys who originally wrote both had first names that started with R and being the jokers that they were, they thought it would be funny to give it a name very similar to S.

    4. Re:Based on S by Anonymous Coward · · Score: 5, Interesting

      I wish it had a more googleable name. It's hard to search for help. The signal to noise ratio is low.

    5. Re:Based on S by rssrss · · Score: 2, Informative

      "And I also don't know why it is called R"

      "The guys who originally wrote both had first names that started with R and being the jokers that they were, they thought it would be funny to give it a name very similar to S."

      Additionally, in statistics r is the letter used to denote the Pearson product-moment correlation coefficient.

      --
      In the land of the blind, the one-eyed man is king.
    6. Re:Based on S by spud603 · · Score: 5, Informative

      Tell me about it. Try this:
      http://www.rseek.org/

    7. Re:Based on S by lysergic.acid · · Score: 2, Informative

      are you talking about R or S? searching for "R" on google returns pretty good results--the first 6 links are all related to R. and 4 of the results on the next page are also related to R. searching for "S" on the other hand doesn't immediately come up with any relevant results.

      i'd say it's fairly easy to find info on R using google considering its limited popularity relative to other languages. obviously you're not going to find a ton of information on it since it's a somewhat obscure niche language. but if you can find the r-project/CRAN website or other R resources on google, then you can probably find documentation for whatever info you need.

      besides, you can always use multiple keywords and boolean search operators to narrow down your search results, like searching for "R" AND "statistics." or once you've found online documentation for "R" you can use the "site:" modifier to search that site only.

      i mean, this is all pretty basic stuff. there are much harder things to search for information on--like pharmaceutical drugs. this just requires basic knowledge of search engines and a little commonsense.

    8. Re:Based on S by Rhabarber · · Score: 2, Interesting

      Or that if you don't have Javascript enabled.

    9. Re:Based on S by Anonymous Coward · · Score: 0

      Googling for R-Project will get good results.

    10. Re:Based on S by digitig · · Score: 5, Funny

      It could be worse. Try searching for the natural language processing system "Lolita".

      --
      Quidnam Latine loqui modo coepi?
    11. Re:Based on S by micheas · · Score: 1

      r-cran is what I usually google for or just cran with the problem.

      It isn't perfect but I tend to get somewhat close.

      apt-get install r-cran-* will get you a large subset of the R extensions if you are interested in playing with it. I suppose you could just install r-base but what's the fun in that :-)

    12. Re:Based on S by divisionbyzero · · Score: 1

      "R Programming language" data mining

    13. Re:Based on S by cerberusss · · Score: 3, Funny

      I tried. The search results are extremely relevant to my interests. Of course, I don't use the natural language processing system "Lolita".

      --
      8 of 13 people found this answer helpful. Did you?
    14. Re:Based on S by Just+Some+Guy · · Score: 3, Funny

      That "Post Anonymously" button is kind of hard to miss these days.

      --
      Dewey, what part of this looks like authorities should be involved?
    15. Re:Based on S by rev063 · · Score: 1

      That can be a problem (but Google returns meaning results for searches involving R these days).
      That said, there's a *lot* of information out there about R. The r-help mailing list in particular is very active (making r-help a good term to add to a Google search).

      I maintain a blog about R with the aim of collecting the most useful information in one place. (Disclaimer: I do this as part of my work for a company that provides commercial support for R.)

    16. Re:Based on S by retchdog · · Score: 1

      No free RPro for linux, and only binary installers for Windows and Mac. Please explain to me how you aren't violating the GPLv2, which is R's license, by doing the latter. (The former is just annoying, not illegal.) Since you refer to your product as an "enhanced distribution of open-source R", I can only assume you didn't recode it from scratch (which would be quite an undertaking).

      Since it's open source, I suppose what I need to do to get a linux version, is find someone who has bought the "server" version and get a copy from them... surely you wouldn't have a problem with this, yes?

      --
      "They were pure niggers." – Noam Chomsky
    17. Re:Based on S by Anonymous Coward · · Score: 0

      ... or the Neural Information Processing Systems conference "NIPS".

    18. Re:Based on S by ORBAT · · Score: 1

      Ah, a fan of Nabokov then?

    19. Re:Based on S by rev063 · · Score: 1

      The modified R sources have always been available alongside the binaries at http://www.revolution-computing.com/binaries, and there's now a link on the REvolution R download page as well.

      If you want to get a Linux binary, download the sources and compile it. It should work fine on recent versions of RHEL and SLES if you have the necessary toolchain, but YMMV on other variants of Linux. That's the only reason why we currently don't provide free (as in beer) binaries for Linux -- there are so many variants that it's difficult and costly for us to test and support them all.

      As an open-source company we support and respect the GPL. We're here to support R and R community, and changes to core R made by our development team (such as 64-bit support on Windows, which we're working on now) are contributed back to the development community via the GPL as they should (and must) be.

  5. Two links? by CannonballHead · · Score: 1

    There appear to be duplicate links in the summary :)

  6. Well... by Weaselmancer · · Score: 5, Funny

    ...if at first you don't succeed, then skydiving is not for you.

    --
    Weaselmancer
    rediculous.
    1. Re:Well... by homebrewmike · · Score: 1

      Sounds like your first sky diving trip didn't turn out well.

      And, yes, I think I'm funny. Waka Waka Waka

    2. Re:Well... by Dishevel · · Score: 1

      He Doesn't have any now.

      --
      Why is it so hard to only have politicians for a few years, then have them go away?
    3. Re:Well... by ohmpossum · · Score: 1
      Is that a pirate language?

      Step 1. remove main sail

      Step 2. tie ropes from sail to harness

      Step 3. climb to top of highest mast and jump off

      Step 4. Arrrrrrrr

      --
      Just set me up a basic sig... 10 PRINT "Gordon Aplin" : GOTO 10
  7. Show me some example code by bogaboga · · Score: 5, Insightful

    My request is to those that are in the know to show me some example code, that does something useful. Then later, compare that code to code from other languages to accomplish the same task.

    Include reasons to support the notion that the R language is [necessarily] better at what it does.

    1. Re:Show me some example code by Anonymous Coward · · Score: 0

      as opposed to something like SAS (leaving aside licensing costs)

    2. Re:Show me some example code by transonic_shock · · Score: 5, Insightful

      FTA
      "I think it addresses a niche market for high-end data analysts that want free, readily available code," said Anne H. Milley, director of technology product marketing at SAS. She adds, "We have customers who build engines for aircraft. I am happy they are not using freeware when I get on a jet.""

      Seriously, does this person know what she is talking about?

      1. Yes, CFD and Structural Analysis software is increasingly written using open source tools and run on open source OS (Linux running on clusters)

      2. SAS is not used to design any part of the aircraft.

      I have noticed SAS uses the same kind of FUD to counter R as M$ uses to counter Linux.

    3. Re:Show me some example code by visible.frylock · · Score: 5, Insightful

      Seriously, does this person know what she is talking about?

      Let's see, Director of technology product marketing. I'm gonna go with a big NO.

      --
      Billy Brown rides on. Yolanda Green bypasses Gary White.
    4. Re:Show me some example code by Anonymous Coward · · Score: 4, Informative

      It may not be "better" in the sense of "calculating stuff with higher efficiency" (i reckon you can do the same stuff in C, given the right libraries :P), but for statistical and data mining/visualization purposes it is a quite simple object-oriented functional language with many useful built-in procedures and lots of freely available packages/libraries that is simple enough for "non-programmers" and, so far, it does what i want it to do fast enough and.. it's free.

      So.. probably not the best all-purpose programming language, but fits nicely in the "statistical software environment/language" niche and, unlike SPSS et al., it's free (as in "libre", as in "everyone can independently verify your results without having to shell out cash", which is useful in academia).

      Example code:

      results <- prcomp(datamatrix)

      This does a PCA (Principal Component Analysis) on the data contained in "datamatrix" and dumps the results into the "results" variable.

      I have no idea how i would start to code that in C, python, etc. in a way that's remotely efficient ;)

    5. Re:Show me some example code by Neil+Blender · · Score: 1

      Include reasons to support the notion that the R language is [necessarily] better at what it does.

      Bioconductor.

    6. Re:Show me some example code by Keyper7 · · Score: 4, Informative

      It's been a while since I worked with it and I don't have code examples with me at the moment, but think of it as the Matlab/Octave of statistics, including the preference for "function over each row/column" instead of loops.

      Compared to other languages, R makes it easy to do statistical analysis tasks like Matlab/Octave makes it easy to do linear algebra tasks.

      Plus, as other posts stated above, there's excellent documentation and tons of useful libraries (take a peek at the libraries available at the Debian repositories), Bioconductor being the finest example.

      Oh, and nice emacs integration. :)

    7. Re:Show me some example code by Anonymous Coward · · Score: 0

      inb4bioconductor :3

      oh... shucks -_-'

      brb, back2affymetrix ^-^

    8. Re:Show me some example code by Anonymous Coward · · Score: 1, Informative

      R is not a programming language, it is an environment which uses the S programming language. The S programming language was developed in the 70s at Bell Labs.

      If you use Linux, you can install R with

      yum install R*

      which contains many examples.

      People switching to R usually started with Splus, which a few years ago worked to close source code contributed by academics. They have chosen to move to R.

    9. Re:Show me some example code by lt.+slock · · Score: 5, Informative

      I use R a great deal. Think of it as an alternative to MATLAB, or Excel, rather than C or perl or lisp or whatever you like to use as a general purpose language. So, compared to MATLAB, functions are first class objects (rather like lisp), so, you can write functions that take functions as arguments, and return them as well, just as though
      they were simple variables. It handles
      vectors rather easily, and has decent plotting tools.

      #quick example

      # function, which, given numerical arguments a and b, and a function g, returns a function of x
      f - function(a,b, g){
          function(x){ a * x + g(b * x)}
      }

      f1 - f(1,2.5,sin)
      x - seq(-pi,pi,l=100)
      plot(x,f1(x),type='l')

    10. Re:Show me some example code by Anonymous Coward · · Score: 4, Informative

      i'm a PhD student in biostatistics at a fairly prestigious american university. we use R almost exclusively, because it is better than other statistical software options. reasons for it's superiority are i) it's free ii) it's open source and iii) its considerably more powerful than STATA, SPSS, SAS, etc.

      it is true that other languages can be quicker for many tasks. proficiency in C is desirable, but C is not geared toward statistics, where many built-in libraries and user-contributed packages for R implement complex methodologies.

      i'm not as versed in C as i am in R, so i can't provide a direct comparison of the languages, but i have included a sample below. it's a function that fits a simple linear model, taking the outcome data and input data (as a matrix) and a couple of other parameters as inputs. it returns a variety of values, including the model coefficients and fitted values. there is an R function that does this exact thing, but we have to do something for homework.

      lm=function(y,x,returnHat=FALSE,addInt=FALSE){
              if(addInt){
                      x=cbind(matrix(1,nrow(x),1),x)
                      }
              #use range around 0, for roundoff error
              if(-1e-5=det(t(x)%*%x) & det(t(x)%*%x)=1e-5){stop("x'x not invertible",call.=F)}

              beta=solve(t(x) %*% x) %*% t(x) %*% y
              sigma = as.numeric(sqrt(var(y-(x%*%beta))))
              varbeta=sigma * (solve(t(x)%*% x))
              fitted=x %*% beta
              residuals=y-fitted

              if(!returnHat){
              output=list(beta,sigma,varbeta,fitted,residuals)
              names(output)=c("beta","sigma","varbeta","fitted","residuals")
                                  }

              if(returnHat){
              hat=x%*% solve(t(x) %*% x) %*% t(x)
              output=list(beta,sigma,varbeta,fitted,residuals,hat)
              names(output)=c("beta", "sigma", "varbeta", "fitted", "residuals", "hat matrix")
                      }

              output

      }

      i'd also say that i'm glad to see some press for R. it's popular in some circles, but not as accepted by companies and some academics because it is open source. the idea is that software you have to pay a licensing fee for must be more reliable because, well, you paid for it (thinking i'm sure you're familiar with).
             

    11. Re:Show me some example code by lt.+slock · · Score: 2, Informative

      note that the minus (as in f - function...) signs should be (left angle bracket minus sign), that is, the R assigmnent operator, I guess this is the lameness filter

    12. Re:Show me some example code by Anonymous Coward · · Score: 0

      it's because slashdot interprets your comment as html code.. try using "<" instead of the "left angle bracket" ;)

    13. Re:Show me some example code by Anonymous Coward · · Score: 1, Informative

      Want example code and comparison with other stats software? Here's 80 pages from an entire BOOK devoted to your request:

      http://RforSASandSPSSusers.comÂ

      From the text:
      From the text:
      Since its release in 1996, R has dramatically changed the landscape of research software. There
      are very few things that SAS or SPSS will do that R cannot, while R can do a wide range of things
      that the others cannot. Given that R is free and the others quite expensive, R is definitely worth
      investigating.
      It takes most statistics packages at least five years to add a major new analytic method.
      Statisticians who develop new methods often work in R, so R users often get to use them
      immediately. There are now over 800 addâon packages available for R.
      R also has full matrix capabilities that are quite similar to MATLAB, and it even offers a MATLAB
      emulation package.

      If you'd like to see some examples with accompanying graphics, check out the newsletters or manuals at
      http://cran.r-project.org/

      I use R because it's free, there's lots of free add-on code, every other statistician I know uses R, it's quick and easy to test stuff out in R, and if you want you can speed up things by writing the most computationally intensive parts of your program in C, C++, or FORTRAN. Also, you can get great graphics out of R if you put in a little effort to learn how.

    14. Re:Show me some example code by lt.+slock · · Score: 1

      cheers... don't do a lot of posting...

    15. Re:Show me some example code by garcia · · Score: 2, Interesting

      My request is to those that are in the know to show me some example code, that does something useful. Then later, compare that code to code from other languages to accomplish the same task.

      Would you ask someone who utilizes SAS or SPSS to do the same thing? Because that's more or less what R is -- a free version of SAS or SPSS. I work in SAS all day long and I have been planning on using R to automate some of my personal website statistics/graphing that I run regularly because I don't really like doing the queries in MySQL on the console, copying the data to Excel, and graphing the results.

      As anyone knows, you should utilize the best tool for any particular job you're doing. There's no sense in recreating the wheel in C or Perl or Foo when R, SAS, SPSS, or whatever does stats, mining, and graphing well.

    16. Re:Show me some example code by Anonymous Coward · · Score: 0

      "it's superiority"

      *facepalm*

      Well, at least you're not an English major.

    17. Re:Show me some example code by Anonymous Coward · · Score: 1, Informative

      # Draws labelled diagrams with critical
      # region's for the normal and t distributions
      #
      # Excuse my lack of code reuse, etc. this
      # was meant to make diagrams just for a quick
      # homework assignment
      #
      # Please show me how to do this in SAS!!!
      # Tell me you'd even think of trying this in SAS
      # to draw pictures for your short homework
      # assignment
      #
      #

      crit_norm_diag = function(alpha,lowertail=T) {
              par(new=F);

              end = -4;
              crit_value = qnorm(alpha);
              if(!lowertail) {
                      crit_value = -crit_value;
                      end = -end;
              }

              pts = c(end,crit_value);
              pts = sort(pts);

              x = seq(pts[1],pts[2],by=0.01);
              y = dnorm(x);

              x = append(x,c(pts[2],pts[1]));
              y = append(y,c(0,0));

              plot(dnorm,-4,4,xlab='z',ylab='p.d.f.');
              par(new=T);
              polygon(matrix(c(x,y),ncol=2,byrow=F),density=25);
              if(crit_value0) {
                      text(-3,0.3,round(crit_value,3),pos=3);
                      arrows(-3,0.3,crit_value,dnorm(crit_value),angle=20);
              } else {
                      text(3,0.3,round(crit_value,3),pos=3);
                      arrows(3,0.3,crit_value,dnorm(crit_value),angle=20);
              }

              par(new=F);
      }

      crit_norm_diag(0.05);

      crit_t_diag = function(alpha,df,lowertail=T) {
              par(new=F);

              end = -4;
              crit_value = qt(alpha,df);
              if(!lowertail) {
                      crit_value = -crit_value;
                      end = -end;
              }

              pts = c(end,crit_value);
              pts = sort(pts);

              x = seq(pts[1],pts[2],by=0.01);
              y = dt(x,df);

              x = append(x,c(pts[2],pts[1]));
              y = append(y,c(0,0));

              plot(function(x) { dt(x,df) },-4,4,xlab=paste('t, d.f.=',df,sep=''),ylab='p.d.f.');
              par(new=T);
              polygon(matrix(c(x,y),ncol=2,byrow=F),density=25);
              if(crit_value0) {
                      text(-3,0.3,round(crit_value,3),pos=3);
                      arrows(-3,0.3,crit_value,dt(crit_value,df),angle=20);
              } else {
                      text(3,0.3,round(crit_value,3),pos=3);
                      arrows(3,0.3,crit_value,dt(crit_value,df),angle=20);
              }

              par(new=F);
      }

      crit_t_diag(0.05,10);

    18. Re:Show me some example code by Jurily · · Score: 1

      I have no idea how i would start to code that in C, python, etc. in a way that's remotely efficient ;)

      I'd go with

      #include "prcomp.h"

      Once someone did the algorithm for you, any programming language is easy. I think the point of the language would be, if said algorithm was orders of magnitude easier to code, represent, argue about, etc. in R, than it would be in "C, Python, etc."

    19. Re:Show me some example code by Anonymous Coward · · Score: 0

      Why would anyone bother to do any of that for you? Are you handicapped? Too busy doing something altruistic?

      And what do you plan to do with the information? Skim it and then dismiss it, maybe after posting a clever fisking?

      Satisfy your own curiosity and do your own research.

    20. Re:Show me some example code by Watson+Ladd · · Score: 1

      R has vector operations. Every operator works componentwise on a vector, and does the right thing with scalars. This makes vector heavy code easier and clearer to write.

      --
      Inventions have long since reached their limit, and I see no hope for further development.-- Frontinus, 1st cent. AD
    21. Re:Show me some example code by dookiesan · · Score: 2, Informative
      In R you can easily extract elements of an array :

      x = 1:10 #integers from 1 to 10

      #set all even elts of x that are less than 7

      x[(x < 7)&(x %% 2 == 0)] = -1

      #y is some big array with several dimensions

      #I and J are vectors of integers

      z = y[I,,J,,, drop = F]

      #'z' is now a sub array

      z = y[I,2,J,1,]

      #now z is a subarray with fewer dimensions

    22. Re:Show me some example code by stephentyrone · · Score: 4, Insightful

      I have no idea how i would start to code that in C, python, etc. in a way that's remotely efficient ;)

      How about:

      #include <clapack.h>
      dgesdd( argument list );

      This sort of thing is a feature of libraries, not an inherent advantage of one language.

    23. Re:Show me some example code by Anonymous Coward · · Score: 0

      I support this comparison, but only to a certain extent.

      I was taught Matlab for numerical analysis, then years later had SPSS beaten into me for statistics. SPSS has its own pseudo-scripting interface which it calls "syntax" which allows functionality like Excel, but with a slightly more unified way of going between gui and text command. Conversely, R and Matlab are both by and large command line high-level C (from what I can understand, anyway) but R has a great deal more functionality since you can create your own packages. So, to review:

      R:Matlab :: SPSS:Excel

    24. Re:Show me some example code by zippthorne · · Score: 2, Insightful

      But we already have a language that does vectors correctly. It's called Matlab and it's based on Fortran, which I guess technically also does vectors correctly, if you want to bother to learn it.

      --
      Can you be Even More Awesome?!
    25. Re:Show me some example code by Anonymous Coward · · Score: 0

      Come on, she is in marketing and I guess she got this position by cleverly convincing similarly unqualified people to buy SAS software.
      She doesn't have to know how aircrafts are built because she is for sure flying first class.
       

    26. Re:Show me some example code by Daniel+Dvorkin · · Score: 4, Insightful

      One big advantage R has over Matlab (er, besides the fact that R is OSS, but of course there's Octave for those who want an OSS Matlab alternative) is that R handles non-matrix data structures much, much better than Matlab does. Trying to work with anything that isn't a vector or a matrix in Matlab is an exercise in pain.

      --
      The correlation between ignorance of statistics and using "correlation is not causation" as an argument is close to 1.
    27. Re:Show me some example code by tsalmark · · Score: 1

      I think you mean <

    28. Re:Show me some example code by Anonymous Coward · · Score: 0

      Sadly SAS software IS being used to design aircraft. There are a lot of similarities between drug testing and aircraft design space modeling.

    29. Re:Show me some example code by Daniel+Dvorkin · · Score: 1

      Because that's more or less what R is -- a free version of SAS or SPSS.

      More specifically, R is a free implementation of the S language; it would be more accurate to call it "a free version of S+" -- although at this point I suspect that, thanks to CRAN, its capabilities exceed those of the proprietary alternative.

      --
      The correlation between ignorance of statistics and using "correlation is not causation" as an argument is close to 1.
    30. Re:Show me some example code by Anonymous Coward · · Score: 0

      How the hell did you get modded up for this?
      Did you even bother reading the Wikipedia page or
      the article?
      Why don't you post something useful in your
      favorite language that does statistical analysis and
      challenge the R progamming community to do it better.
      Oh and include reasons why we should even pay attention to you.

      Your post is so generic that it could be used for just about anything - it makes no reference to anything said about R or any other statistical package.
      If you want to earn that "Insightful" moderation,
      why don't you challenge your fellow Slashdotters to find the smallest number of words that would have to be replaced in your post in order to make it about topic X?

    31. Re:Show me some example code by Anonymous Coward · · Score: 0

      You just need a svd routine to perform a pca. In c it means *PACK librairy. If you are looking for very few principal components compared to the matrix dimension, you can even compute a partial svd directly which may save you a lot of time

      Don't get me wrong, I love R, octave or other scientific programming environement. I just want to stress that scientific programming in c is not that hard.

      The lady in the article does not know what she is talking about as an awful lot of scientific software are based on opensource librairies like lapack or eispack. E.g: matlab uses lapack for example. Moreover academic scrutiny is very important for scientific code which is impossible for proprietary code.

    32. Re:Show me some example code by Anonymous Coward · · Score: 0

      It isn't the only horse in the race. Some like Matlab for example.

      mean(1:10)
      sd(rnorm(1000))
      t.test(rnorm(1000),rnorm(1000,mean=2))
      IV - rnorm(100)
      DV - IV+rnorm(100)
      reg - lm(DV ~ ID)
      summary(reg)
      plot(reg)

      It is particularly nice for simulations.

    33. Re:Show me some example code by gringer · · Score: 2, Insightful

      Okay, I'll take you up on that... here's some code that takes in a vector of genotypes (as a factor with levels AA,AC,CC,XX), and a matrix of columns to be used for different bootstraps, and spits out a list of genotype counts for those bootstraps:


      ## matmap -- maps a vector onto a matrix of indexes to the vector
      ## (a hack to get round something that R doesn't seem to do by default)
      matmap <- function(vector.in, matrix.indices){
          res <- vector.in[matrix.indices];
          if(is.null(dim(matrix.indices))){
              dim(res) <- c(length(matrix.indices),1);
          } else {
              dim(res) <- dim(matrix.indices);
          }
          return(res);
      }
      ## generate table based on genotype frequencies
      GTcounts <- function(in.genotypes, columns.pop){
          gt.table <- apply(matmap(in.genotypes,columns.pop),2,tabulate, nbins = 4);
          rownames(gt.table) <- levels(in.genotypes);
          return(gt.table);
      }

      Out of the [imperative] languages I know, only octave/matlab have a chance out doing better than that in terms of lines of code. And when you're writing code, being able to avoid duplication and mindless for loops is a really useful feature.

      --
      Ask me about repetitive DNA
    34. Re:Show me some example code by Anonymous Coward · · Score: 2, Interesting

      the thing is.. C is way too verbose for non-programmers. R, like Matlab/Octave, makes it more straightfoward to work if you don't care much about compiler/memory management/etc. details that software developers usually care for.

      sure, you can do whatever you want in C, .. heck, even assembler ;) but you have to understand that some people don't really care about data structures and complicated ways to declare objects: as always, one should use the level of abstraction that one feels comfortable with to deal with the specific "algorithmic needs", no?

    35. Re:Show me some example code by Anonymous Coward · · Score: 0

      customers who build engines for aircraft ..
      2. SAS is not used to design any part of the aircraft.

      Statistical quality control on the production side (keyword "build"), tear and wear studies and statistical differential equations on the design side. Somebody with a degree on material science, applied mathematics, aerospace or civil engineering could propably answer more precisely.

    36. Re:Show me some example code by sjames · · Score: 1

      Since /. accepts HTML, you have to use &lt; where you want <. Otherwise it thinks you're starting an HTML tag.

    37. Re:Show me some example code by XDirtypunkX · · Score: 0, Troll

      And with code like that, the poster should stay the hell away from computer science too!

    38. Re:Show me some example code by Peaquod · · Score: 4, Insightful

      Yeah that's a poorly informed comment. C is a freeware language. And it is used in virtually every embedded system on earth... like the control system for the laser that cuts your cornea at the neighborhood lasik shop. No doubt R is staggeringly less mature than C, but the fact that it is free has no bearing on its quality.

    39. Re:Show me some example code by dlenmn · · Score: 1

      PCA isn't terribly complicated if you use a library to take care of the matrix stuff. I rolled my own code in Ruby and it takes a bit under 40 lines (search for 'PCA'). Use the Ruby interface to the GNU Scientific Library and it's plenty fast.

    40. Re:Show me some example code by timeOday · · Score: 1

      Thanks, I was wondering how R compares to Matlab and would welcome any further comments from knowledgeable people on that topic.

    41. Re:Show me some example code by thebrett · · Score: 4, Informative

      R is for statistics. Matlab is for numerics focusing on matricies. There is overlap, but they are good at two different things.

    42. Re:Show me some example code by fuzzyfuzzyfungus · · Score: 1

      I'm sure she is happy. If more people were using Free Software(seriously lady, the early 90's called and they want their term back) she would have had to pay for her own ticket.

    43. Re:Show me some example code by transonic_shock · · Score: 3, Informative

      Production side: I would agree. However statistical differential equations? SAS is good for predefined "statistical analysis", not for solving partial differential equations. Almost all mechanical problems in aerospace (read fluids, solids, thermal, electro) are expressed as partial differential equations. solutions of these (baring a few special cases) require numerical methods. The most common of these methods are finite element, finite difference and finite volume.
      And each one of these has it numerous "schemes" for solving a particular class of PDE. The choice of scheme/method depends on the problem at hand. You can use a prepackaged tool like Fluent/Gambit. But that limits you to the limitations of those packages. Need anything cutting edge, or applicable to a special case, you need to program it yourself (c/c++/fortran). Most design houses have tons of legacy code that they build upon and add modules to deal with their specific problem. A lot of these run on linux clusters or unix big irons. I don't think they use gcc though. For performance sake most use proprietary compilers (eg pgc, icc etc). But no SAS.

      Now, on the control systems side, most researchers use matlab, but most of the implementation is done using imbeded C or ADA.

      As for SAS, they do now support freeware aka Linux.
      I have personally notice a sense of unease when SAS employees are asked about R. They are quick to dismiss it claiming the usual FUD and then change the topic. It is quite amusing actually. Happens everytime.

    44. Re:Show me some example code by Anonymous Coward · · Score: 2, Informative

      Plus, R not only does "vectors" or "arrays"... R does "lists", and "data frames".

      These data structures make it much more logical to work with experimental data (e.g. to pass it between functions), and their use is logical and coherent througout the language. All through R, data structures "do the right thing".

    45. Re:Show me some example code by Anonymous Coward · · Score: 0

      how do you know that R implements that "efficiently" in any case ? (how big is the compiler/interpreter ?)

      surely you could find a library that does PCA, instead of writing your own... and "moving" all your existing code to R... or do you always create new projects from scratch instead of re-using ? (bad bad)

    46. Re:Show me some example code by lordholm · · Score: 1

      Considering that many aircrafts will have software built with some derivative of GCC, she is pretty much screwed on that part...

      --
      "Civis Europaeus sum!"
    47. Re:Show me some example code by Anonymous Coward · · Score: 0

      R Quick Reference, by E. Slate and E. Hill, adapted from the "R Reference
      Card" by Jonathan Baron.

    48. Re:Show me some example code by mpiktas · · Score: 2, Informative

      beta=solve(t(x) %*% x) %*% t(x) %*% y,

      NO, NO, NO!

      beta=solve(crossprod(X,X),crossprod(X,y))

      is much nicer, and it is less susceptible to round-of errors.

    49. Re:Show me some example code by jackchance · · Score: 1

      you can return a function from a function in matlab.  and pass a function to a function.

      % in your path
      function y=powfn(n)
      y=@(z)(z^n);

      >> pow2=powfn(2);
      >>pow2(2)

      ans =

          4

      etc....

      --
      1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181 6765
    50. Re:Show me some example code by Anonymous Coward · · Score: 0

      I'm glad someone pointed this quote out, as I was about to do the same. It seems any software with "free" anywhere near or related to it is believed to be potentially unreliable? I think that by saying that she was pointing out the fact that should a error occur, *free* software would most likely be "free" of blame in some legal aspect. That is what I think most people are concerned with, where to point the finger after the fact. "I'll take my compensation now, thank you." Still, her statment says nothing about quality of software, only hints at blame issues.

    51. Re:Show me some example code by Anonymous Coward · · Score: 0

      But, not using the same syntax as other types of data. Another advantage to R is its lexical scoping, which I don't believe MATLAB has (maybe I'm wrong, I switched a while back)

    52. Re:Show me some example code by Bromskloss · · Score: 1

      One big advantage R has over Matlab (er, besides the fact that R is OSS, but of course there's Octave for those who want an OSS Matlab alternative)

      Oh, are you saying that R could be a replacement for Octave? I always thought R was very specifically for statistical analysis, so it never occurred to me that it could be used for general purpose calculations.

      --
      Swedish plasma phys. PhD student; MSc EE; knows maths, programming, electronics; finance interest; seeks opportunities
    53. Re:Show me some example code by digitig · · Score: 1

      The headline is misleading. There's nothing special about the R language, except perhaps that it's reasonably close to the mathematical notation that it's target users are likely to be familiar with, so you could view it as a sort of domain-specific language. The reason R is used is that it comes with a very rich library of high-end mathematical functions, so the analysts don't have to reinvent the wheel by writing their own symbolic factorisation function or their own Wilcoxson rank sum test with continuity correction function. So it's not really the language that attracts people to R, just as it's not the language that attracts people to Microsoft Excel or to OpenOffice.org calc (who would choose a product because they liked VBA or OpenOffice.org Basic?) Rather, it's the combination of the capabilities of the whole package and the zero price tag that people like.

      --
      Quidnam Latine loqui modo coepi?
    54. Re:Show me some example code by nvatvani · · Score: 1

      Actually, from what I see - I feel that Matlab is a superset of R. A big difference to your "overlap" comment.

      The only benefit of R is OSS. This is also technically bad because another OSS project (Octave) also exists.

      Would it not be better if R and Octave were consolidated and their differences merged together?

      Whatever the case, I don't see Matlab losing ground (unless they seriously hike their costs).

    55. Re:Show me some example code by pjabardo · · Score: 1

      I don't do much statitistics and I use R much of the time. I find the language much nicer to work, graphics part much better and linking to C/Fortran much easier.

      One annoying thing is that sometimes you look for something trivially done in matlab/octave only to find that statitians use a different name for it.

      One other problem is that since most people using R are usually doing statistics, other areas don't have as many packages and extensions. But this is changing fast because of the rapid growth in use. One year ago I was the only one using it at the mechanical engineering department but I hava managed to convert several people already.

    56. Re:Show me some example code by Oori · · Score: 1

      The OSS bit becomes a big deal when you want to use parallel computations (on cloud, grid-computing env). We use R for thousands of massively parallel computations on TeraGrid, using its database interface to querty remoted DBs.

    57. Re:Show me some example code by Anonymous Coward · · Score: 0

      this has been done many times, its a no brainer; R is far more efficient at what it does than any other competing language, check it out yourself, its easy!

      sorry I can't be bothered creating an account I followed a trail here ..

    58. Re:Show me some example code by Anonymous Coward · · Score: 0

      I've worked in the past on some large closed-source software used to design aircraft, and it's scary legacy stuff that wouldn't be tolerated in the Open Source world.

    59. Re:Show me some example code by hannson · · Score: 1

      She adds, "We have customers who build engines for aircraft. I am happy they are not using freeware when I get on a jet.

      Yeah, proprietary software FTW! Can you imagine flying without the security of proprietary products?

      "You are experiencing an in-air collision.
      [Allow], [Cancel]"

    60. Re:Show me some example code by Anonymous Coward · · Score: 1, Informative

      SAS is very threatened by R, in a number of markets, but from my experience extremely threatened in biomedical research. When you charge 10s of thousands of dollars for platform and there's a strong open source free platform that due to its nature is generally 6-12 months ahead in terms of implementation of cutting edge algorithms, you have little but FUD to fall back on.

    61. Re:Show me some example code by aisaac · · Score: 1

      R handles non-matrix data structures much, much better than Matlab does

      This advantage is even larger for Python. Use the NumPy package for efficient array handling and basic linear algebra. Use SciPy for optimization and statistics. Use Matplotlib for amazingly powerful 2d graphics. And if you occasionally need R, which does have an wonderfully deep statistical library, you can access it with rpy.

    62. Re:Show me some example code by Anonymous Coward · · Score: 0

      R is not really just a "language" (its really dialect of scheme irrc) but a whole environment, much like matlab. I has package management and help built in. Its memory handling is much better than S or matlab and so its easier to analyze big datasets.
      As a tool is well suited for data legwork in both the repetitive setting as well as the one of cases.

    63. Re:Show me some example code by BlueShirt · · Score: 1

      Not to mention that SAS itself is written in C, an open-source programming language. Sheesh, I thought only my bosses spewed this bullshit.

    64. Re:Show me some example code by sunhou · · Score: 3, Informative

      I used to use Matlab quite a lot (mostly for prototyping simulations and for visualization; I use C for my "real" simulations which take a lot of CPU time, since they run so much faster in C). I learned R about 2 years ago, and found that it can do pretty much everything Matlab can that I need for my own research.

      Anyway, I wrote up a "Matlab / R Reference" that translates the basics between the two packages. It doesn't have highly specialized stuff, but many people have found it handy. I use my own reference quite a bit myself, since these days I mix up commands between the two packages quite a bit. It's available at:
      http://www.math.umaine.edu/faculty/hiebeler/comp/matlabR.html

    65. Re:Show me some example code by jbolden · · Score: 1

      It wouldn't shock me if people use SAS for aircraft design. Store and create all the statistics on maintenance issues over a fleet of planes over a decade or more. That sounds like the kind of thing one would use SAS for.

    66. Re:Show me some example code by sunhou · · Score: 1

      I used to think R was very specific for stats as well, but eventually a colleague told me he was pretty sure it could do most of what I used Matlab for (spatial stochastic models, basically continuous-time stochastic cellular automata). See my comment and link to Matlab/R reference over at:
      http://developers.slashdot.org/comments.pl?sid=1084091&cid=26371723

    67. Re:Show me some example code by stonecypher · · Score: 1, Informative

      C is a freeware language.

      No, it isn't. The standard is maintained by the ISO and costs money. That there happen to be free compilers for C doesn't mean that C itself is free.

      --
      StoneCypher is Full of BS
    68. Re:Show me some example code by Anonymous Coward · · Score: 0

      some.mat[is.na(some.mat$val),4] <- another.mat[is.na(some.mat$val),"se"]

      Will take a matrix some.mat, and for each row where the column named 'val' is NA, change the value of the fourth column to the corresponding value of the column named 'se' in another.mat.

      Oh- I forgot to mention- another.mat only has a quarter as many rows as some.mat but will be looped through as necessary. And yes, there are many circumstances where that behaviour is desirable and useful.

    69. Re:Show me some example code by Anonymous Coward · · Score: 0

      rnorm(26) -> x
      names(x) = letters
      x[x > 1]
      x[-100]
      x[100:1]
      x["q"]
      x[rep(10,5)]
      x + 5
      x[names(x) %in% c("a","b","c")]
      sample(x)
      lapply(x,function(x) x^2)

    70. Re:Show me some example code by Anonymous Coward · · Score: 0

      I think you mean:

      x[-26]
      x[26:1]

    71. Re:Show me some example code by GlobalEcho · · Score: 1

      As an ecosystem, Matlab is no superset. There are a lot of packages available for R that are either not available in Matlab or are of far poorer quality.

    72. Re:Show me some example code by Anonymous Coward · · Score: 0

      FTA ... She adds, "We have customers who build engines for aircraft. I am happy they are not using freeware when I get on a jet."" ...

      I attended a talk by a designer of the navigation system for the Boeing 7something7 (I forget which one) and, in response to a question about what software tools he used, he replied vim and gcc because he didn't trust anything he could not see and lives depended on him.

      It didn't sound feasible to me because of the size of the codebase, but he was not a marketing turd so it's likely he was telling the truth. He had actually done the design, and was going around to large universities telling about the problems of codesigning software and hardware. (In a followup question he said he was hopeful about more elaborate tools. Didn't mention SAS.)

    73. Re:Show me some example code by nvatvani · · Score: 1

      Hmmm .... could you supply some examples?

    74. Re:Show me some example code by p5 · · Score: 0

      [quote] like the control system for the laser that cuts your cornea at the neighborhood lasik shop. [/quote]

      doubt it... most likely ADA is used for the backend programming.

    75. Re:Show me some example code by Anonymous Coward · · Score: 1, Insightful

      R is based on S, which was developed at Bell Labs in 1975, C was developed at Bell Labs in 1972. Perhaps you've overstated the "staggering part". A three year head start doesn't seem like that much to me.

    76. Re:Show me some example code by Anonymous Coward · · Score: 0

      Ditto...

      the whole jet thing is completely stupid. There is a lot of linux/gcc used in the jet aircraft industry.

    77. Re:Show me some example code by Goghit · · Score: 1

      Odd. You'd think she'd use the large HMOs that use SAS as their operating system as an example. "Every time I take an SSRI or get a colonoscopy I'm glad..." This is making me feel better about dumping SAS in favour of R after 20 years. SAS is an excellent product rendered useless by their marketing and sales department. (Unless you can sling around the type of money an HMO has.) It was a lot of fun dealing with closed proprietary data file formats when one of our major SAS using units decided to move to other software. Considering how much of our data is in MS Access now I'm beginning to think though that the problem might be learning disabilities rather than closed source.

    78. Re:Show me some example code by Anonymous Coward · · Score: 0

      #quick example

      # function, which, given numerical arguments a and b, and a function g, returns a function of x
      f &lt function(a,b, g){

          function(x){ a * x + g(b * x)}
      }

      f1 &lt f(1,2.5,sin)
      x &lt seq(-pi,pi,l=100)
      plot(x,f1(x),type='l')

      The MATLAB equivalent would be:
      f = @(a,b,g) @ (x) a*x+g(b*x);
      f1 = f(1,2.5,@sin);
      ezplot(f1) [or x = linspace(-pi,pi,100);plot(x,f1(x)]

    79. Re:Show me some example code by Darby · · Score: 1

      We use R for thousands of massively parallel computations on TeraGrid, using its database interface to querty remoted DBs.

      Ummm, it's spelled "qwerty", although how you could make that mistake is beyond me ;-)

    80. Re:Show me some example code by stephentyrone · · Score: 1

      as always, one should use the level of abstraction that one feels comfortable with to deal with the specific "algorithmic needs", no?

      Of course. But one shouldn't pretend that this makes the language one has chosen somehow better suited to the task than the language another person would choose, even if their solution looks unintelligible to you. It just means that you don't understand the way the other person did it.

    81. Re:Show me some example code by anethema · · Score: 1

      Oh GREAT
      http://www.youtube.com/watch?v=XL01H65Gf54

      ps: Just a snarky reply, I do believe that almost all lasik is safe and well-done. I would still personally opt for PRK. I'd rather not have a never-healing flap on my eye, gives me the willies.

      --


      It's easier to fight for one's principles than to live up to them.
    82. Re:Show me some example code by virtualXTC · · Score: 1

      SPSS is a bad example as there's a decent GNU alternate called PSPP that people could use to verify code. On the other hand is Matlab; it's GNU counterpart is Octave. Octave pretty much blows and doesn't even use the same function names as Matlab.

    83. Re:Show me some example code by Peaquod · · Score: 1

      Age != maturity

    84. Re:Show me some example code by ZmeiGorynych · · Score: 1

      Why? It works just fine for me. You have structs (that also behave like a hash if you want them to), struct arrays, and arrays of arbitrary data types (cell arrays), etc. And the beautiful, simple closures with function handles.

      When I last tried to learn R, now _that_ was an exercise in pain - there is a proliferation of types (is this a vector? or a list? or what?) and none of the facilities of grown-up languages (like implicit conversion) of dealing with them. Horrible, painful language, R is, and terribly documented too (compared to matlab that is). I spent a couple of weeks trying to use it to do stuff a couple years ago, and then just gave up and used matlab instead.

    85. Re:Show me some example code by ZmeiGorynych · · Score: 1

      What do you mean, 'compared to matlab'? Function handles are first-class objects in matlab, can be returned by functions, assigned to vars etc.
      eg

      a=@(x) x.*x;

      assigns to a a function that squares each element of the in-arg.

    86. Re:Show me some example code by poopdeville · · Score: 1

      How many aircraft is that? Seriously, I don't know. But I do know that the average age of airplanes in service is about 20 years. Not longer than gcc has been around, but long enough that they would be using a proprietary compiler. (Especially since gcc seriously sucked then)

      --
      After all, I am strangely colored.
    87. Re:Show me some example code by lt.+slock · · Score: 1

      Well, I haven't used MATLAB itself for a while - I do use Octave a bit though. So, try this

      a = sin

      In Octave I get

      error: sin: too few arguments

      instead i need to do

      a = @sin

      whereas the equivalent,

      a <- sin

      works in R. In other works, functions look just like other kinds of data in R, but a bit different in MATLAB (not much admittedly)

      Another difference, I think, is the way that scope works. Example: a function which, given n, returns a function which increments n (Paul Graham's incrementor exercise)

      f <- function(n){
          function() {
              n <<- n + 1
              n
          }
      }

      g <- f(2)
      h <- f(-3)

      g()
      #returns 3
      h()
      #returns -2
      g()
      #returns 4
      h()
      #returns -1

      Can you write this function, easily, in MATLAB?

    88. Re:Show me some example code by tehcyder · · Score: 1

      "Freeware" (at least in the business/Windows world) just means software you don't have to pay for, so if you can get a legitimate copy of a C compiler for $0, it *is* freeware.
      Firms like SAS (and Microsoft to an extent) use "freeware" as an insult, as in their eyes if you can't charge for something it must be third rate.

      --
      To have a right to do a thing is not at all the same as to be right in doing it
    89. Re:Show me some example code by SigmoidCurve · · Score: 1

      i'm a PhD student in biostatistics at a fairly prestigious american university. we use R almost exclusively, because it is better than other statistical software options. reasons for it's superiority are i) it's free ii) it's open source and iii) its considerably more powerful than STATA, SPSS, SAS, etc.

      It's too bad your prestigious education hasn't taught you to avoid sweeping generalizations. To say that one package is "better" or "considerably more powerful" in all cases, is not a good argument.

      Why would anyone use Oracle when MySQL is free, open source, and of course "better"?

      R is an excellent platform for data analysis and modeling, with a great deal of traction in the academic community which means that cutting-edge statistical techniques are ported and/or implemented in R very quickly.

      But, R is not a magic bullet. It is very inefficient to run complex data management routines in R, it is simply not optimized as well as some of those (gasp!) commercial packages. In addition, R loads its entire dataset into memory, providing a strict limit on how much data you can work with.

      Good luck with school, and try to learn something. You might try opening your mind.

      --
      Dictionaries are for loosers.
    90. Re:Show me some example code by GlobalEcho · · Score: 1

      postgresql interface
      gmm/mcmc
      rpy
      rodbc

    91. Re:Show me some example code by epacsmis · · Score: 1

      On quality: Manufacturers whose products include embedded systems will implement their algorithms in C but many (most?) will not use free implementations of C (compilers) for their deployed products. For safety critical applications with which I am familiar (automotive, aerospace and defense) manufacturers insist on compilers provided by commercial vendors. These vendors include Green Hills and Metaware as well as processor-specific vendors like Intel. Among these vendors, quality (in all its forms: reliability, performance, etc.) is paramount.

    92. Re:Show me some example code by ZmeiGorynych · · Score: 1

      Not really sure what you mean (can't read R syntax all that well). There seems to be some kind of state persistence going on in your example, which I don't understand.

      Generic functions returning functions would be

      function out=f(n)
      out = @(x) whatever_expression(x, n);
      end

      but I have a feeling you mean something else?

    93. Re:Show me some example code by ZmeiGorynych · · Score: 1

      Or even
      a = @(x) whatever_expression(n,x);

    94. Re:Show me some example code by Anonymous Coward · · Score: 0

      I think the state persistence is the interesting part. R functions hold a pointer to the environment in which they were defined (top level, a function body, a function body with its own parent function, and so on). So, for example, two functions can share some data which is otherwise private (much like members of an OOP class). The example below does just that.

      f <- function(n){

        a <- 2
        list (plus = function(m){
              n <<- n + a * m
                      n
          }, minus = function(m){
                      n <<- n - a * m
                      n
          })

      }

      p <- f(1)

      p

      #returns
      #$plus
      #function(m){
      # n <<- n + a * m
      # n
      # }
      #<environment: 0x310ca90>
      #
      #$minus
      #function(m){
      # n <<- n - a * m
      # n
      # }
      #<environment: 0x310ca90>

      p$plus(2)
      #returns 5
      #p#$minus(1)
      #returns 3
      #p$plus(3)
      #returns 9

    95. Re:Show me some example code by lt.+slock · · Score: 1

      Reply as AC below... error between chair and monitor

    96. Re:Show me some example code by stonecypher · · Score: 1

      That's interesting, considering that the reference MISRA implementation is built on GCC, that MISRA C is used by essentially every car manufacturer, that both GHOC and Metaware's compilers include STLPort which is free software, and that the embedded jobs I've had have been evenly split between GCC, which is free, Codewarrior, which isn't, and the ARM closed source toolchains (sdt -> ads -> rvct). Also, Z is open source these days, and is used for proving medical hardware, which is life or death in many cases (x-ray machine malfunctions have a documented history of baking people to death in seconds, microwave-style.)

      So I mean, sure, there are some embedded firms that don't touch open source, but both of the examples you gave do, and so do car manufacturers when coding anti-lock brakes, and so did Nintendo when making 85 million gameboy advances (the GBA toolchain, unlike the DS toolchain, was GCC). So I mean, there's a good, broad example of an entire industry with lots of life and death going on, and one of the highest production consumer embedded manufacturers on earth (I wouldn't be surprised to learn they were the highest, though I don't know for sure), relying on the tools you suggest most won't use.

      I think you're safer with many. ;)

      --
      StoneCypher is Full of BS
  8. Re:First Post! by Deltaspectre · · Score: 1

    Now you'll have to do it again

    --
    My UID is prime... is yours?
  9. Re: hence: when he restored unto Moses fled from m by RuBLed · · Score: 3, Funny

    All that scrambled verses and you forgot the part where the Nazi torpedoed Noah's Ark so it ran aground at the mountains of Ararat.

  10. ARRRRRR by mattwarden · · Score: 1

    Oh god... cue pirate jokes.

    1. Re:ARRRRRR by gishzida · · Score: 1

      Not necessarily.

      They created R because they did not want to kiss proprietary S.

    2. Re:ARRRRRR by Anonymous Coward · · Score: 0

      Ah, the GNU definition of created - "Wait for someone else to invest in the research necessary to make something, then copy it, give it away for free, and devalue the whole process."

      Create indeed.

    3. Re:ARRRRRR by retchdog · · Score: 1

      Yeah, you're a troll but whatever.

      The S language is a free spec developed at Bell Labs. According to my professor, the statistics community was generally shocked and appalled to find that they had entered an exclusive licensing deal with Insightful Corp., who make the commercial implementation S-Plus. Before this, S was mostly open-source although the term didn't exist at the time.

      So in a way, R is just putting things back to the way they were originally, about 30 years ago.

      --
      "They were pure niggers." – Noam Chomsky
  11. Free as in beer by visible.frylock · · Score: 3, Insightful

    "R is a real demonstration of the power of collaboration, and I don't think you could construct something like this any other way," Mr. Ihaka said. "We could have chosen to be commercial, and we would have sold five copies of the software."

    Very true. This is what I try to explain to people when they can't understand why some software is given away gratis. Because if they charged for it, given the current attitudes of the market, they wouldn't stand a chance and wouldn't ever get any market share to begin with.

    --
    Billy Brown rides on. Yolanda Green bypasses Gary White.
    1. Re:Free as in beer by rev063 · · Score: 1

      R isn't just free as in beer, it's also free as in freedom: it's under GPL2. It's the freedom given to all those statistical and programming experts to tinker with R that's made it what it is today. (The use of the word "freeware" by the SAS person seemed like a deliberate slight on FOSS to me.)

      There are non-free-as-in-beer (but still free-as-in-freedom) versions of R too: I work for a company that provides support for R (under the name REvolution R) with a model similar to Red Hat Linux. The market share for R is now more than large enough for it to be viable for commercial organizations to support it.

  12. SAS strikes out ^H^H^H er, "back" by enilnomi · · Score: 5, Informative
    FTFA:

    She [Anne H. Milley, director of technology product marketing at SAS] adds, "We have customers who build engines for aircraft. I am happy they are not using freeware when I get on a jet."

    Good thing Boeing's not using fere software for aircraft simulation tools, space station labs, sub hunters, or moon rockets ;-)

    --
    education is no substitute for intelligence
    1. Re:SAS strikes out ^H^H^H er, "back" by jd · · Score: 5, Informative

      Good thing NASA likewise never uses Open Source to design engines and aircraft alongside companies like Boeing. (*This product may contain nuts^H^H^H^Hsarcasm.)

      --
      It's a small world and it smells funny; I'd buy another if it wasn't for the money; Take back what I paid (SoM)
    2. Re:SAS strikes out ^H^H^H er, "back" by EGenius007 · · Score: 1

      FTFA:

      She [Anne H. Milley, director of technology product marketing at SAS] adds, "We have customers who build engines for aircraft. I am happy they are not using freeware when I get on a jet."

      Good thing Boeing's not using fere software for aircraft simulation tools, space station labs, sub hunters, or moon rockets ;-)

      New word announcement: "fere" - used to denote the application of open source (free) software in critical roles, striking fear in the uninformed masses.

      Examples:
      "The new software we're using to control our killbots is the latest fereware clone of the commercial Killdows Humans release."
      "NASA is requesting support from the fere community for software that can accurately convert between metric and SAE units."

      --
      I know what you did last summer. Just kidding, I don't work at the NSA.
  13. Freak your colleagues out with "no loop" code... by refactored · · Score: 4, Interesting
    I remember once years ago freaking my colleagues out with a largish app written in R... with nary a loop anywhere.

    Actually that wasn't why I used R, just a fun addendum. The reason to use R is the huge body of statistics, data mining and graphics facilities. Superb.

    Of course, the problem with any statistical library is you have to turn your brain on first. Nothing produces "Garbage in Garbage out" quite like statistical analysis.

    With R you tend to need to spend far more time thinking about why you are doing something, and what the answer means than in say vanilla C/Ruby programming.

    Which is actually not a Bad Thing at all.

    The worse thing about R programming is its name. Googling for "R" turns up way to much noise and way too little signal.

  14. r-project.org by Kludge · · Score: 3, Informative

    The language is very well documented online and the mailing lists contain thousands of examples. It is primarily for statistical analysis, and the libraries available for doing such analysis are unparalleled.

    1. Re:r-project.org by DahGhostfacedFiddlah · · Score: 5, Funny

      the libraries available for doing such analysis are unparalleled.

      With multi-core processors becoming more and more prevalent, R's developers should remedy this as soon as possible.

    2. Re:r-project.org by babble123 · · Score: 2, Informative

      With multi-core processors becoming more and more prevalent, R's developers should remedy this as soon as possible.

      Ask and ye shall receive

    3. Re:r-project.org by gringer · · Score: 4, Informative

      With multi-core processors becoming more and more prevalent, R's developers should remedy this as soon as possible.

      Already done. There's an R package called SNOW that allows you to handle code running in parallel.

      --
      Ask me about repetitive DNA
    4. Re:r-project.org by KungFuSoi · · Score: 2, Informative
    5. Re:r-project.org by Bob+Wehadababyitsabo · · Score: 1

      This is hilarious.

      --
      fsck -u
    6. Re:r-project.org by Anonymous Coward · · Score: 0

      overt pun... PUNted :-\

      k, i'm fired.

    7. Re:r-project.org by Anonymous Coward · · Score: 0

      WOOSH!

    8. Re:r-project.org by Anonymous Coward · · Score: 0

      whoooooosh...

    9. Re:r-project.org by Oori · · Score: 1

      And a mailing list + archives r-sig-hpc@r-project.org

    10. Re:r-project.org by Anonymous Coward · · Score: 0

      One can simply compile a multicore BLAS, such as the worlds fastest which currently is Goto BLAS, then drop that in as a replacemnt for Rs built in BLAS (locate Rblas). No major fussing and you are done in ten minutes. This is mentioned in the install guide and help lists found through rseek.org.

      Another nice option is the 'Matrix' package which uses some FOSS specialized BLAS packages optimized for very, very large matrices (millions by millions) when there are many zeros. This can be orders of magnitude faster than normal operations and can use less memory.

    11. Re:r-project.org by __aagbwg300 · · Score: 1

      WHOOSH!

    12. Re:r-project.org by Anonymous Coward · · Score: 0

      oh i see what you did there. clever!

    13. Re:r-project.org by Anonymous Coward · · Score: 0

      There is also r-mpi

  15. Sure about that? by Bill,+Shooter+of+Bul · · Score: 4, Funny
    I'd have guessed perl. Think about it
    1. Sounds like treasure ( pearls)
    2. Reinforces their need to hide their booty by making indecipherable maps to the treasure buried within
    3. Incomprehensible mangling of commong symbols, like their english dialect.
    4. It often requires the programmer to consume large amounts of rum as a coping mechanisim
    5. New virtual machine Parrot named after favorite pet
    6. Can use actual pirate language to program Acme::Lingua::Pirate::Perl
    --
    Well.. maybe. Or Maybe not. But Definitely not sort of.
    1. Re:Sure about that? by i_ate_god · · Score: 3, Funny

      not to mention that, because of reason 3, it is the most drunk-friendly programming language there is.

      --
      I'm god, but it's a bit of a drag really...
    2. Re:Sure about that? by ppanon · · Score: 4, Funny

      Didn't they make a pirate movie call "The curse of the Black Perl"? Presumably it's about particularly obfuscated legacy code.

      --
      Laissez lire, et laissez danser; ces deux amusements ne feront jamais de mal au monde. - Voltaire
    3. Re:Sure about that? by Anonymous Coward · · Score: 0

      But I thought pirates sailed the three Cs?

    4. Re:Sure about that? by WWWWolf · · Score: 2, Funny

      Didn't they make a pirate movie call "The curse of the Black Perl"? Presumably it's about particularly obfuscated legacy code.

      No, it's more darker and sinister than that...

    5. Re:Sure about that? by binaryseraph · · Score: 0

      I would have thought C. I mean, without the C you are no pirate at all...

    6. Re:Sure about that? by Anonymous Coward · · Score: 0

      TMTOWDI, arrr.

    7. Re:Sure about that? by Anonymous Coward · · Score: 0

      cough..APL..cough

    8. Re:Sure about that? by Anonymous Coward · · Score: 0

      Whitespace is the only language where you have to walk the blank.

      I'm too embarrassed to use my real username...

  16. Not a language, really by daknapp · · Score: 0, Flamebait

    Calling R a programming language is like calling Mathematica or Matlab a language. R is a system for statistical tasks that has a language and snytax, and but it is not capable of producing stand-alone executables that do not require the entire R environment.

    1. Re:Not a language, really by Anonymous Coward · · Score: 1, Insightful

      Calling R a programming language is like calling Mathematica or Matlab a language. R is a system for statistical tasks that has a language and snytax, and but it is not capable of producing stand-alone executables that do not require the entire R environment.

      So, you're saying java, js, python, perl, and ruby aren't programming languages?

    2. Re:Not a language, really by Anonymous Coward · · Score: 0

      That definition makes every scripting language not a language.

      However, I can see what you are trying to say.

    3. Re:Not a language, really by VicarofCletus · · Score: 1

      It's amazing how often I hear people refer to Matlab as a language (mostly engineering professors).

    4. Re:Not a language, really by Hobbes_2100 · · Score: 5, Insightful

      Are you kidding me? Are you really *(*$@#ing, Grade A kidding me?

      Python/Perl/Ruby require interpreters. Scheme and Lisp are frequently run within interpreters. "stand-alone executable" require HARDWARE. Any programming system requires *something* underneath it unless you are programming in a purely physical system like an automated abacus with mechanical gears that buzz and whirr.

      Programming languages are defined by their Turing completeness: can they do things repeatedly, can they assign values to memory locations and perform some basic set of operations (nand works nicely), can they make decisions. Everything else is fluff.

      Perl has "fluff" that handles regular expressions very well.

      Python (and others) have "fluff" that make networking and database ops easy.

      R has "fluff" that makes it terribly convenient to work with data.

      Matlab has "fluff" that makes it very easy to do numerical methods programming.

      Mathematica has "fluff" that makes it very easy to do symbolic computation.

      Each and every one of these, and most well-known languages, with all their warts and beauty marks are Turing complete and are deserving of the term "programming language".

      Regards,
      Mark

    5. Re:Not a language, really by Otter · · Score: 1

      It's also (hence the name) an open-source implementation of the much older S platform. The article distorts its history to the point of dishonesty.

    6. Re:Not a language, really by slashdotmsiriv · · Score: 3, Insightful

      Your comment is absolutely wrong.
      http://en.wikipedia.org/wiki/Programming_language

      R is a Turing complete programming language. The fact that it requires an interpreter is completely irrelevant.

    7. Re:Not a language, really by Improv · · Score: 1

      What's libc again? Oh, that's right, it's something C programs generally need to run. So you're only programming in C if you don't use libc or statically linking? How awesome it is to have an "I am actually programming" flag in your compiler and linker!

      --
      For every problem, there is at least one solution that is simple, neat, and wrong.
    8. Re:Not a language, really by Palinchron · · Score: 1

      Note that the truth of your statement does not change when you replace "R" by "python" (and remove the word "statistical"). Nevertheless, I would still call python a programming language.

      --
      The lesson here is that a sufficiently large corporation is indistinguishable from government. --ultranova
    9. Re:Not a language, really by tcsh(1) · · Score: 3, Informative

      Actually, R is a real (Turing-complete) programming language like Perl, Python, Ruby, etc. It just happens to have lots of statistical libraries and matrix-oriented functions.
      You put #!/usr/bin/Rscript in your first line and it can work just like any other scripting language, with command-line arguments, etc. I use it all the time as a replacement for other scripting languages (think PDL+Perl or Numpy+Python).

      R is an excellent language for any scientist. The sytax and semantics of the language are very well thought-out.

    10. Re:Not a language, really by TapeCutter · · Score: 3, Insightful

      'R' is not a general programing language but that hardly means it's not a language. Producing a stand alone executable is not a feature of any language, it's a feature of the tool set.

      --
      And did you exchange a walk on part in the war for a lead role in a cage? - Pink Floyd.
    11. Re:Not a language, really by SanityInAnarchy · · Score: 2, Insightful

      I would argue that GP is confusing "programming language" with "general-purpose programming language".

      I bet even SQL is Turing-complete, but I wouldn't want to do more than database operations with it.

      --
      Don't thank God, thank a doctor!
    12. Re:Not a language, really by betterunixthanunix · · Score: 1

      You could compile an R program if you wanted to, and if you were willing to write a compiler. Same with Matlab. Your argument is like saying that AWK is not a programming language, because it is interpreted.

      --
      Palm trees and 8
    13. Re:Not a language, really by betterunixthanunix · · Score: 1

      Matlab is a programming language. Let me guess, you also think that Rexx and AWK are not programming languages, because they have weird syntax and are specialized for certain tasks?

      --
      Palm trees and 8
    14. Re:Not a language, really by sjames · · Score: 1

      Even ASM requires a minimal environment, it just happens that it's environment is provided directly by the hardware.

    15. Re:Not a language, really by XDirtypunkX · · Score: 1

      Most languages have "fluff" that makes it terribly convenient to work with "data". Perl's fluff helps it deal with string data, for example. You really have to be a bit more specific.

    16. Re:Not a language, really by Anonymous Coward · · Score: 0

      They are scripting languages.

    17. Re:Not a language, really by Anonymous Coward · · Score: 0

      Calling R a programming language is like calling Mathematica or Matlab a language.

      You were doing well up until here.

      All three of those are languages. See, no problem!

    18. Re:Not a language, really by pnewhook · · Score: 2, Informative

      Matlab supports production of a stand alone executable from Matlab that does not require the Matlab environment.

      --
      Tesla was a genius. Edison however was a overrated hack who liked to torture puppies.
    19. Re:Not a language, really by BobisOnlyBob · · Score: 1

      R's fluff helps in manipulating data in statistical contexts, while actually providing support for non-vector/matrix data, unlike the abomination that is Matlab. Seriously, just try manipulating non-matrix data in Matlab. You'd be sooner pulling your teeth out, or more likely, using R.

    20. Re:Not a language, really by RegularFry · · Score: 1

      Or, indeed, Java. Language != implementation.

      --
      Reality is the ultimate Rorschach.
    21. Re:Not a language, really by galoise · · Score: 1

      ?

      'tis turing complete...

      ever heard of "interpreted" languages?

      --
      entia non sunt multiplicanda praeter necessitatem
    22. Re:Not a language, really by aero6dof · · Score: 1

      Matlab supports production of a stand alone executable from Matlab that does not require the Matlab environment.

      It does until you call a function that doesn't support stand alone executables from one of the many available toolboxes.

      Matlab and it's toolboxes are a great tools for analysis, but for direct production deployments of exe's there are a great many inconvenient detours involved. (Matlab has been steadily improving this though...)

    23. Re:Not a language, really by Darkseer · · Score: 1

      The funny part is, that as written there is nothing wrong with the statement:

      "Calling R a programming language is like calling Mathematica or Matlab a language. ..."

      Since by strict definition they are Turing Complete. So yes R is equivalent to Mathlab and Mathmatica, they are programming languages. I'm inferring by inflection that this isn't what the author intends say.

      If I understand the intent of the original comment, the statement aptly show the difference between those use use programming languages and people who know what they are and how they work. Hobbes' and slashdotmsiriv's comments have the flavor of people who have written or know much about a programming languages internals. daknapp appears to be saying "This doesn't look like anything I've used, must not be a programming language".

      "Better to remain silent and be thought a fool than to speak out and remove all doubt." -- Abraham Lincoln

      --

      BOFH, My model for being a sysadmin :)

    24. Re:Not a language, really by sisina · · Score: 1

      ANSI SQL is not Turing-complete. If you add stored procedures you can get a Turing-complete language, but blech.

    25. Re:Not a language, really by SanityInAnarchy · · Score: 1

      Exactly.

      Maybe a better example is Postfix. Turing-complete, but do you really want to write more than pretty fractal patterns in it?

      --
      Don't thank God, thank a doctor!
    26. Re:Not a language, really by jadavis · · Score: 1

      ANSI SQL is not Turing-complete.

      It is if WITH RECURSIVE is implemented.

      --
      Social scientists are inspired by theories; scientists are humbled by facts.
    27. Re:Not a language, really by pnewhook · · Score: 1

      Matlab and it's toolboxes are a great tools for analysis, but for direct production deployments of exe's there are a great many inconvenient detours involved.

      I disagree. A lot of code running on-orbit is autocoded from Matlab/Simulink. This code is far easier to maintain (as long as you keep the software developers from modifying it) and more reliable than hand written code. Analysis and development is also far easier in the Matlab environment as well.

      --
      Tesla was a genius. Edison however was a overrated hack who liked to torture puppies.
    28. Re:Not a language, really by BillWhite · · Score: 1

      I hate to pile on, but this comment is in error.

      In one of Dana Scott's papers from the 1980s, he presents a programming language which is equipolent with Turing Machines but which consists entirely of the letter G. It's syntax was just the ability to apply expressions to other expressions, and it's operational semantics was some rewriting rules. It was very cute.

    29. Re:Not a language, really by BillWhite · · Score: 1

      Sorry, I'm a jerk. I replied to the wrong comment.

  17. FUD from SAS by idiot900 · · Score: 3, Insightful

    "I think it addresses a niche market for high-end data analysts that want free, readily available code," said Anne H. Milley, director of technology product marketing at SAS. She adds, "We have customers who build engines for aircraft. I am happy they are not using freeware when I get on a jet."

    Wow...talk about FUD. Does SAS imdemnify against plane crashes?

    1. Re:FUD from SAS by gishzida · · Score: 1

      You can bet someonelse's S they don't...

    2. Re:FUD from SAS by betterunixthanunix · · Score: 1

      Check the license agreement, if you can find it. I could not find it, but other licenses from SAS indicate that they provide no guarantees of the software's fitness for any purpose. You can be that a simulation error in SAS would not matter one bit if it caused an airplane crash, the company would be in the clear.

      I love how she uses the term, "freeware," rather than "open source" or "free software."

      --
      Palm trees and 8
    3. Re:FUD from SAS by belmolis · · Score: 2, Interesting

      I guess nobody told her about how proprietary Excel is inferior to libre Gnumeric in having quite a few errors in its statistical functions and how when apprised of errors the Gnumeric folks fixed them quickly while the Excel folks either never fixed them, did it slowly, or introduced new errors? See the report by Drexel University statistician B. D. McCullough.

    4. Re:FUD from SAS by Anonymous Coward · · Score: 0

      The thing is, people in those industries do use R...just because they have a license for SAS doesn't mean that is all that they use. Mrs. Milley is a bit naive and/or trying to oversell the importance of SAS (I suppose that is her job though). People coming out of quantitative programs are using R with increased frequency....SAS is almost irrelevant in some areas because of R.

  18. R sucks as a language by idiot900 · · Score: 2, Interesting

    Actually it may not suck. But having used it on and off over the past few years while not being a statistics pro, I find the R language bletcherous and annoying. - as an assignment operator?

    1. Re:R sucks as a language by idiot900 · · Score: 1

      Well, crap, hit Submit instead of Preview. Meant to say, <- as an assignment operator (I know = works now, but still...)? Bizarre data frame and object semantics? R is quite useful but I really dislike writing anything nontrivial in it.

    2. Re:R sucks as a language by Anonymous Coward · · Score: 0

      since you use R "on and off" over several years, i'm not really surprised that you find it annoying. it's not particularly easy to learn (and lacks really good resources for diving into), and takes months or years of dedicated work to gain anything like proficiency. also, it really get anything out of R (at least enough to make it worth the effort of learning) one would have to be using it on relatively advanced statistical projects. otherwise, one would be better off using something more off the shelf.

      however, for statistical pros R is IMO the best tool out there, and can be used in very nontrivial settings.

    3. Re:R sucks as a language by tmoertel · · Score: 2, Informative

      The R language is optimized for writing statistical code. It's going to seem a little weird, especially if you have a traditional programming background. Once you spend some serious time writing R code, however, you will probably begin to appreciate many of the things that initially seemed odd.

      For example, consider the way R handles function calls:

      • It allows you to pass function arguments by name and abbreviate the names, which is handy during live sessions when you want to call statistical routines that have lots of arguments (which is common).
      • During a function call, arguments are bound lazily, which lets you pick apart the expressions behind them and write functions that serve as control-flow constructs. This lets you do things such as pass model expressions as arguments.
      • Also, function arguments can have default values, which are again evaluated lazily but can also see values within the scope of the function body. This lets you use computed values as defaults and have those values depend on other arguments, which in most programming languages requires extra work on your part.

      All of these "oddities" serve to reduce the amount of boilerplate code you need to write when coding up statistics routines. (Click the link above if you want to see examples and take a more in-depth tour of R's fascinating and time-saving function call behavior.)

    4. Re:R sucks as a language by eh2o · · Score: 1

      Mathematica also supports this notion of unevaluated inputs. For example, Plot[] does this and then internally compiles an optimized version of the input expression for faster repeated evaluation that leverages the requested precision goal (usually machine precision which is fastest).

      Usually Evaluate[]/Unevaluated[] works nicely and is transparent to the end user but when it it doesn't work right for a particular use, it leads to some highly confusing code.

    5. Re:R sucks as a language by galoise · · Score: 1

      you can use several assignment operators, including =

      but i reckon that <- is quite un-intuitive

      --
      entia non sunt multiplicanda praeter necessitatem
    6. Re:R sucks as a language by Anonymous Coward · · Score: 0

      "-" isn't an assignment operator in R.

      "-" is, so is "="

      Discussion of whether using "-" or "=" makes a difference:
      http://blog.revolution-computing.com/2008/12/use-equals-or-arrow-for-assignment.html

    7. Re:R sucks as a language by Anonymous Coward · · Score: 0

      Ah, I see what happened: slashdot removed the less-than symbol leading the "-" and both of us failed to check the preview :Op

  19. Embedded FUD by bstadil · · Score: 1
    I have high regards for Ashlee Vance and miss his Podcasts he did while he was at The Register. It puzzles me he included this old FUD chestnut. Seems like a throw back from the 90's.

    Anne H. Milley, director of technology product marketing at SAS ... adds, "We have customers who build engines for aircraft. I am happy they are not using freeware when I get on a jet."

    --
    Help fight continental drift.
  20. Re:What's a pirate's favorite programming language by fred+fleenblat · · Score: 4, Funny
  21. Re:Freak your colleagues out with "no loop" code.. by Anonymous Coward · · Score: 5, Informative

    "The worse thing about R programming is its name. Googling for "R" turns up way to much noise and way too little signal"

    Try searching from http://rseek.org/ instead of directly from Google.

  22. Re:Freak your colleagues out with "no loop" code.. by Anonymous Coward · · Score: 0

    The statistical libraries are what I use it for, but what pisses me off is the lack of more general data structures, like dictionaries, or vectors of nontrivial types*. It's not nearly as self contained and consistent as, say, Python.

    If Python's scientific libraries get better, I'll probably switch to that.

    *e.g. if you want a list of functions, it has to be a linked list, which then has O(n) access time.

  23. High Level Lingua Franca by Baldrson · · Score: 1
    From TFA:

    It is becoming their lingua franca partly because data mining has entered a golden age, whether being used to set ad prices, find new drugs more quickly or fine-tune financial models.

    The "smart set" needs a such a high level lingua franca to express infinite precision financial models of no accuracy whatsoever!

  24. Re:Freak your colleagues out with "no loop" code.. by fm6 · · Score: 4, Interesting

    I remember once years ago freaking my colleagues out with a largish app written in R... with nary a loop anywhere.

    That's a feature of functional languages, a class that also includes Scheme and XSLT. The basic idea is that programs should not have state, because state makes them harder to debug. A for or while loop, by definition, has state, so you have to do your iteration some other way, namely Tail Recursion.

    I suppose that makes sense, but I've never been able to teach myself to think that way. It's the main reason I never managed to get through The Wizard Book.

  25. Wow! The Google Star of R has risen... by refactored · · Score: 1
    Since I last Google for R the page rankings of all things R language related have risen gloriously! Wow!

    I retract my sole criticism of R.

  26. Actually I Prefer Q by Anonymous Coward · · Score: 0

    Q is awesome.

  27. Re:Freak your colleagues out with "no loop" code.. by dookiesan · · Score: 2, Informative
    The following R code might be implemented with a linked list internally, but I assume they could change this behavior without breaking many programs :

    x = vector(mode="list")
    x[["joe"]] = y
    x[["bob"]] = z #z can be a function!

    x = list(joe=y)
    x$bob = z

  28. Not a programming language! by MrCrassic · · Score: 1

    Or at least in the context it's made out to be in this article. Isn't it a language suited mostly to statistics? For that use, I hear that it's one of the best.

    1. Re:Not a programming language! by Daniel+Dvorkin · · Score: 1

      Well, it is a programming language; it's Turing-complete. And there are a fair number of packages on CRAN to make general-purpose programming tasks easier. But yes, mainly it's good for math, especially statistics.

      --
      The correlation between ignorance of statistics and using "correlation is not causation" as an argument is close to 1.
  29. Anonymous Coward by Anonymous Coward · · Score: 0

    How does R compare to Python + numpy + plotting libs

  30. The R language and its uses by golodh · · Score: 5, Informative
    I'll pitch in because R deserves better than the usual Slashdot cocktail of random ignorance and immature jokes.

    The R language (yes, it's a language; an interpreted languages is a language too) has developed as the language of choice by statisticians (both academics and sundry statistical researchers) around the world as their main computer language. It is used in those cases where researchers feel the need for customized computations rather than the use of a package like SAS or SPSS.

    The reason that R has become popular is due to a snowball effect and history. It started as a FOSS re-implementation-from-scratch of the "S" language designed for statistical work at Bell labs (see http://en.wikipedia.org/wiki/S_(programming_language). Some academics and researchers of repute used it (the S language) because at that time (1975) it was very innovative and far better than most alternatives, and others followed. The S language gained a measure of acceptance among statisticians. Then when R became available the cycle intensified because of the much improved availability of the interpretor and its libraries. This cycle continued to the point that by now probably most professional statisticians use it.

    As far as I can see, the R language isn't especially sophisticated or elegant, and may strike people used to more modern languages as a bit repugnant. It does however excel in three respects:

    (a) it allows for easy access of Fortran and C library routines

    (b) it allows you to pass large blobs of data by name

    (c) it makes it easy to pass data to and from your own compiled C and Fortran routines

    The first reason is particularly important because it allows one to use e.g. pre-compiled linear algebra package like LAPACK, or Fourier Transforms, or special function evaluations and thereby gain execution speeds comparable to C despite being an interpreted language (just like Matlab, Octave, Scilab, Gauss, Ox and suchlike): the hard work is carried out by a compiled library routine which is made easily accessible through the interpreted language. Any algorithm needed in statistics that's available as C or Fortran code can be linked in and called without too much effort.

    The second reason is important because it slows down execution much less than any pass-by-value interpreted language would, and it allows you to change data that is passed into a function.

    The third reason is particularly important because it helps researchers be more productive. Reading in your data, examining it, graphing it, tracing outliers and cleaning them up is best done in an interactive environment in an interpreted language. Coding such things in C or Fortran is an awful waste of time, and besides, researchers aren't code-monkeys and don't enjoy coding inane for-loops to read, clean, and display data. Vector and matrix primitives are far more powerful, and usually preferable unless they are so inefficient that you have to wait for the result. However, there are times when you just need to carry out standard algorithms (linear algebra, calculation of mathematical or statistical functions) or simply time-consuming repetitive algorithms that run so much faster in a genuine compiled language. You could start out by coding the algorithm in an interpreted language to check if it's working, and then isolate the computationally expensive part and code it up in C or Fortran. Using R (or Matlab or Scilab) you can *call* the compiled subroutine, pass it your (cleaned) data, and get the result back in an environment where you can easily analyze it.

    That's why languages like R, Matlab, Scilab, Octave, Gauss, and Ox are so productive: you get the best of both worlds. Both the convenience, interactiveness, and terseness of a high-level interpreted language and the speed of compiled languages.

    So why R, and why not Gauss or Matlab or whatever?

    Well, part of that is cultural. If you're an econometrician you'll have been weane

    1. Re:The R language and its uses by radtea · · Score: 4, Interesting

      (a) it allows for easy access of Fortran and C library routines

      (b) it allows you to pass large blobs of data by name

      (c) it makes it easy to pass data to and from your own compiled C and Fortran routines

      So, it's exactly like Python, except with an outdated 1970's syntax that was frankly pretty weird to start with :-)

      I've used R, and found it useful for some of its relatively esoteric capabilities, but currently use it almost exclusively via rpy now, the Python binding to R.

      Furthermore, I've been using it less in recent years as the native statistical capability of Python has continued to improve. I can appreciate that people who work strictly in data analysis could find R an appropriate tool, but as someone whose work spans multiple areas, from analysis to application design and development, R is too limiting a tool, and using it always feels a little alien and weird.

      --
      Blasphemy is a human right. Blasphemophobia kills.
    2. Re:The R language and its uses by verySmartApe · · Score: 5, Informative

      I second that. R is terribly useful for the wide variety of libraries available and esoteric statistical procedures. But you would *never* want to write a long/complex program in R.

      As you say, it's most convenient to work in some other language that's actually designed to be scaleable, object-oriented, and easy to debug. It's usually straightforward to call R libraries when you need them. I find that python+scipy+rpy is an almost ideal environment for day to day scientific programming.

    3. Re:The R language and its uses by emok · · Score: 2, Interesting

      You mentioned it towards the end of your post, but R's plotting functions should really be emphasized. Since I discovered them, I really can't stand to make plots using any other software.

    4. Re:The R language and its uses by Anonymous Coward · · Score: 0, Troll

      So, it's exactly like Python, except with an outdated 1970's syntax that was frankly pretty weird to start with

      You mean like whitespace-based indentation, a la Fortran? Oh wait, that'd be Python's outdated 1970's syntax that was frankly pretty weird to start with. Never mind.

    5. Re:The R language and its uses by KingOfBLASH · · Score: 1

      So you're using Python to call R which calls Fortran and/or C? Then you could put that into parrot? Whoa... Too much abstraction man...

    6. Re:The R language and its uses by Anonymous Coward · · Score: 0

      Allowing other researchers to reproduce scientific findings in R without forcing them to buy matlab or sas is a key benefit.

      The syntax is much closer to Python than many think, especially when an object oriented package such as 'proto' is used.

      And since it's based on S routines that began development in the 70s there is more mature and tested code.

      Plus, R allows you to use almost any BLAS library. Goto BLAS writes assembly code for each machine's processor that is faster than all but the most optimized C.

    7. Re:The R language and its uses by Anonymous Coward · · Score: 0

      Just like every baby is beautiful to his mother, programming languages that are very familiar to you don't seem weird. The syntax of ANY programming language can seem weird if you are not familiar with it. "Syntax weirdness" is an entirely subjective criticism and of little value.

    8. Re:The R language and its uses by Anonymous Coward · · Score: 0

      Oooooo, get her!

    9. Re:The R language and its uses by radtea · · Score: 1

      You mean like whitespace-based indentation a la Fortran?

      Unlike all those OTHER languages, whose indentation isn't based on whitespace?

      Even if your quip was coherent, it is a-historical. Any indentation other than the basic first six columns was forbidden prior to the whole "structured FORTRAN" thing in the late '70's, and that was just a convenience for humans trying to read the code. Scoping in FORTRAN has always been a matter of keywords, not whitespace, and in fact the language explicitly ignores even whitespace that one might wish it didn't.

      For example, the famous one-character bug that blew up an American Venus probe in the '70's was due in part to FORTRAN's removal of whitespace in numerical constants during compilation, so the loop header:

      DO I = 1. 10 WHILE

      became:

      DO I = 1.10 WHILE

      "I" is of course an integer, so this is equivalent to:

      DO I = 1 WHILE

      and rather than the list of ten items being fully initialized only the first one got handled. If the "." had been a "," like it was supposed to, everything would have been fine. (I haven't written FORTRAN for a decade or so, so my syntax in the above may not be quite correct, but you get the idea.)

      With regard to Python, getting over the "oh my god it's full of whitespace" thing was an issue for me in adopting the language. Having worked in SGML-based text processing in the '90's I knew only too well that that "whitespace is not actually evil--it is just misunderstood." But once you get over it, it becomes a matter of habit just like curly brackets did when I moved from FORTRAN to C in the late '80's.

      As another person replying to my original comment said, Python + scipy + rpy is an excellent environment for routine scientific programming, and if you add wxPython into the mix you've got a pretty good application development language too, that is deservedly getting a lot of uptake in the scientific community.

      --
      Blasphemy is a human right. Blasphemophobia kills.
    10. Re:The R language and its uses by smcdow · · Score: 1

      ... and besides, researchers aren't code-monkeys and don't enjoy coding inane for-loops to read, clean, and display data.

      Word.

      I've worked with some absolutely brilliant researchers who produce code that would make you want to shoot yourself. They don't give a shit about the CODE; they care only about the RESULTS. And, it's the RESULTS that get published, not the code.

      Nonetheless, it was never fun to try to maintain MATLAB code that used the following variable names in the same function:
      x
      xx
      xxx
      xxxx
      xxxxx

      --
      In the course of every project, it will become necessary to shoot the scientists and begin production.
    11. Re:The R language and its uses by maxume · · Score: 1

      What interpreted languages do you think are pass by value? Perl, Python, and Ruby are all pass by reference (or roughly equivalent to such). Javascript passes objects by reference and native types by value. Those are the big 4.

      --
      Nerd rage is the funniest rage.
    12. Re:The R language and its uses by thatmike · · Score: 1

      As one who works with both Python (programming cognitive science experiments) and R (analyzing said experiments), I have a different experience. Thus far I have failed to find a pure python graphics library that achieves the power, simplicity, and sheer well-designedness (new word!) of the R library "ggplot2" (http://had.co.nz/ggplot2/). Sure I could use rpy, but it seems simpler (for my purposes at least) to isolate the two programming languages.

    13. Re:The R language and its uses by Just+Some+Guy · · Score: 1

      I can appreciate that people who work strictly in data analysis could find R an appropriate tool, but as someone whose work spans multiple areas, from analysis to application design and development, R is too limiting a tool, and using it always feels a little alien and weird.

      I "discovered" R last night when I saw this article. After 20 minutes of fiddling around with it, I had it pulling data out of PostgreSQL and doing breakdowns of our customers' billing data. Four lines of R were displaying graphs and doing trend analysis.

      For me, the single coolest thing about the above is that when I showed it to my boss, he understood and appreciated it. He'd read the NYT article before I had and was interested in R, but I was able to give him a useful example that he could run with. The guy is a competent programmer but he's too busy running the company to have large amounts of time to devote to low-level programming, but is certainly able (and wanting!) to start mining our database with something like this. You and I might not be the target audience, but it seems to have a lot to offer for smart people who want to explore large datasets without getting into the gritty details behind each step.

      --
      Dewey, what part of this looks like authorities should be involved?
    14. Re:The R language and its uses by Anonymous Coward · · Score: 0

      Maybe I'm from a different generation of econometricians... Stata has a lock on that market afaict.

  31. Re:Freak your colleagues out with "no loop" code.. by Anonymous Coward · · Score: 1, Informative

    The worse thing about R programming is its name. Googling for "R" turns up way to much noise and way too little signal.

    use RSeek.org
    Problem solved.

  32. Re:Freak your colleagues out with "no loop" code.. by Daniel+Dvorkin · · Score: 1

    The worse thing about R programming is its name. Googling for "R" turns up way to much noise and way too little signal.

    Yep. There are a couple of dedicated R search engines that can help with that: http://www.dangoldstein.com/search_r.html and http://www.rseek.org/. It may also sometimes be useful to Google on "Splus (whatever)" since most R and S+ code is pretty much interchangeable.

    --
    The correlation between ignorance of statistics and using "correlation is not causation" as an argument is close to 1.
  33. Fine-tuning financial models by macraig · · Score: 1

    I think we all know how well that's turned out, eh? So it that the fault of the language or programmer error?

    1. Re:Fine-tuning financial models by bunratty · · Score: 1

      Probably neither. I think it's a case of garbage in, garbage out. Even if your program is provably 100% correct, it will still produce nonsense as output when you feed it nonsense for input.

      --
      What a fool believes, he sees, no wise man has the power to reason away.
  34. Drugs by xonar · · Score: 0, Offtopic

    ...find new drugs more quickly...

    Drugs? Sign me up!

  35. Re:Freak your colleagues out with "no loop" code.. by Jeff+DeMaagd · · Score: 1

    The worse thing about R programming is its name. Googling for "R" turns up way to much noise and way too little signal.

    I see your addendum that it works better now, but searching using just a single letter or word usually doesn't work well, you need to give it context. You can enter "tank" into Google and it's going to give you a lot of mixed results because the results could be for fuel, water, waste, military armor or some other use, so you need to give Google something to narrow down the results. So "R programming language" would probably be a base to start from.

  36. Missing from comments is bioinformatics by Anonymous Coward · · Score: 0

    What folks are not talking about is that it used extensively in bioinformatics, especially by the Bioconductor software project. This is highly useful for recently developed and increasingly used microarray and large scale DNA sequencing experiments in biology and disease oriented research. This field is helping to transform biomedical research and ultimately medicine.

  37. Re:Freak your colleagues out with "no loop" code.. by Anonymous Coward · · Score: 0

    A plea to future language developers perhaps

    Please dont name your languages with 1 character like C or R, give them longer names.

    something like staRtistics would probably work great in a search engine. And the intentional mispelling would give me some joy.

  38. Re:Freak your colleagues out with "no loop" code.. by Anonymous Coward · · Score: 1, Insightful

    That sounds extremely weird: if a program has a stack, then it has a state - the location on the stack is still state. Thus, if you use recursion, you still have state. I mean, you can try to hide the fact that you have state, but I don's see how you can have a program without state.

    Even the wizard book appears to have a chapter on state: http://mitpress.mit.edu/sicp/full-text/book/book-Z-H-19.html#%25_chap_3 , but, unlike your description, instead of talking about a program without state, it considers two kinds of state: the state of objects, or the state of streams of data.

    Do you happen to have a link to what you mean by "a program should not have state"? Because, I mean, that seems antithetic to the nature of a program.

  39. Re:Freak your colleagues out with "no loop" code.. by thebrett · · Score: 2, Informative

    Have you considered using sage (www.sagemath.org)? It is FOSS and has highly active community and developer support. I'd suggest reading the tour http://www.sagemath.org/tour.html and seeing what you think.

  40. Re:Freak your colleagues out with "no loop" code.. by Peaquod · · Score: 2, Interesting

    I remember once years ago freaking my colleagues out with a largish app written in R... with nary a loop anywhere.

    I'm sure you had plenty of loops in your code. They were just hidden via the use built in functions. Not that that's a bad thing.... just saying. You have to understand the mechanics of the calculations to use them properly, and over-reliance on built in functions can make it too easy to talk out of your ass.

  41. Don't be ridiculous by Anonymous Coward · · Score: 3, Funny

    You didn't have any friends in the 3rd grade.

  42. Sure it's powerful... by Anonymous Coward · · Score: 0

    ... and has objects, and is even oriented by them...

    Plus it has a huge following of lots of smart people writing libraries, functions, and tools for it... so it's simple to do something if someone else has done _exactly_ that thing.

    But, I find it incredibly painful to use for anything outside of what's already been done. I spend more time trying to work around silliness than I do actually solving my problem.

    Case #1 - I want to normalize gene expression data, using this cool, published algorithm. In basic terms, it does math on a table of numbers, and spits out another table of numbers. Simple? No, the only available package/example uses, start-to-finish, it's own functions, and assumes that my data comes from a specific vendor. My lab didn't use that vendor to collect our data? Out of luck... maybe try shoehorning the data we do have into some of the special objects (objects - not a matrix of numbers, it has to be an object of a specific type, with no way to make the object other than directly importing from vendor-specific files that we don't have because we used a different vendor), cross fingers, and hope it works...

    Case #2/3: I have more math I want to do, on other tables of numbers (unrelated). I play interactively with my code, and get my answer... but it only appears when I use the 'pretty print' function for formatting my output variable. This does make a nice-looking set of output, with various summary statistics as well as the 2 numbers that I actually care about, but I want to do this hundreds of times, using input from another set of completely different programs. Fool me, I try to access those numbers out of my 'result' object. No luck... it has subcomponents for all of the ancillary statistics, convergence results, starting parameters, etc. etc, but not the freaking answer I ran the function for in the first place! Fine... I'll run it in batch mode (The documentation for which points out that it captures all of the output in a file for you) and parse the output using either perl or a frankenpipe of grep, less, and sed. Lo and behold, when I run this from under a shell or perl script (hundreds of times, remember), it produces a zero-length output file, instead of my actual answer. I can run the exact command line for an arbitrary invocations in my shell and it works perfectly... making the parsable output file and everything.

    When I google this phenomenon, I find other people with the exact same problem asking for help in forums. The response is (and I quote): "Working as designed." This is the point where I throw my hands up in the air and (rhetorically) wonder who is going to introduce these people to the idea of UNIX... I said this was cases 2 and 3 because this has happened to me twice now... yesterday it was a nonlinear estimation problem (which I _still_ don't have working noninteractively), before it was a clustering thing that I finally gave up and used SAS for.

    I try to use open source solutions whenever possible - my graduate work in bioinformatics (computational methods development for figuring out the causes of human disease) is supported in part by public funding and as such I believe it should be as widely distributed/unencumbered as possible, but nonsense like the above makes me prefer SAS (which my university gets for free, probably partially because it was first developed here...). Even if it has many many (many) quirks, at the end of the day your inputs are tables of numbers, your outputs are tables of numbers, and it is relatively simple to go back and forth to text files (containing tables of numbers). And for the record, I started programming in both of these languages at about the same time, for about the same projects, so it isn't a case of "language A is easier because I've been using it for years, whereas B is new and frightening."

    -DuctTapeBoxen

  43. making R better by kegel+dragon · · Score: 1

    Ross Ihaka was my supervisor for my honours dissertation last year. Reading this article was a bit amusing for me. If you asked him for his opinion about R, let me say he wouldn't have written such glowing words about it! He doesn't like being in the limelight all that much either, from what I have been able to tell.

    I may have some idea what is meant by the "wanting to create more advanced software" at the end of the article. At the moment he is tinkering away rebuilding the guts of R in Lisp. He reckons if "things were done properly", R would be orders of magnitude faster and more efficient. For example, when fitting a linear model, several copies of the data matrix are made when performing the matrix operations required to find all the coefficients, working out diagnostic matrices, et cetera.

    So if anyone out there wants to contribute to R, now would be a good time to volunteer.

  44. Nothing really by ArchieBunker · · Score: 3, Insightful

    Labview is well designed for its intent. So someone with minimal programming skills can sit down and get something done in a short amount of time. Would I use it for crunching numbers or collecting terabytes of data, probably not. But its sure damn handy if you want to interface test equipment and get results. Its all about the best tool for the job.

    --
    Only the State obtains its revenue by coercion. - Murray Rothbard
  45. Re:What's a pirate's favorite programming language by Anonymous Coward · · Score: 0

    I think you mean

    R! Jim lad!

  46. You have to play with it. by thethibs · · Score: 2, Insightful

    You have to play with it. As with APL you'll either love it or hate it.

    If you like the idea of a language that includes relational tables as a primitive data type, that extends most operators to do the right thing when you feed them vectors and matrices, that has linear regression and equation solving built-in, you'll probably like R.

    --
    I'm a Programmer. That's one level above Software Engineer and one level below Engineer.
    1. Re:You have to play with it. by ZmeiGorynych · · Score: 1

      Erm, no. Tried it, hated the way object orientation works, and used Matlab instead, which also has all of the features you list, but also a way, way more mature GUI (at least it did when I looked), as well as brilliant Java integration.

      I can instantiate Java objects inside my matlab code with one command, and treat them as native - important because the production code must be in Java/C++ ultimately. I can even debug that Java code from eclipse while it runs in matlab, using JDWP.

      That's so damn convenient that now that we're moving from Java to C++ in prod, I'll probably go on doing the same thing using SWIG wrappers for the C++ code (all C++ debuggers I've seen suck big time compared to debugging Java in Eclipse).

  47. Sure... I use R daily by Anonymous Coward · · Score: 0

    There's nothing like it for doing math and graphs.

  48. How does it connect to Java? by Latent+Heat · · Score: 0, Offtopic
    One of the "secrets" I tell students about Matlab is that is Java in reality.

    On one level, Matlab, or at least the Figure Windows and M-File editor and Command Windows are written in Java and the main Matlab windows are JFrames. People talk about Java having not gotten anywhere "on the client" and "where are the Java shrinkwrap apps", but a bunch of stuff -- Matlab, Mathematica, Maple -- have GUI front-ends done in Java. You can tell because when one of these packages is slow to load, you see the "flaming coffee cup" icon on the taskbar.

    Word and even OO may not be written in Java, but for the apps in question, there is a big demand for having them on the Unices on account of the academic market for them, and Java appears to be the cross-platform GUI thingy of choice for this tier of commercial apps.

    So, is the R front end Java-based, or are they using something else to be cross-platform?

    The other thing about Matlab is that it is usable as a Java scripting environment. You can create instances of Java classes from the command window, assign these instances to Matlab variables, pass (by value) Matlab arrays in and out of Java functions without too much fuss, poke at Java class instances (that is invoke methods on them).

    You can even embed Java Swing widgets in Figure Windows, although the javacomponent Matlab command is thinly documented and perhaps not yet officially supported.

    Does R allow the same thing? How Java friendy/compatible/implemented is it?

    1. Re:How does it connect to Java? by Anonymous Coward · · Score: 0

      http://www.rforge.net/JRI/
      http://jgr.markushelbig.org/JGR.html

    2. Re:How does it connect to Java? by ZmeiGorynych · · Score: 1

      More than that, you can connect Eclipse to Matlab via JDWP, and debug your java code (set breakpoints in it, stop on exceptions etc) while calling it from matlab.

  49. Re:Freak your colleagues out with "no loop" code.. by iluvcapra · · Score: 1

    I think he says "state" when he means "heap."

    --
    Don't blame me, I voted for Baltar.
  50. Re:Freak your colleagues out with "no loop" code.. by portscan · · Score: 1

    Actually, calculations in R are just vectorized. Internally, there must be some looping, but the language hides it.

  51. The important thing here ... by sxpert · · Score: 1

    is that SAS is not amused of the competition

  52. It is a pain in the ass to change. by pavon · · Score: 5, Informative

    Say you realize that you need to check for another corner case that you forgot, or need to extend a function for another purpose, or whatever. In any other language, you would type a few lines of code and be done with it. Not with labview. With labview you have to move things around to make room for the new code, disconnect wires and reconnect them. NI has added stuff into the newer version to help with this (auto growing, etc) but it still turns into a mess in short order.

    Other things are just easier to type than to draw, and also easier to read in text then as a schematic, like equations. So much so that they have added the ability to type portions of the code, but the amount of setup that you need to do with a code block often defeats the time benefit you get from using it.

    As someone who likes "clean code" I find LabView much more tedious and time consuming to keep neat, and when dealing with other coders that are not as picky, I find that their LabView code is much messier and harder to read than Java or C code by the same developer.

  53. Re:"R" you the first post? by Anonymous Coward · · Score: 0

    Arrrrr! Yes, my matey!

  54. Alphabet soup by WoollyMittens · · Score: 1

    What will happen to the naming convention of programming languages when we run out of letters of the alphabet?

    1. Re:Alphabet soup by Anonymous Coward · · Score: 0

      We'll use more than one letter like we did with PERL, COBOL, and Python?

    2. Re:Alphabet soup by badkarmadayaccount · · Score: 1

      How about Greek?

      --
      I know tobacco is bad for you, so I smoke weed with crack.
  55. Re:Freak your colleagues out with "no loop" code.. by Martin+Soto · · Score: 3, Informative

    Do you happen to have a link to what you mean by "a program should not have state"? Because, I mean, that seems antithetic to the nature of a program.

    Of course there is a state, you're using a standard computer to run the program, so there must be a state somewhere. Still, the point is that even if the language implementation works by changing the computer's memory state, the abstraction you use to program isn't state-based. In a pure functional programming language, you don't program by manipulating a state, but by computing the results of functions.

    Regarding the SICP book, like most functional programming languages, Scheme isn't a pure functional language. It contains constructs with side effects, which actually change the program state directly. Such constructs are available because there are problems that are very difficult (but not impossible) to handle with pure functional programming, so language designers end up making compromises.

    Just my 2 (Euro) cents

  56. I use R daily and I hate it by lbbros · · Score: 1

    Like many posters have already said, the syntax of R is terribly outdated, and that's a first problem with me (I started programming with Python, go figure). But the main problem I have with R is the performance. A lot of functions and packages are dead slow or quite memory hungry (compared to a, say, C++ equivalent - for the initiated, check out the performance of rma from Bioconductor with RMAExpress, which is written in C++).

    Another issue I have is not with R itself, but with its most popular add-on, the Bioconductor suite, widely used in bioinformatics. The packages' quality varies a great deal, and there's no way to file bug reports (unlike R itself, which has a bug tracker) short of emailing the authors, who, being academics, may not even have the time/will to reply to you. I'd love to see stuff like Bioconductor in a more recent programming language, but I doubt it - doing this kind of stuff doesn't give you any funding.

    --
    A CC-licensed illustrated horror novel
  57. Re:What's a pirate's favorite programming language by Anonymous Coward · · Score: 0

    i R baboon!

  58. Labview sucks the most by AliasMarlowe · · Score: 4, Informative

    Labview is utterly non-deterministic in its execution. The execution order of blocks does NOT follow the data flow of the lines joining them if there are more than a handful of blocks present. In fact, the execution sequence becomes random, and changes randomly when block positions are changed (even without changing the data connectivity). This forces the use of explicit sequence structures in any non-trivial function, increasing its complexity and opacity. Just try synchronizing shared data between asynchronous loops. Even their Knowledgebase admits that there's no way to do it properly.

    And let's not get started on the crappy content of Labview's documentation. It's organized and formatted tolerably well, but the content is vacuous. Hardly any functions have any suggestion of their behaviour when faulty data arrives (e.g. a NaN), for example.

    --
    Those who can make you believe absurdities can make you commit atrocities. - Voltaire
    1. Re:Labview sucks the most by Undead+Waffle · · Score: 5, Interesting

      It has plenty of other annoying behaviors.

      If you try to access an array element out of range it just gives you the default value for that data type rather than giving some indication that something is wrong.

      There is an option to automatically build an array as the output of a loop, but no way to make it *not* add a value to the array. Like when you hit a terminating condition for the loop or some value you want to skip. If you have these situations you either have to modify the array afterwards or build the array manually.

    2. Re:Labview sucks the most by dargaud · · Score: 4, Interesting

      I agree with your and the GP's analysis of LabView, which is why I use LabWindows: it's basically LabView's user interface connected to standard C, hence totally deterministic. But two things about LabView ensure its future: it's close to the way of thinking of electronicians and also it deploys very well on multicore processors (and probably on distributed architectures as well).

      --
      Non-Linux Penguins ?
  59. Re:Freak your colleagues out with "no loop" code.. by Pentagram · · Score: 1

    That's not what I understand to be functional programming. The basic rule of functional programming is "no side effects", so the same input(s) will always produce the same output. Or, to put it another way, a function doesn't maintain state between invocations. This isn't incompatible with loops. For example, you could write a function to calculate the fibonacci series up to n which internally used a loop, and still call it functional.

  60. Re:Freak your colleagues out with "no loop" code.. by Anonymous Coward · · Score: 0

    "With R you tend to need to spend far more time thinking about why you are doing something, and what the answer means than in say vanilla C/Ruby programming."

    C & Ruby? You're comparing Apples and Oranges sir.

  61. Re:Freak your colleagues out with "no loop" code.. by dumael · · Score: 1
    What I think you mean, is that functional langauges allow you to have functions which are fairly generic, but encapsulate control flow structure. For instance, if you have a list of items in a functional programming language [1,2,3,4,5], if you want to do a transform on each of these elements that is independant of the elements position, and without refernce to other elements, you'd use the highly common 'map' function. Map almost universally is called with a single element transform, and a list (or other data structure that map can apply to). In the end, certain cases of 'for' loops in languages such as Java,C*,C++*,Fortran have their equivlanet expression in a functional language that looks like:

    NewList = map Function OldList

    Other common ones are filter, fold. For loops and the like that require state, typically you use tail recursion, and most functional programming langauges trivally expand that optimization to the general case of tail call optimization, where any function F whose return value is the return value of the function G, then you don't need to retain F's stack frame, as F's result is simply G's result. * C and C++ allow for the use of function pointers, which can allow a functional style. C++ is better than C is this regard, as the STL also comes with a set of functional algorithms such as map.

  62. Octave is more an alternative to MATLAB by Reality+Master+201 · · Score: 1

    R is statistics oriented, where Octave and MATLAB are more general mathematical computing environments.

    1. Re:Octave is more an alternative to MATLAB by lt.+slock · · Score: 1

      Octave is great if you are moving from MATLAB to a free tool, because it has a similar syntax (IIRC it lags the MATLAB launguage by a couple of versions). But, in my view at any rate, R has a nicer language than either, and was well worth learning. You're right that R is stats oriented, but not some much that you feel crippled by it in use.

  63. pros and cons by Fuzuli · · Score: 1

    if you are coming from a programming background, I assure you that you'll hate gui oriented tools like spss. if you have a slightly better understanding of probability and the notion of sampling, you'll find that the way r approaches data as a whole feels very nice for a developer.
    in data analysis, you'll be transforming, filtering typecasting data. you'll be turning numbers into nominal values, you'll be sampling from complex distributions etc. writing code to do these lets you stay in complete control of what you're doing and at least for me looking at a function line by line is a much better way of seeing what I'm doing, instead of clicking on icons and selecting menu items in a particular order. the whole process is documented in code, and for me it is much easier to map the things I'm doing to statistics.
    the downside of R is, as you start dealing with more and more data, things become a little bit harder since R takes all data into memory and processes it in memory. scaling into very large amounts of data is not easy, at least I can't afford as much ram as necessary (my data sets are really huge). the most important advantage of some commercial tools in my work is that they can treat data as a stream on disk, and even if it takes longer, it is possible to process huge amounts of data.
    R forces you to think about what you are doing, instead of hiding behind spss and saying, well these are the results spss has given us, when we clicked these buttons and menus. my 2 cents of course.

  64. Re:Freak your colleagues out with "no loop" code.. by pjabardo · · Score: 1

    Actually, R hasn't used linked lists to represent its "list" data structure for a long time. So it is very much like python indeed.

  65. Re:Freak your colleagues out with "no loop" code.. by Anonymous Coward · · Score: 0

    "The worse thing about R programming is its name. Googling for "R" turns up way to much noise and way too little signal"

    Try searching from http://rseek.org/ instead of directly from Google.

    I usually google for "R-help" plus whatever term I'm interested in. This gets responses from the enormously popular and helpful R-help mailing list.

  66. Re:Freak your colleagues out with "no loop" code.. by gg2007 · · Score: 1

    I remember once years ago freaking my colleagues out with a largish app written in R... with nary a loop anywhere.

    That's a feature of functional languages, a class that also includes Scheme and XSLT. The basic idea is that programs should not have state, because state makes them harder to debug. A for or while loop, by definition, has state, so you have to do your iteration some other way, namely Tail Recursion.

    I suppose that makes sense, but I've never been able to teach myself to think that way. It's the main reason I never managed to get through The Wizard Book.

    R has a scheme-like lower layer but it feels more like APL with its array manipulation capabilities than Scheme. It does not support tail recursion.

  67. Re:Freak your colleagues out with "no loop" code.. by syntaxglitch · · Score: 2, Interesting

    Such constructs are available because there are problems that are very difficult (but not impossible) to handle with pure functional programming, so language designers end up making compromises.

    Not that difficult, really. The main problem is sequencing, which is provided by things like function composition. The problem is the unwieldy nature in languages like Scheme of specifying sequencing using pure functions, while also handling data that doesn't require sequencing; but this is a syntactic problem, not a practical one.

    The issue is handled admirably by the language Haskell, using a mathematical construct called a "monad" to allow an elegant way of handling sequencing--even a syntactic sugar "do" notation that looks vaguely imperative--while remaining 100% pure, unlike Scheme.

  68. Re:Freak your colleagues out with "no loop" code.. by syntaxglitch · · Score: 1

    I think he says "state" when he means "heap."

    More likely he's thinking of something along the lines of "maintaining referential transparency". That is, the only sense of identity a variable has is its value, not its storage location, meaning that complicated data structures can't be altered, only used to construct new, different versions.

    This incidentally makes multithreading alot easier, too. :)

  69. Well I wanted to try it out... by Viol8 · · Score: 1

    ... but for some curious reason it requires a fortran compiler as well as a C compiler to build the whole system.

    Sorry R team , but theres no way I'm installing an entire fortran compiler just to install your system.

    Why can't they write the whole thing in C for heavens sake? The days when C couldn't handle floating point very well (if thats the reason) are long gone.

    1. Re:Well I wanted to try it out... by pjabardo · · Score: 1

      It needs the fortran compiler since it uses a lot of code from fortran libraries (I believe there are several things from netlib). You could try f2c and its wrapper program fort77.

    2. Re:Well I wanted to try it out... by Anonymous Coward · · Score: 0

      R is written in C. It just happens to use some well-tested, standard Fortran libraries like LAPACK. Why rewrite it all in C when free Fortran compilers exist?

      And you don't need any compilers to install R. Binaries are available from CRAN for several flavours of Linux, Windows and MacOSX, and R is now included in several Linux distributions' package management systems, along with some of the more popular add-on packages.

      [OK, under Linux you will need the compilers to install any add-on packages containing compiled code, even if you installed R via a binary as the Linux version doesn't use binaries for add-on packages.]

  70. Re:What's a pirate's favorite programming language by roaddemon · · Score: 3, Funny

    No, it's P. It's like R but it's missing a leg!

  71. Re:Freak your colleagues out with "no loop" code.. by Eponymous+Bastard · · Score: 1

    Actually, R is an imperative language. You can loop just fine, as well as modify variables (state) and everything else you'd expect from a normal language. (Though functions are first-class objects and all that)

    The reason you don't is that it's like SQL in that its statements can work on whole tables at a time. For example, applying mean() to a table gives you an array with the mean value of every column (and the array positions are named after the column names).

    If you want to get the rows of an array (x) with 0 on column 1, you do x[x[,1]==0]. basically, x[,1] gives you a one column table with the appropriate column, x[,1]==0 gives you a vector of true,false values, which you can use to index into the array again.

    You can do things like by(x,x[,1]==0,nrow), which gives you how many rows have 0 and how many don't on column 1. by(x,x[,1]==0,mean) gives you the per-column mean of the rows which have 0 on column 1 and the same for those that don't

    Anyway, you get the idea. You can loop just like can use cursors in SQL, but your code will be slower and less readable if you do.

  72. Re:Freak your colleagues out with "no loop" code.. by dargaud · · Score: 1

    In a pure functional programming language, you don't program by manipulating a state, but by computing the results of functions

    Which is why I always found the entire 'functional programming' paradigm absurd and useless. When you deal with I/O, you have states ('printf'). When you deal with a user (interface), you have states. Hell, even when you deal with time you have states ('before' and 'after').

    If all you want to do is compute f(x), then OK, maybe, but besides that nothing useful has ever come out of functional programming except Emacs. Well, let me rephrase that: nothing useful has ever come out of functional programming, period. The amount of time and brain power wasted on things like Lisp for no result whatsoever is astounding.

    --
    Non-Linux Penguins ?
  73. BOGUS is better by Anonymous Coward · · Score: 0

    BOGUS languages are much better, more exclusive and more profitable programming languages. I encourage everyone to put that they are proficient in BOGUS languages on their resume.

  74. To can or not to can by Anonymous Coward · · Score: 0

    to can: verb; means "to throw away", as in "we can the financial crisis on idiots".

    1. Re:To can or not to can by Anonymous Coward · · Score: 0

      That still makes no sense. You throw away the financial crisis? What? Is English your second language?

  75. R and Java by golodh · · Score: 1
    A partial answer can be found in the links posted by Anonymous in a first response to your question.

    A more complete answer would be: the R system is basically an interpreter which accepts messages and terminal connections, like a server. It has no "native" front-end (except a stark command-line window) per se.

    This means that *any* application that can log in to R as a client or send the R interpreter messages and capture the response can use the R interpreter as a slave, and can hence act as a GUI. It doesn't matter if that's a Windows application, a Linux application, or a Java application, or a web-server (R can work as a back-end to a web-server too). The only thing is the amount of work needed to get things working and to actually code up the GUI. There is a package called Rserve (see http://www.rforge.net/Rserve/) that greatly facilitates this for C++ and Java. Below is a quote from the Rforge repository:

    Rserve is a TCP/IP server which allows other programs to use facilities of R (see www.r-project.org) from various languages without the need to initialize R or link against R library. Every connection has a separate workspace and working directory. Client-side implementations are available for popular languages such as C/C++ and Java. Rserve supports remote connection, authentication and file transfer. Typical use is to integrate R backend for computation of statstical models, plots etc. in other applications.

    The following Java code illustrates the easy integration of Rserve:

    Rconnection c = new Rconnection(); double d[]=c.eval("rnorm(10)").asDoubleArray();

    d now contains 10 random samples from the N(0,1) distribution if there is a runing Rserve on the local machine. The Rconnection doesn't have to be created more than once in your application.

    There is at least one R gui's written in Java (called "JGR" (Java Gui for R); see the post with the JGR link; JGR is FOSS too). In principle this ought to be able to run under Linux, but the last time I tried (a year or so ago) I had nothing but trouble getting it to install. The Windows installer does a nice job of it though: 5 seconds and it's up and running with all its features enabled. I don't know how easy or hard it is to add your own Java routines to JGR and how easy or hard it is to redirect R output to your own Java application under JGR, or put them under the menu structure of JGR. I never tried, but I strongly suspect that it's possible and not hard. As far as I can see, this is not a question of interfacing with R but with JGR (a native Java application), but I never gave it much thought so you'll have to see for yourself. Sorry.

    A popular Windows GUI (called TinnR) (see http://www.sciviews.org/Tinn-R/) has been written in Delphi 5.

    Last but not least, R has excellent interactivity with Emacs, which works as well under Linux as it does under Windows. I personally can't stand Emacs, but lots of people swear by it (I just swear at it).

    1. Re:R and Java by Latent+Heat · · Score: 1
      Thanks for the leads and info.

      What I gather from those links is that R is largely a kind of "server" application for which there are a number of GUI front ends or "clients", some of them platform-specific, and one of them -- JGR -- Java based, which in theory is platform neutral, but I will consider your warning about difficulties under Linux that may require some patience.

      To make the GUI front end Java based seems to be a trend (if Matlab, Mathematica, and Maple make up a trend), and JGR appears to be the R answer to my question.

      The question about calling R from Java is also addressed. Unanswered is whether R can invoke Java. If it can do that, it would make R Yet Another Java Scripting Language along with Groovy, Beanshell, Jython, and yes, even Matlab. I guess the thing to do is try out JGR and see what features it supports and whether Java classes may be invoked from the Command Window or from scripts. Once the GUI is written in Java the ability to operate on Java classes is not far behind owing to class loaders, reflection, and related features in Java.

  76. plenty of add-ons by Anonymous Coward · · Score: 0

    I love people who omit the fact-checking before blurting out publically an opinion they formed long ago (after all, what was good back then, it is good now, too, no?)

  77. Coding large applications in R by golodh · · Score: 2, Interesting
    Well yes and no.

    I agree with the first part of your post: to me R is something to code in when you have to, and to keep the resulting code as short and simple as possible. If I ever had to code a real application with a GUI that needed the statistical strengths of R, I would almost certainly not use R.

    On the other hand I'd probably use Java and link to R as a server (see my other post about R and Java) instead of using Python.

  78. FUD by kenp2002 · · Score: 1

    "I think it addresses a niche market for high-end data analysts that want free, readily available code," said Anne H. Milley, director of technology product marketing at SAS. She adds, "We have customers who build engines for aircraft. I am happy they are not using freeware when I get on a jet."

    This idiot needs to be fired immediately. Freeware is no less reliable then closed source. For someone who works at SAS the concept of peer review of work must obviously make the work more unreliable because it's peer reviewed. Such utter idiotic nonsense.

    SAS Institute Inc.
    100 SAS Campus Drive
    Cary, NC 27513-2414
    USA
    Phone: 919-677-8000
    Fax: 919-677-4444

    I for one have no interest in dealing with someone that stupid. Lockheed, Boeing, Ford, Toyota, and ever damn bank I have ever seen and worked with has Linux in the enterprise. Someone with this seer level of stupidity needs to go.

    --
    -=[ Who Is John Galt? ]=-
    1. Re:FUD by kenp2002 · · Score: 1

      Anne H. Milley can be reached at 860-767-1312 FYI

      --
      -=[ Who Is John Galt? ]=-
  79. Re: hence: when he restored unto Moses fled from m by xaositects · · Score: 1

    Oh My Gobbldegook!

    what happened to the part about sloths and fruit bats and orangutans?

  80. An engineer's view by Anonymous Coward · · Score: 0

    I'm an electrical engineer. Most folks in my field would use excel and then Matlab. I have no statistical background. I started using it because it has great graphics and plotting capabilities, much better than excel -- more precision, many more types of plots, no jaggies when imported into word, and more. See here for some great examples from Deepayan Sarkar's lattice system, an implementation of William Cleveland's trellis graphics:

    http://lmdvr.r-forge.r-project.org/figures/figures.html

    That's just one of several ways to create precise, good-looking graphics.

    As I used it more, I started to appreciate R's language features, too. It's a great all-purpose data manipulator. It's great with 2-d tables, but handles other data nicely, too.

    Along the way, I even picked up some statistics:)

    1. Re:An engineer's view by Anonymous Coward · · Score: 0

      It was amusing to see the response of several of the R mailing list regulars following the NY Times article -- let's plot some data. See below for a summary of comparisons of R, SAS, and S-plus mailing list activity:

      blog summary

  81. The only problem with R by Anonymous Coward · · Score: 0

    Is that normal, non-programmer users who want to be able to perform various statistical operations and data manipulation operations do not have the time nor desire to learn a programming language. R is a great language. However, some people already have enough trouble clicking on a button.

    There is some difficulty in understanding the target audience for R. It is not for everyone, but this seems to be implying it is, and that is where the problem enters.

    In fact, the more case-oriented that data mining software becomes, like SAS Enterprise Miner or Insightful (now TIBCO) Intelligent Miner or SPSS Clementine, PolyAnalyst, DiagnosX, etc, the larger the audience of users.

  82. Re:Freak your colleagues out with "no loop" code.. by sunhou · · Score: 1

    If you want to get the rows of an array (x) with 0 on column 1, you do x[x[,1]==0]. basically, x[,1] gives you a one column table with the appropriate column, x[,1]==0 gives you a vector of true,false values, which you can use to index into the array again.

    While that does pull out the rows which have 0 in column 1, it packs those return values into a vector (the first element of each of the selected rows, followed by the second element of the selected rows, etc.). If you want to extract those rows of the matrix, and keep them in matrix form, then this will do it (note the extra comma):
    x[x[,1]==0,]

    Yes, R is pretty nice in that sense. Matlab can do many of the same tricks, e.g. the Matlab equivalent of my command above is
    x(x(:,1)==0,:)
    Matlab doesn't have a simple way to do your version that I know of, since Matlab doesn't automatically recycle a vector index to a matrix. You'd have to do something like x(repmat(x(:,1)==0,n,1)) where n is the number of columns in x -- or to avoid hardcoding the n, you could do x(repmat(x(:,1)==0,size(x,2),1)) which is starting to get ugly isn't it?

  83. Re:Freak your colleagues out with "no loop" code.. by garett_spencley · · Score: 1

    And even with all that aside, you're still in some kind of state. Be it Idaho or the nation state of Australia.

    Some people just don't understand anything. Sheesh.

  84. The Power of Q, from the much-better-than-R dept by davidjroberts · · Score: 1

    I don't know if anyone's noticed, but this post was from the 'much-better-than-Q' dept.

    Q is so much better to programming in than R (and more productive, especially when analysing large data sets).

    Someones got an axe to grind in the R vs Q argument...

  85. Re:Freak your colleagues out with "no loop" code.. by stonecypher · · Score: 1

    with nary a loop anywhere.

    That's a feature of functional languages

    Tell that to Eiffel, Haskell, Clojure, C++ templates, et cetera. Don't confuse what certain functional languages do with something being a defining characteristic of functional languages. Many functional languages are mutable, have loops, are not pure, have state, et cetera.

    --
    StoneCypher is Full of BS
  86. It's not that big of a deal by ickeicke · · Score: 1

    I've come across a couple of examples of inappropriate use of Excel

    • A friend worked at the UK Treasury as a statistician. One of his jobs was testing and improving the Treasury's model of the UK enconomy. I was impressed and asked what tools they used for this. Erm, none, it's just a huge Excel spreadsheet.

    Yeah, but it's only the UK economy, it's not like its the German or the Japanese economy or anything. ;)

    --
    Firehed - Unfortunately, thanks to medical breakthroughs, common sense is not as common as it once was.
    1. Re:It's not that big of a deal by Crazy+Taco · · Score: 1

      Yeah, but it's only the UK economy, it's not like its the German or the Japanese economy or anything. ;)

      Exactly! They probably don't even have to worry about that old 65,536 row limit!

      --
      Beware of bugs in the above code; I have only proved it correct, not tried it.
  87. When it comes to statistical programming languages by Anonymous Coward · · Score: 0

    ...Stata is still my choice.
    It's commands are simple and intuitive. If you want to regress y on x1 and x2 you type "regress y x1 x2". In R you would type something like: "Results - lm(Y~X1+X2, data=datasetname)".
    In Stata if you want an 'option' like clustering or robust standard errors you simply change the command to "regress y x1 x2, robust", in R its not so simple.

  88. Please explain "Never"... by Anonymous Coward · · Score: 0

    There have been several postings like this that say R has "1970's syntax", that R should "never" be used for large/complex programs, etc.

    I'd like to ask for specifics:

    1. State your modern-syntax language for comparison. Give 3 or 4 examples of how R is old-school (and inferior, not just different).

    2. Specifically why would you not use R for complex/large projects? Is it the language, or the lack of an IDE? And are you including R's base and package routines in the calculation? (I.e. you may be able to do with 3 function calls in R what it would take two pages of coding in another language.)

    Personally, I like R as a language. Anonymous functions, parameters by position or name, the "..." parameter which is fairly magical, lots of vectorization (i.e. functions that work on vectors/lists just as simply as scalars), nice data structures, and a useful OO structure.

    Certainly I wouldn't recommend getting R _only_ for its programming language. But if you are working in the machine learning, statistics, etc, areas, and need things like statistical analysis, clustering, regression, data mining, etc, etc, plus very nice and flexible graphical output, why NOT use R?

  89. Re:Freak your colleagues out with "no loop" code.. by mrjohnson · · Score: 1

    nothing useful has ever come out of functional programming, period.

    Lol. I generally agree with you, but map/reduce was inspired by functional programming and seems to be useful for some problems....

  90. ggplot2 graphics library is fantastic by jameshowison · · Score: 1

    The power of R is in its libraries, which are often maintained by the best statistical researchers in that area.

    Recently I discovered the ggplot2 graphing library, which is a huge step forward for constructing graphs of all types in R. It's very well documented and very actively maintained.

    http://had.co.nz/ggplot2/

  91. you don't get it by plopez · · Score: 1

    I have been using R for Geospatial statistics for about a year.

    R is a good language for number crunching large amounts of data, data visualization and analysis.

    It is based on Scheme and brings back fond memories of Lisp for me.

    You can compile and link in your own Fortran libraries using your favorite flavor of Fortan (F95 in my case) to extend it. This means it is more a job control language in some ways.

    You should not loop in R but rather use sequences or do so in you libraries.

    It has a truly frightening number of open source add on libraries.

    Comparing it to C, Java, Ruby or other languages misses the mark. You't won't use it for e-commerce or low level controllers, but it was never designed for that.
    R does have OOP capabilities though I haven't used them.
    I've used Maple, SAS, Matlab and R. R wins hands down. It's powerful and fun.

    Since I've only been using it a year, there are a number of other things I probably have missed.

    --
    putting the 'B' in LGBTQ+
  92. Re:Freak your colleagues out with "no loop" code.. by Anonymous Coward · · Score: 0

    Actually, the main reason R doesn't need (as many) loops, is that most data types are vectors. And the operations on them are typically vector operations.

  93. R looks alot like prolog by GargamelSpaceman · · Score: 1

    Not sure, I only spent about 2 minutes looking at the site.

    --
    ...
  94. Re:Freak your colleagues out with "no loop" code.. by fm6 · · Score: 1

    I mostly know functional programming from studying Scheme and Logo. These languages facilitates stateless programming by making it easy to avoid state variables. (Really, the word "variable" means something quite different in these languages.) Textbooks that I've read that are based on these languages (SICP being the most famous example) simply don't talk about traditional loops — all iteration is done with tail recursion. Perhaps other functional languages are different, but these are the only two I know anything about.

    All beside the point. As a half-dozen posts have already pointed out, I was wrong to describe R as a functional language. It's an imperative language with lots of vector operations. That's where it's looplessness comes from.

    Do I have to give my karma points back?

  95. Re:What's a pirate's favorite programming language by Anonymous Coward · · Score: 0

    Someone needs to write a file-sharing application in R.
    Just for kicks.

  96. SAS vs. R by portscan · · Score: 1

    I have used both SAS and R for projects large and small. Each has its own use, but I strongly disagree with the SAS marketing rep's argument that "We have customers who build engines for aircraft. I am happy they are not using freeware when I get on a jet." Actually, I would find it terrifying to think about the engineers using canned packages that are subject to no external review whatsoever, rather than R and its routines, which are freely available for all to see.

    When choosing between the two, there are two questions I would ask:
    1) What format does my data come in?
    2) Is my data small enough to fit in memory?
    If the answer to 1 is "SAS dataset" or the answer to 2 is "NO" then I would use SAS. It keeps datasets on disk, so if you are handling TBs (or even GBs) of data, there is no better software package. A lot of big data dumps come in SAS, too, so while it is easy to dump to CSV, if you are repeatedly accessing the same data source, SAS makes sense. Also, if you already have significant infrastructure written in SAS (data processing, reporting, etc.) it may make sense to continue doing it that way.

    In all other cases (and even in some of the above cases, when considering overall cost), R is better. Easier to program in; easier to write C/Fortran/Python/etc. extensions for; contains real functions (SAS just has macros); object oriented; and FREE (GPL and zero cost). That last bit is important because if for some reason the SAS Institute goes bust (stranger things have happened), and all of your code is in SAS, you are fucked. Whereas if you have been writing in R, you will always have your existing software and can, in principle, continue developing it yourself or hire someone to maintain/upgrade it for you.

    R is great, even if it is a slightly awkward language. It easily blows Octave out of the water in almost every way, but is inferior (as a language) to python+scipy, although I believe that it has far more packages available for it. Just check out CRAN some day. It's amazing.

  97. Deploy your R models on Amazon EC2 Cloud by Anonymous Coward · · Score: 0

    Zementis (http://www.zementis.com/)has been working with the R community, specifically to extend the support for the Predictive Model Markup Language (PMML) standard which allows model exchange among various statistical software tools.

    Got models in R? Deploy and score them in ADAPA in minutes on the Amazon EC2 cloud computing infrastructure!

    If you develop your models in R, you can easily deploy and execute these models in the Zementis ADAPA scoring engine (using the PMML standard). This not only eliminates potential memory constraints in R but also speeds execution and allows SOA-based integration. For the IT department, ADAPA delivers reliability and scalability needed for production-ready deployment and real-time predictive analytics.

    How to export PMML from R? http://adapasupport.zementis.com/2008/02/how-can-i-export-pmml-code-from-r.html

    What is PMMML? http://knol.google.com/k/alex-guazzelli/pmml/3pz0mz6zvkz16/1

  98. Re:Freak your colleagues out with "no loop" code.. by tehcyder · · Score: 1

    and over-reliance on built in functions can make it too easy to talk out of your ass.

    Or in the UK, out of your "Rs".

    --
    To have a right to do a thing is not at all the same as to be right in doing it
  99. Other things I like about R by wfolta · · Score: 1

    I haven't seen several things listed so far:

    1. Plotting (graphing). You have several choices:

          i. R's base graphics
          ii. The lattice package
          iii. The ggplot2 package
          iv. Packages that create interesting classes tend to create plot methods for them (really a special
                    case of item i, above)

    Most environments/languages would be absolutely thrilled to have options ii or iii, and option i/iv is pretty good, too. The ggplot2 package in particular has a different (but very nice) approach to plotting.

    I mean how many programs/environments with adequate graphics spawn multiple graphics packages, each of which is well-maintained and good?

    2. I like named parameters, and while it may not be the neatest programming practice in the world, the "..." parameter is very clever. It stands for all the parameters you have not specified in your function. For example:

          foo - function (x, y=13, ...) { x - bar (x, y) ; baz (x, ...) }

    The code here is silly, but the idea is that you are passing x to baz, plus all of the arguments to foo that were not x or y (i.e. all of the arguments that you did not specifically list as parameters for foo).

    It's a poor-man's OO tool, I guess, but it gets used a lot in plotting, in particular.

    3. Documentation. I've seen complaints about the documentation for R packages, but when I've dipped my toe in the Matlab and Sage worlds, I've found package documentation that looks more like notes scribbled on a sticky note than R documentation. R packages have documentation that includes a nice TeX'd output, and usually good explanations and bibliographies. Larger packages will even have vignettes that dive into specific areas of the package.

  100. Get a binary install by wfolta · · Score: 1

    Faster, easier, nicer.

  101. Re:Freak your colleagues out with "no loop" code.. by badkarmadayaccount · · Score: 1

    Well, both of them ARE very Lisp-y, sooo... Yeah, that's about it.

    --
    I know tobacco is bad for you, so I smoke weed with crack.
  102. R and Java by gluliverk · · Score: 1

    Someone known R interpreter written in Java ??

    --
    JMule user, enjoy it : http://www.jmule.org
  103. The Power of the R Programming Language by Anonymous Coward · · Score: 0

    as used by Pirates?

  104. FAIL. by Anonymous Coward · · Score: 0

    "Sir, you are stupid and I am going to rub your face in it!"

    "Wait, I am stupid."

    "Nevermind, I won't apologize, I will just call us both stupid, so as to avoid retracting my thesis that you are stupid."

    Best Regards,

    Internet Pussy