[This article was first published on R Programming – Thomas Bryce Kelly, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
On a day to day basis, I use the R programing language more than any other language (e.g Python, Java, Fortran, Matlab…), and there is a good reason for it: R excels at the sort of work I do. It has been extremely well suited to my modeling work, especially when going to analyze the output and in making figures, but it has also versatile enough for the computationally intensive task of running the model itself. Having said that, I need to be honest about where I see the R programing language standing now and into the future (via tirade). Included in this will be a combination of strengths, weaknesses and features that will either make or break R in the coming years.
The Good
One area where R has excelled at is the interactive nature of the language. While Python and Matlab both are interactive, I’ve only ever seen explicit use of interactive and non-interactive modes used in R. For an R script, the program behaves different based on whether or not it is run interactively. While trivial, this simply idea can help make functions, class, and packages more user friendly and versatile by making the UI easier to piece together.
But I must admit that the golden egg of r, so to speak, has to be the package management system. With a simple one line command, any package available from a repository (e.g. CRAN) can be quickly downloaded and installed without a second thought, and this is precisely what a package management system should be. Over the years Python has improve on this front with pip to add similar functionality, but R is the only language I’ve seen where the package management system is integral to the design of the language.
For comparison, Matlab is the antithesis of a well executed package management system. Not only are many “official” packages, or Toolboxes, not free, the ones that are all have to be downloaded and installed from websites and forums. Frankly, it is a mess and a real pain in the ass.
The Bad
Every programming language has some conception of a Namespace, so let’s take a look at how R manages its own. A Namespace is a generic term for how a programming language manages and structures the various names of the variables, functions and other constructs within the program. For example, consider the following Python program.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
def g(): x = 10 print(x) x = 3 g() print(x)Scoping refers to where in a Namespace, or perhaps more correctly, which Namespace, an variable is defined. So above, there is a variable
To leave a comment for the author, please follow the link and comment on their blog: R Programming – Thomas Bryce Kelly.
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.