Pandas like features

bachmeier no at spam.net
Fri Nov 13 22:59:23 UTC 2020


On Friday, 13 November 2020 at 21:28:30 UTC, data pulverizer 
wrote:

> You act as if I'm banning people from writing code in R - I 
> certainly don't have the power to do that. And yes, it varies 
> from situation to situation, as I clearly eluded to.

All I'm saying is that any project that interoperates with R or 
any other language has to accept that the programmers you're 
targeting are going to write code in the other language. If for 
no other reason than the fact that they've already written tens 
of thousands of lines of code that they don't want to throw away.

> I've done a lot of projects in R. I'm well aware that sometimes 
> it is unavoidable for the client. What I am saying is given the 
> choice, you should probably choose a different tool apart from 
> "some minor instances". I've seen R go spectacularly wrong 
> because of the type of language it is, it makes assumptions of 
> that the programmer means which can cause epic bugs, and very 
> often, it does it silently and it happens all the time. You can 
> never be sure that *any* piece of R code will work as it 
> should. It's just the nature of the language.

Well, I don't want to get into a big debate about R, but I don't 
for the most part agree with this view. R was designed to be used 
as (1) a functional language, and (2) a specialized tool to 
quickly solve a specialized set of problems. It's remarkably 
difficult to write incorrect code if you're using it as it was 
designed to be used, which includes pure functions and immutable 
data structures. It originated as a dialect of Scheme and that's 
the foundation everything is built on.

Where I do agree with you is the type system. Not only is it a 
dynamic language, it has an extremely weak type system, which 
most likely has something to do with the fact that it originated 
down the hall in the same place that gave us C. I nonetheless 
don't agree with the conclusion that it should never be used. 
I've seen loads of R criticism, and it's almost always something 
like this. Here's one I've probably seen 50 times:

x <- 1:10
j <- 4
x[2:3+j]

The code returns [6 7]! It should obviously return [2 3 4 5 6 7]! 
R is trash!

That's nonsense. Operators have precedence in every language. The 
critic would have gotten the "correct" answer with x[2:(3+j)]. No 
language is going to work if you don't understand operator 
precedence. Another is that x[-1] drops the first element. If you 
come from another language, that might not be what you expect. If 
you come from a language that forbids negative index values, you 
might even think this makes R unusable. Honestly, the vast 
majority of R critiques are not different from the folks that 
post here about how D does things wrong because it's different 
from C++ or Python or whatever language.


More information about the Digitalmars-d mailing list