R: how to access a tibble in a tibble?

前端 未结 1 556
醉梦人生
醉梦人生 2021-01-21 09:10

I am reading Hadley\'s: http://r4ds.had.co.nz/tibbles.html

However, I am still having difficulty referencing a tibble in a tibble.

> library(tidyquant         


        
相关标签:
1条回答
  • 2021-01-21 09:59

    From tidyquant's documentation, using tq_get(symbol, get = "key.ratios") returns a nested tibble. Inside the tibble's "data" column are other tables with columns: section, sub.section, group, category, and date.

    You were originally trying to access a column called "Financials" in the main data frame, but no such column exists (it has only "section" and "data"). "Financials" is, instead, an element (row) of the "section" column. I think instead you want:

    filter(f, section == "Financials") %>% unnest()
    
    0 讨论(0)
提交回复
热议问题