R 从字符串执行命令
在r中使用scopus检索引用R 从字符串执行命令,r,scopus,R,Scopus,在r中使用scopus检索引用 library(rscopus) auth_token_header("please_add") akey="please_add" set_api_key(akey) x = abstract_retrieval("10.1109/TPAMI.2018.2798607", identifier= "doi") 执行此操作可以获取结果 x$content$`abstracts-retrieval-response`$`item`$bibrecord$tail$`
library(rscopus)
auth_token_header("please_add")
akey="please_add"
set_api_key(akey)
x = abstract_retrieval("10.1109/TPAMI.2018.2798607", identifier= "doi")
执行此操作可以获取结果
x$content$`abstracts-retrieval-response`$`item`$bibrecord$tail$`bibliography`$reference[[1]]$`ref-info`$`ref-title`
如果我们有以下情况,如何执行命令并获取结果:
a = 1
ref <- paste("x$content$`abstracts-retrieval-response`$`item`$bibrecord$tail$`bibliography`$reference[[",a,"]]$`ref-info`$`ref-title`")
a=1
ref您可以使用parse
和eval
:
eval(parse(text = "sum(1:10)"))
#[1] 55
虽然一般来说,你应该尝试重新制定你的问题,以避免不得不这样做
fortunes::fortune("parse")
#If the answer is parse() you should usually rethink the question.
# -- Thomas Lumley
# R-help (February 2005)
您可以将parse
与eval
一起使用:
eval(parse(text = "sum(1:10)"))
#[1] 55
虽然一般来说,你应该尝试重新制定你的问题,以避免不得不这样做
fortunes::fortune("parse")
#If the answer is parse() you should usually rethink the question.
# -- Thomas Lumley
# R-help (February 2005)
我同意@DiceboyT的观点,使用parse
常常充满危险(而且常常很难排除bug)。也许你可以退一步,解释一下为什么你想这样间接引用?也许有更好的方法来完成你需要的,用这种方法来解决你的问题。我同意@DiceboyT,使用parse
常常充满危险(而且常常很难排除bug)。也许你可以退一步,解释一下为什么你想这样间接引用?也许有更好的方法来完成你需要的,用这种方法来解决你的问题。