4 ms·
One common thing across most the "real" programming languages makes them unfit for data work: 0-based indexing. It is just ridiculous to call the first row in
by educationdata 8y ago
One common thing across most the "real" programming languages makes them unfit for data work: 0-based indexing.
It is just ridiculous to call the first row in a data set as 0th row, and the last row as (n-1)th row. It does not make any sense for data analytic work.
- bograt 8y agoI'm not sure I understand this, and I'm genuinely interested in why it would be. I find zero indexing logical: zero is the first natural number and is thus a fine candidate for being the first ordinal. In my experience most mathematical series lose nothing in terms of elegance or readability by being indexed from zero instead of using more traditional indexing from one.
- goatlover 8y agoYou find zero indexing logical most likely because you learned programming on languages which are zero-based. But most of the rest of the population, including statisticians, for which R is the intended audience, likely start at one and aren't used to OB1 errors.
- newen 8y agoIt seems needlessly confusing to me to refer to the first number in a series as the 0th number. 0-based indexing is only good for offset counting, which is very much based on having a mental model based on pointer arithmetic for a number sequence.
- samatman 8y agoWhich years are in the decade the Twenties?
- newen 8y agoYeah years start at 0. But that's because it measures the offset from the beginning of the calendar. You can similarly expand this to all distance based measurements. But that is completely different from counting, which shouldn't be conflated with distances. People always say the first of some sequence and only people who care about 0-based indexing tries to spread the 0th of some sequence meme.
- ako 8y agoWhich days are in a Month? You dont start with june 0th and end with june 29th?
- samatman 8y agoI would if I could!
- samatman 8y agoI may as well amuse myself here: My ideal calendar has 12 30 day months, days 0 to 29. If it's 10th June and you have an appointment for 0 August, that's 50 days from now. At the end of the year, a 5 or 6 day 'month' called Holiday. 30th December becomes Christmas Day (observed) and 0 January is still New Years. New Years Eve is either 5 or 6 Holiday. 6 Holiday would be a lot of fun. ^_^
- tnecniv 8y agoGenerally I've found you carry around fewer n +/- 1 type expressions when you index from 1. Also, most applied math papers I've read index from 1 and that makes implementing them a lot easier.
- Sean1708 8y ago> Generally I've found you carry around fewer n +/- 1 type expressions when you index from 1. I've actually found the opposite, though admittedly it doesn't come up often enough to be a major nuisance.
- dnautics 8y agoGenerally 1 is considered the first natural number, except bourbaki. The reason for this is the set {1...n} has order n, but the set {0...n} has order n+1, so you get lots of off by n+1 inelegancies or errors when order is important. It's better to be explicit at the set level when you need an {0...n-1} set, because usually the order gets passed around to later expressions and not the set element, so there's less algebra. Zero indexing is great when your index is an offset, as it is for true arrays.
- webelo 8y agoI think this comment reflects the fact that a lot of pen and pencil linear algebra/stats/econometrics all uses one-based indexing. There are a few times where I’ve had to formally write out a zero-based indexing scheme of a given expression because python indexing can seem so weird in this case. For example, “lag zero” just sounds like a funny way of talking about lag 1 (to me). Of course, if you’re predicting y_t+1 then it sort of makes sense that y_t[+0] would be paired with B_0. Then there is the whole thing about how, say, range(5) will return 0,1,2,3,4 and NOT 5. All of this makes sense once you use python for a while but if you spend most of your time writing with pencil then it will probably take some adjustment.
- tincholio 8y agoI'll just leave this here... https://www.cs.utexas.edu/users/EWD/transcriptions/EWD08xx/EWD831.html https://www.cs.utexas.edu/users/EWD/transcriptions/EWD08xx/E...