logoalt Hacker News

rtpgtoday at 5:14 AM1 replyview on HN

do you have a snippet of what this looks like in R?


Replies

latent-persontoday at 5:49 AM

Not OP, but here is an example using tidyverse (I leave the meaning of it to you; should be clear without any R knowledge):

  purchases |>
    group_by(country) |>
    filter(amount <= median(amount) * 10) |>
    summarize(total = sum(amount - discount))