参数暗示迭代循环的行数不同

时间:2019-01-30 15:52:42

标签: r scopus

代码问题

将迭代循环的结果保存到整个数据帧问题中

library(rscopus)
library(dplyr)

auth_token_header("d2f02ad55dcfc907212f0e6b216bf847")

akey="d2f02ad55dcfc907212f0e6b216bf847"
set_api_key(akey)
df = data.frame(doi = c("10.1109/TPAMI.2018.2798607", "10.1109/CNS.2017.8228696"))

df_references <- NULL
for (i in 1:nrow(df)) {
     x = abstract_retrieval(df$doi[i], identifier= "doi")

     for (a in 1:length(x$content$`abstracts-retrieval-response`$`item`$bibrecord$tail$`bibliography`$reference)){
         call_str <- paste("ref <- x$content$`abstracts-retrieval-response`$`item`$bibrecord$tail$`bibliography`$reference[[",a,"]]$`ref-info`$`ref-title`")
         eval(parse(text = call_str))
         df_references <- rbind(df_references, data.frame(initial_paper = df$doi[i],
                                                          ref_title = ref))
     }
 }

我希望输出将每次迭代的结果保存到一个数据框中

0 个答案:

没有答案