szymanskir / hackeRnews

An R wrapper for the official Hacker News API. https://szymanskir.github.io/hackeRnews/
Other
23 stars 2 forks source link

Remove tibble::as_tibble to reduce dependencies #29

Open MarcinKosinski opened 3 years ago

MarcinKosinski commented 3 years ago

Follw-up on #28

Frankly I do believe that tibble (or anything from the tidyverse) this is too heavy dependency to have it in the package just for for function. I would recommend removing tibble and as_tibble from the package at all. It is used by get_comments - this could just return a data.frame.

szymanskir commented 3 years ago

Hello again @MarcinKosinski, congratulations on creating the first open source issue (a hat-trick of first open source issues to be exact :confetti_ball: )

You touched uppon a subject that I have been thinking about for quite a while now and I agree that importing tibble for just as_tibble is a bit of an overkill. The original reason for adding it was the default formatting of the tibble. The content of the hackeRnews comments results in the data.frame printing in a horrendus manner (provided example at the end, the markdown provides a horizontal scroll but in the rstudio console the result is even worse).

I guess the optimal approach would be to return a data.frame and leave it up to the user to cast it to a tibble and add explicit casts in the examples with a comment that it the casting is used merely for pretty printing.

I am also open to other ideas :smiley:

library(hackeRnews)

best_story <- get_best_stories(max_items = 1)[[1]]
comments <- get_comments(best_story)
#> Warning: `as.tibble()` is deprecated as of tibble 2.0.0.
#> Please use `as_tibble()` instead.
#> The signature and semantics have changed, see `?as_tibble`.
#> This warning is displayed once every 8 hours.
#> Call `lifecycle::last_warnings()` to see where this warning was generated.
comments_df <- as.data.frame(comments)

head(comments_df)
#>         id deleted          by                time
#> 1 24471372   FALSE      DCKing 2020-09-14 17:33:57
#> 2 24471586   FALSE    klelatti 2020-09-14 17:51:10
#> 3 24472003   FALSE      DCKing 2020-09-14 18:24:56
#> 4 24475500   FALSE a1369209993 2020-09-14 23:45:36
#> 5 24481308   FALSE    phkahler 2020-09-15 16:06:06
#> 6 24484150   FALSE    klelatti 2020-09-15 19:39:21
#>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   text
#> 1 This is terrible. Not really just because of Nvidia - which has a lot of problems I&#x27;ve previously commented on the rumors of this [1] - but Nvidia&#x27;s ownership completely changes ARM&#x27;s incentives.<p>ARM created a business model for itself where they had to act as a &quot;BDFL&quot; for the ARM architecture and IP. They made an architecture, CPU designs, and GPU designs for others. They had no stake in the chip making game, and they had others - Samsung, Apple, Nvidia, Qualcomm, Huawei, Mediatek, Rockchip and loads of others make the chip. Their business model was to make the ARM ecosystem accessible for as many companies as possible, so they could sell as many licenses as possible. In that way, ARM&#x27;s business model enabled a very diverse and thriving ARM market. I think this is the <i>sole</i> reason we see ARM eating the chip world today.<p>This business model would continue to work perfectly fine as a privately held company, or being owned by a faceless investor company that wants you to make as much money as possible. But it&#x27;s not fine if you are owned by a company that wants to use you to control their own position in the chip market. There is no way Nvidia (any other chip company, but as laid out previously Nvidia might even be more concerning) will spend 40 billion on this without them deliberately or inadvertently destroying ARM&#x27;s open CPU and GPU ecosystem. Will Nvidia allow selling ARM licenses to competitors of Nvidia&#x27;s business? Will Nvidia reserve ARM&#x27;s best IP as a selling point for its own chips? Will Nvidia allow Mali to continue existing? Any innovations ARM made previously it sold to anyone mostly indiscriminatorily (outside of legal restrictions), but now every time the question must be asked &quot;does Nvidia have a better propietary purpose for this?&quot;. For any ARM chip maker the situation will be that Nvidia is both your ruthless competitor, but it also sells you the IP you need to build your chips.<p>EDIT: ARM&#x27;s interests up to last week were to create and empower as many competitors for Nvidia as possible. They were good at that and was the root of the success of the ARM ecosystem. That incentive is completely gone now.<p>Unless Nvidia leaves ARM alone (and why would they spend $40B on that??), this has got to be the beginning of the end of ARM&#x27;s golden age.<p>[1]: <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=24010821" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=24010821</a>
#> 2                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     Precisely, plus just consider the information that Nvidia will have on all its competitors who use Arm IP.<p>- It will know of their product plans (as they will need to buy licenses for new products).<p>- It will know their sales volumes by product (as they will need to pay fees for each Arm CPU sold).<p>- If they need technical help from Arm in designing a new SoC then the details of that engagement will be available to Nvidia.<p>How does this not give Nvidia an completely unfair advantage?
#> 3                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          I wouldn&#x27;t use the term &quot;unfair&quot; here. There&#x27;s also just three x86 licensees in the world and people don&#x27;t usually consider that an affront. You buy, you control, that&#x27;s how the world works.<p>But I do think it&#x27;s important that we recognize that we&#x27;re going from a position of tremendous competitiveness to a much less competitive situation. And that will be a situation where ARM will be tightly controlled and much less inducive to the innovation we&#x27;ve seen in the last years.
#> 4                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      &gt; There&#x27;s also just three x86 licensees in the world and people don&#x27;t usually consider that an affront.<p>Hi! Counterexample here.
#> 5                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    I dont even think this is about CPUs. This purchase is consolidation of two GPU companies. I&#x27;ve said it before, as Risc-V further commoditizes CPUs, the differentiator will be who has graphics. In that light, this is pure consolidation.
#> 6                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                I have a lot of respect for RISC-V but I really struggle with an unqualified statement that RISC-V &quot;is&quot; commoditising CPUs in a meaningful way when there are basically no mobile, desktop or server chipsets with a meaningful presence in the market.  All that may change over the next 10 years but who knows? For now x86 is dominant on servers and Arm in mobile.<p>In reality Arm commoditised in many markets CPUs by making reasonable designs available to all at reasonable cost, keeping control over the ISA and allowing firms to innovate in their implementations. You can have the same code running on a Raspberry PI, an iPhone and a 64 core Graviton2 server.<p>The Nvidia takeover threatens all this by giving control to a firm who could well &#x27;unlevel&#x27; the playing field and even refuse to offer the latest IP to competitors.<p>RISC-V may provide a way out for firms unhappy with Nvidia but it could be a bumpy path. And its certainly not the case that Nvidia are paying $40bn to consolidate Mali with their own graphics IP.
#>    dead   parent
#> 1 FALSE 24464807
#> 2 FALSE 24471372
#> 3 FALSE 24471586
#> 4 FALSE 24472003
#> 5 FALSE 24472003
#> 6 FALSE 24481308

Created on 2020-09-15 by the reprex package (v0.3.0)

MarcinKosinski commented 3 years ago

@szymanskir you can either provide a new class for this table and a new print that would trim the text column for printing, or you can leave it as data.frame and use tibble only in examples - that would be moved from imports to suggests making package less heavier