0

我正在尝试使用 Quanteda 的文本文件包装器在以下链接中读取 JSON :

我的代码如下:

textfile("20070101-20080214_ehfdpezgqg_2007_01_01_00_00_activities.json",
     textField = "body")

但是当我运行它时,我得到以下错误,尽管链接文件是 Twitter JSON。

Error in data.table::rbindlist(lapply(lines, function(x)     jsonlite::fromJSON(x,  : 
  Column 3 of item 1 is length 19, inconsistent with first column of that    item which is length 1. rbind/rbindlist doesn't recycle as it already expects     each item to be a uniform list, data.frame or data.table
In addition: Warning messages:
1: In doTryCatch(return(expr), name, parentenv, handler) :
Doesn't look like Tweets json file, trying general JSON
2: In if (e == paste("There is no field called", textField, "in file",  :
the condition has length > 1 and only the first element will be used
3: In value[[3L]](cond) :
File doesn't contain a single valid JSON object, trying line-delimited json

我已经阅读了 Quanteda 的文档,这里发生的事情有点不透明。我可以使用常规的 R JSON 阅读器阅读此文件,但我想以“Quanteda 方式”阅读它。

4

0 回答 0