gpt4 book ai didi

r - 如何将引用列表转换为数据框?

转载 作者:行者123 更新时间:2023-12-01 08:45:04 25 4
gpt4 key购买 nike

我有一个引用列表,例如,

references <- c(
"Dumitru, T.A., Smith, D., Chang, E.Z., and Graham, S.A., 2001, Uplift, exhumation, and deformation in the Japanese Mt Everest, Paleozoic and Mesozoic tectonic evolution of central Africa: from continental assembly to intracontinental deformation: Journal of Neverland, v. 3, no. 192, p. 71-199.",
"Dumitru, T.A., Smith, D., Chang, E.Z., and Graham, S.A., 2001, Uplift, exhumation, and deformation in the Japanese Mt Everest, Paleozoic and Mesozoic tectonic evolution of central Africa: from continental assembly to intracontinental deformation: Journal of Neverland, no. 3.",
"Dumitru, T.A., Smith, D., Chang, E.Z., and Graham, S.A., 2001, Uplift, exhumation, and deformation in the Japanese Mt Everest, Paleozoic and Mesozoic tectonic evolution of central Africa: from continental assembly to intracontinental deformation: Journal of Neverland, p. 71-199."
)

我试过 (?<=:)(?.*)(?=(v\.)|(no\.)|(p\.))但正则表达式返回“从大陆组装到陆内变形:梦幻岛杂志,v. 3, no。 192,页。不是我打算提取的。

(?<=:)(?:[^:].*?)(?=(, v\.)|(, no\.)|(, p\.))

我期待的是“梦幻岛日志”,但回归是“从大陆组装到大陆内变形:梦幻岛日志”

最佳答案

这里我们只是匹配捕获组中最后一个冒号之前的文本到下一个逗号

stringr::str_match(references, ": ((?!:)[^,:]*),")[,2]
# [1] "Journal of Neverland" "Journal of Neverland" "Journal of Neverland"

关于r - 如何将引用列表转换为数据框?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56245545/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com