5

Recently the question Take paired differences of pairs of rows asked about obtaining pairwise squared differences from numbers in a data set in R. What got my attention about this question was that although the task to be performed and the desired output were clearly stated (with both a written description and properly formatted code), the asker hadn't included any specific attempts at actually solving the problem.

While I know that not every question requires a long list of failed attempts [!], the ones that don't usually tend to be more on the conceptual side, or else asking about a specific API which is lacking in documentation. (Or else, they usually at least explain why the specific task is difficult to accomplish.) But, this question didn't seem to fall into any of those categories.

I instantly (unfairly, as it turns out) dismissed it as a "do my homework" type question, and without further consideration, flagged it as "Needs debugging details."

The question was actually a +9 score known-good question, which has received multiple high quality answers. I'll admit to being surprised, because usually high-quality new questions look more "complex," while highly upvoted "simple" questions tend to be older, from back when the site was still building a base of FAQs.

Since I was obviously mistaken about the question's quality, I've since upvoted it (it's neat to be able to give a new user their first Nice Question badge). But now I'm wondering if there's something different about R that makes accomplishing this kind of task more difficult than in the languages I'm familiar with.

What makes this kind of task so difficult to accomplish in R?

11
  • 1
    I mean hey, if it gets downvotes, it gets downvotes because others are evaluating it. That's always going to be a factor of the site and while the Meta Effect is real, trying to dodge it can cause you to sacrifice much needed context when asking about a question on the main site.
    – Makoto
    Commented Nov 28, 2023 at 21:58
  • @Makoto Point taken. I had posted the link in a comment instead of the main question so that it wouldn't be permanently tied to the revision history, but are you saying it should go in the question after all? The level of analysis given in the accepted answer, plus the positive reception to both the question and all 5 answers, have fully convinced me that the question is in fact a good one. But, I was concerned others might react to it the same way I did before looking more closely. Commented Nov 28, 2023 at 22:01
  • 2
    Well now that I can actually see the question, it has a certain texture to it...like I've chewed on something like this before...
    – Makoto
    Commented Nov 28, 2023 at 22:12
  • @Makoto Interesting! That discussion seems to have led to the opposite conclusion, though. Python is a more straightforward programming language than R by all appearances. Is it possible that the R question has some non-obvious challenge to it that the general viewer would miss? Otherwise, it seems like my question should be closed as a duplicate of yours, but I don't think the question/highest answer would have gotten into the double digits if it didn't have some merit? Commented Nov 28, 2023 at 22:20
  • 1
    Your "update" edit to the question would work much better as a separate answer, IMO. Commented Nov 29, 2023 at 1:01
  • why does your title ask a completely question than the one in your question body? your title question sounds like a dup of meta.stackoverflow.com/a/260909/11107541
    – starball
    Commented Nov 29, 2023 at 2:57
  • @starball It's not the original title. At first it was specifically about R, but I changed it when that turned out not to be relevant. What would you suggest for a better title? Commented Nov 29, 2023 at 3:05
  • 3
    It is not necessary to show an attempt. A "failed attempt" isn't relevant & shouldn't be there unless it "failed" only in that although it is not the solution it is some likely relevant part of it. Code that doesn't do what the poster expects should be asked about separately. To the extent that a question post has such irrelevant bad code it isn't a "good" question--despite people tolerating such irrelevant content. Lack of research effort merits downvoting & doesn't merit close voting.
    – philipxy
    Commented Nov 29, 2023 at 4:21
  • Your title "Known good question does not include evidence of attempt to solve - why doesn't it need debugging details?" was not your body question. The body question is a recent edit. Please don't change a question in a way that invalidates reasonable posted answers. Please edit this to make a consistent post asking 1 question that is consistent with the answers.
    – philipxy
    Commented Nov 29, 2023 at 4:56
  • 1
    Giving an upvote here as this question is a fair attempt at understanding a failed audit, and, given the answers, seems a good addition as reference
    – Tensibai
    Commented Nov 29, 2023 at 14:04
  • I think I would rephrase as that a failed attempt is too specific a demand. What questions need is context. A failed attempt might be what is needed, depends on the question being asked. In my experience slithering around on meta, there are particular languages or tools where people are more inclined to think from specs rather than code and code would just be a distraction. R being a prime example. Such questions will look like homework dumps, which will trigger shooting from the hip if reviewed generically. Myself, I admit I don't speak the language, so I don't even try to translate.
    – Gimby
    Commented Nov 30, 2023 at 12:36

2 Answers 2

11

What makes this kind of task so difficult to accomplish in R?

This is fundamentally the wrong meta question. There is not a lower bound on question difficulty here. There is, instead, a lower bound on detail, explicitness and clarity, and an upper bound on the number of questions in a question post (one, but with some wiggle room for things that really can't meaningfully be considered independently).

There was a question asked recently about obtaining pairwise squared differences from numbers in a data set in R. What got my attention about this question was that although the task to be performed and the desired output were clearly stated (with both a written description and properly formatted code), the asker hadn't included any specific attempts at actually solving the problem.

While I know that not every question requires a long list of failed attempts [!], the ones that don't usually tend to be more on the conceptual side, or else asking about a specific API which is lacking in documentation. (Or else, they usually at least explain why the specific task is difficult to accomplish.) But, this question didn't seem to fall into any of those categories.

No question requires a long list of failed attempts. In fact, most "failed attempts" are noise that should be edited out, except insofar as they actually clarify the question.

It's important to understand that researching a question is absolutely not about "deserving" an answer. It is about making sure that the resulting question meets standards. Absolutely nothing to do with this process is about the person who asked; it is only about the question itself.

Nearly all questions fall into two fundamental categories: "What is wrong with the code I tried?" and "How do I perform this task?" Only the former category requires even one failed attempt - because the question is about the failed attempt. But the latter are fully complete, useful and up-to-standard as long as they:

  • Are clearly stated, on-topic and not a duplicate (as usual)

  • Are demonstrably about one task, that does not have an obvious decomposition into separate steps that could be asked about (unless OP has already solved it that way and is looking for a more "direct" or "built-in" way, and has reasonable ground to expect that one exists)

  • Give a clear specification of the task, including a precise input (in a reasonable format, such that "make sense of the input" isn't a separate step) and corresponding output. (For a computational task like this one, that just means getting a sensible data structure within the program's memory; if OP is looking to format displayed output in a specific way, that is generally a separate step, but that part can usually just be edited to make the focus problem go away.)

OP here is asking to compute pairwise squared differences from some iterable. The question has some irrelevant detail, in that the problem is specifically about applying the computation to prices that come from a larger data set - the rest of the data is irrelevant. Someone with subject matter expertise in R should be able to edit the example to be properly minimal, but that's detailed polishing that's well above the minimum standard for questions.

OP already knows how to compute the squared difference between two values (unsurprisingly), so the question is really about one specific thing: how to consider the values pairwise and apply that calculation logic to each pair. I imagine that it should be fairly easy in R to write an explicit loop and do this imperatively, but this is also the exact sort of task where people who use languages like R (or Python, for example) reasonably expect a higher-level solution built in.

It's also noteworthy that "pairwise" has two meaningful interpretations: considering adjacent pairs (first and second values, third and fourth, fifth and sixth, etc.) or overlapping pairs (first and second, second and third, third and fourth, etc.). In this case, OP clearly means the former, and has clearly expressed that by showing both a calculation and an expected output that corresponds to the sample input. Bravo.


So in my mind, the only remaining question is where this is really a duplicate of some more abstractly asked R question about applying a calculation to adjacent pairs. I don't know much more about R than the fact that it exists, but for Python I could easily dupe-hammer these kinds of questions - so I'll explain how I do it, in case an R expert is lurking and knows of analogous Q&A.

In particular: for Python, I would be able to point at How to iterate over a list in chunks for the adjacent-pair problem. Conceptually, the problem boils down to obtaining the adjacent pairs, so that the calculation can be applied. In Python, once you have an iterator that gives you adjacent pairs, applying the calculation is trivial and there are a couple of standard ways to do it. That also gets asked about a lot (or rather, beginners have debugging questions related to horribly wrong attempts), and I didn't like any of the canonicals for the "apply the calculation" part in the long run because none of them really had the right focus - so I wrote my own.

Meanwhile, for the overlapping pair problem, that is covered by How can I iterate over overlapping (current, next) pairs of values from a list?, or more generally Rolling or sliding window iterator? (considering more than two elements at a time; the case of a small, specific number of elements allows for additional approaches that might be considered simpler or more elegant). Again, applying the calculation to the resulting pairs can be considered a separate problem in Python. But for all I know, they could be fundamentally inseparable in R. If they are separable, it comes across to me like the question could be focused on the iteration part, since again OP already knows how to do the per-element calculation. (Looking at the R answers already given, I get the general impression that the collection step can't really be separated out as easily as it would be in Python.)

7
  • Thank you for confirming that this is in fact a worthwhile question, and for explaining why. Given that this question is a review audit, this is exactly the kind of answer I was looking for. Commented Nov 28, 2023 at 22:34
  • 2
    It took the community as a whole a fair while to actually sort out these issues and really understand the goals of the site and how policy works towards those goals. Even then, only a small cadre of people who look at Meta really understand it, and there's still considerable room for disagreement. There is also a lot of outdated information out there, which in turn derives from really old mindsets. Commented Nov 28, 2023 at 22:38
  • 4
    The "What have you tried?" attitude dates back at least to Usenet, and might be even older than computing - and it was meant as a filter because these communities couldn't handle being swamped with newbies. But a site the size of Stack Overflow really doesn't have a choice. More importantly, Stack Overflow tried a fundamentally new format that turned out to have different needs - and these needs were an unknown unknown for years. Which is why the advice at How much research effort is expected of Stack Overflow users? is fragmented. Commented Nov 28, 2023 at 22:39
  • Just realized that the usage of "this" in my earlier comment was ambiguous. "Confirming that [the original audit question] is in fact worthwhile/a good audit" would have been more clear. Commented Nov 29, 2023 at 1:44
  • related: meta.stackoverflow.com/a/426359/11107541
    – starball
    Commented Nov 29, 2023 at 3:29
  • 1
    re "general impression that the collection step can't really be separated out": yes, R is a really a vectorised language at root and creating loops is often a bad idea (often as there's obviously exception to that). Kudos for this meta answer taking a higher view around the question format in itself :)
    – Tensibai
    Commented Nov 29, 2023 at 13:55
  • Could you reduce the amount of bold you use, it is very distracting and makes your answer harder to read. Commented Nov 30, 2023 at 8:16
7

In its original form, my Meta question has proven to be not very useful, as it was based on the mistaken assumption that the value of the audit question under discussion was in demonstrating some hidden difficulty relating to the R programming language. This is not the case.

Instead, based on the accepted answer to my question, I realize I may have been habitually misusing the "Needs Debugging Details" flag in the Triage queue.

I had been under the impression that this flag was applicable to all questions which are practical (i.e. asking about specific code, not concepts), which ask how to perform a specific and well-defined task having a straightforward solution, and do not demonstrate any of the following:

a) A non-working code attempt
b) Mention of places the asker has looked for answers (and not found any)
c) Some specific difficulty encountered in accomplishing the task (not necessarily requiring a code example)

This is not actually the case, and as the answer to this question states, a well-asked question about a specific coding task can be valuable (and possibly better off) without including any of the above. Categorically, and not specific to this particular linked question (or the R programming language), this kind of question should be reviewed as "Looks OK" (unless it is a clear duplicate).

Based on this feedback, I will be using "Needs Debugging Details" much less frequently in the future.

5
  • 2
    I'd suggest that you read meta.stackoverflow.com/q/417476/11107541 and the very first sentence of stackoverflow.com/help/minimal-reproducible-example, with emphasis on "when". Also the first sentence of stackoverflow.com/help/how-to-ask at the section under "Help others reproduce the problem"
    – starball
    Commented Nov 29, 2023 at 3:40
  • 5
    @starball "The question must primarily be about debugging code or determining why a specific behavior is happening" in order for the close reason to apply -- that's very helpful, as it excludes that flag being an option for anything that isn't specifically a debugging question, which the audit question wasn't. That would only have left "Needs details or clarity," which obviously doesn't apply either, as the question is perfectly clear. So, that definitely leads to "Looks OK." Commented Nov 29, 2023 at 3:56
  • Others disagree, but: The empty program is a debugging exercise & so it needs a [mre]. Note that a [mre] for debugging the empty program is not itself the empty program.
    – philipxy
    Commented Nov 29, 2023 at 4:32
  • @philipxy There's no "empty program" as The last sentence clearly explain what the OP has tried to achieve the problem with no satisfying solution. It's feature complete regarging [how-to-ask] IMHO. Then there's a mre (minimum reproducible exemple) as there's an input, desired computation in middle and expected output. Just the line "diff = (79-84)^2 , (36-34)^2, (21-12)^2 " is a program brute forcing the desired result
    – Tensibai
    Commented Nov 29, 2023 at 14:02
  • @Tensibai The empty program does nothing. And that's as far as a programmer has got when they dump a specification. But the program doesn't meet the specification. So it needs debugging.
    – philipxy
    Commented Nov 29, 2023 at 14:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .