|
|
|
|
|
by DangerousPie
3778 days ago
|
|
I have my fair share of problems with R, but that first example (4 ways to select a column) seems a bit silly. Just off the top of my head, I could think of plenty of ways to do the same thing in Python/pandas: ice_cream.icol[0]
ice_cream['col']
ice_cream.iloc[:, 0]
ice_cream.loc[:, 'col']
ice_cream.ix[:, 'col']
And if you wanted to make things more convoluted, you could also wrap things into lists like the author did in the R example. So this is definitely not a problem that is unique to R or any reasonably flexible language. |
|
x$name syntax stems from data frames being really lists in disguise x[["name"]] ditto, plus because it's useful to access by string (see reflection in other languages)
x[,"name"] and x[,1] because we can also apply the matrix syntax to data frames