শনিবার, ১৫ ডিসেম্বর, ২০১২

Ask Slashdot: Replacing a TI-84 With Software On a Linux Box?

I've got an MSc in CompSci, and I'm now doing a PhD in a biology department. I teach a programming course using Matlab, and I've recently started using R to do my own analysis stuff, mainly because it's popular and I'd like to stay compatible with the rest of the field, as well as use some specialised software that works with it. I have to say, being used to real programming languages (such as C++, I'm not counting Matlab here, although see below) I'm quite frustrated with R. Function names are generally different from other languages and to me at least unintuitive, and the documentation is too often extremely vague and difficult to search.

For example, the function match() returns the offsets of entries in a vector that match a given object. But what exactly constitutes a match, well, according to help(match) that is "to some extent a matter of definition". It goes on to give an example or two, but that definition remains elusive. Or look at this gem from help(as.vector):

Value: For ?as.vector?, a vector (atomic or of type list). All attributes are removed from the result if it is of an atomic mode, but not in general for a list result. The default method handles 24 input types and 12 values of ?type?: the details of most coercions are undocumented and subject to change.

First, a "vector of type list" is actually just a list. In R, a vector is an ordered collection of elements all of the same type, while a list is an ordered collection of elements of (possibly) different types. So, by the normal Liskov rules, one could say that a vector is a kind of list in which the types of the elements are all identical. According to the R language definition however, a list is a kind of vector. In practice, lists and vectors are used in rather different ways so their exact relation is not so relevant, and it doesn't make much sense for the help page to throw them together like this. Second, apparently attributes are removed for atomic vectors, but not "in general" for lists. This is a somewhat arbitrary inconsistency, and it leaves the reader to wonder if there are specific attributes or lists for which this doesn't count. But the kicker is in the last sentence: not only are the exact workings of this function explicitly undocumented, they are also subject to change without notice! Note that these are not functions from some obscure package that I pulled off of somebodies blog. They are core language functions, and unfortunately these examples are not exceptional. A colleague of mine recently had his whole analysis suddenly return weird results after a routine update of an add-on package, because someone decided to swap the order of the longitude and latitude arguments to a function for no particular reason.

That's not to say that R is not usable, but in my opinion is is unsuitable for any kind of programming, and perhaps unsuitable for programmers. R is a powerful, extensible system for statistical analysis, with a command line interface. If you consider your text files with R code as reference notes rather than as source files, and if you use R interactively, copy-pasting lines from your notes and checking after every couple of operations that it's actually doing what you think it is, then you can do useful things with R. Looking around me, that is in fact how most people use it, and what I've taken to doing as well, although I can't resist attempting to automate things here and there.

Comparing R to Matlab, in my eyes there's no contest in terms of ease of use. The Matlab help files are professionally written and tell you what you need to know in enough detail to be useful, and that difference alone makes it a lot better. The language itself is also a bit more sensible, at least to me, being designed as an easier-to-use alternative to FORTRAN, where R is based on LISP. I was originally considering moving my course to R from Matlab, since I don't like to teach proprietary software, but now that I have some experience with R I'm pretty sure

Source: http://rss.slashdot.org/~r/Slashdot/slashdotScience/~3/l_mheHMKr7w/story01.htm

nfl scores Devon Walker Tom Cruise ryan reynolds Star Trek: The Original Series Carlton Morgan Freeman Dead

কোন মন্তব্য নেই:

একটি মন্তব্য পোস্ট করুন