0

enter image description here

I have this dataframe from quanteda corpora and I want to extract the information in year column under the documents. However when I type

data_corpus_irishbudgets$documents$year

it would just return NULL. Someone has any theory what might cause this?

r2evans
  • 141,215
  • 6
  • 77
  • 149
  • It's easier to help you if you include a simple [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input and desired output that can be used to test and verify possible solutions. It's possible that whatever type of object `data_corpus_irishbudgets` is has overloaded the `$` operator. Does maybe `data_corpus_irishbudgets@documents$year` work? – MrFlick Mar 04 '20 at 02:14
  • I solve the problem by changing quanteda from version 2.0.0 to 1.5.2. Also I didn't know why such change would make it work. I basic didn't try to anything here. I just download the document from quanteda.corpora and then run the above line. – GalaxyFox777 Mar 04 '20 at 02:47
  • 1
    *"just download the document"* ... which document? If downgrading from 2.0.0 to 1.5.2 solved the problem for you, then my first guess would be to look at the package [`NEWS`](https://cran.r-project.org/web/packages/quanteda/news/news.html) file. If you search for a `$`, you'll see *"New index operators for core objects. The main change here is to redefine the `$` operator for corpus"*, and then a link to https://github.com/quanteda/quanteda/wiki/indexing_core_objects which documents indexing options. I'm not a quanteda user, though, so perhaps it doesn't have all the answers ¯\\_(ツ)_/¯ – r2evans Mar 04 '20 at 04:08

0 Answers0