简体   繁体   English

从 R 包的描述中读取 Authors@R 字段作为向量

[英]Read Authors@R field from DESCRIPTION of R package as vector

How can I read Authors@R field from DESCRIPTION file as vector?如何从DESCRIPTION文件中读取Authors@R字段作为矢量?

> packageDescription("dplyr")$`Authors@R`
[1] "\n    c(person(given = \"Hadley\",\n             family = \"Wickham\",\n             role = c(\"aut\", \"cre\"),\n             email = \"hadley@rstudio.com\",\n             comment = c(ORCID = \"0000-0003-4757-117X\")),\n      person(given = \"Romain\",\n             family = \"François\",\n             role = \"aut\",\n             comment = c(ORCID = \"0000-0002-2444-4226\")),\n      person(given = \"Lionel\",\n             family = \"Henry\",\n             role = \"aut\"),\n      person(given = \"Kirill\",\n             family = \"Müller\",\n             role = \"aut\",\n             comment = c(ORCID = \"0000-0002-1416-3412\")),\n      person(given = \"RStudio\",\n             role = c(\"cph\", \"fnd\")))"

We may wrap with eval(parse as it returns a string我们可以用eval(parse因为它返回一个字符串

eval(parse(text = packageDescription("dplyr")$`Authors@R`))

ie if we check with cat即如果我们检查cat

cat(packageDescription("dplyr")$`Authors@R`)

    c(person(given = "Hadley",
             family = "Wickham",
             role = c("aut", "cre"),
             email = "hadley@rstudio.com",
             comment = c(ORCID = "0000-0003-4757-117X")),
      person(given = "Romain",
             family = "François",
             role = "aut",
             comment = c(ORCID = "0000-0002-2444-4226")),
      person(given = "Lionel",
             family = "Henry",
             role = "aut"),
      person(given = "Kirill",
             family = "Müller",
             role = "aut",
             comment = c(ORCID = "0000-0002-1416-3412")),
      person(given = "RStudio",
             role = c("cph", "fnd")))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM