无法将 WikipediaR 包对象转换为数据框
Unable to convert WikipediaR package object to dataframe
WikipediaR 包提供了一个很好的功能来列出页面的贡献者。
包配置
install.packages("WikipediaR")
library (WikipediaR)
正在收集贡献 R'page
contribs_r_page <- contribs(domain = "fr", page = "R")
问题:如何将我的对象 contribs_r_page 转换为 data.frame?
str (contribs_r_page)
List of 4
$ call : language contribs(page = "R", domain = "fr")
$ contribs :'data.frame': 219 obs. of 3 variables:
..$ user : Factor w/ 143 levels "0x010C","109.213.170.237",..: 87 73 121 9 121 64 11 81 47 121 ...
..$ userid : Factor w/ 111 levels "0","1017","1019240",..: 97 86 28 1 28 50 1 44 7 28 ...
..$ timestamp: Factor w/ 219 levels "2004-02-09T19:44:05Z",..: 219 218 217 216 215 214 213 212 211 210 ...
$ page : Named chr [1:3] "0" "50889" "fr"
..- attr(*, "names")= chr [1:3] "ns" "_idx" ""
$ testWikiPage:List of 4
..$ takeOnlyFirst: logi FALSE
..$ redirPage : NULL
..$ test : num 0
..$ warnMessage : NULL
- attr(*, "class")= chr "contribsClass"
我尝试了什么:
contribs_r_page_df <- as.data.frame.list (contribs_r_page)
从 str 输出我们可以看到 contribs_r_page
列表对象包含一个名为 contribs
的 data.frame,因此我们可以按如下方式访问它:
contribs_r_page$contribs
WikipediaR 包提供了一个很好的功能来列出页面的贡献者。
包配置
install.packages("WikipediaR")
library (WikipediaR)
正在收集贡献 R'page
contribs_r_page <- contribs(domain = "fr", page = "R")
问题:如何将我的对象 contribs_r_page 转换为 data.frame?
str (contribs_r_page)
List of 4
$ call : language contribs(page = "R", domain = "fr")
$ contribs :'data.frame': 219 obs. of 3 variables:
..$ user : Factor w/ 143 levels "0x010C","109.213.170.237",..: 87 73 121 9 121 64 11 81 47 121 ...
..$ userid : Factor w/ 111 levels "0","1017","1019240",..: 97 86 28 1 28 50 1 44 7 28 ...
..$ timestamp: Factor w/ 219 levels "2004-02-09T19:44:05Z",..: 219 218 217 216 215 214 213 212 211 210 ...
$ page : Named chr [1:3] "0" "50889" "fr"
..- attr(*, "names")= chr [1:3] "ns" "_idx" ""
$ testWikiPage:List of 4
..$ takeOnlyFirst: logi FALSE
..$ redirPage : NULL
..$ test : num 0
..$ warnMessage : NULL
- attr(*, "class")= chr "contribsClass"
我尝试了什么:
contribs_r_page_df <- as.data.frame.list (contribs_r_page)
从 str 输出我们可以看到 contribs_r_page
列表对象包含一个名为 contribs
的 data.frame,因此我们可以按如下方式访问它:
contribs_r_page$contribs