这是一个示例数据集:
data <- data.frame (author = c('bob', 'john', 'james'),
year = c(2000, 1942, 1765),
title = c('test title one two three',
'another test title four five',
'third example title'))
Run Code Online (Sandbox Code Playgroud)
我想自动化制作bibtex引用的过程,例如使用这样的函数:
bibtexify <- function (author, year, title) {
acronym <- convert.to.acronym(title)
paste(author, year, acronym, sep='')
}
Run Code Online (Sandbox Code Playgroud)
这样我得到以下结果:
with(data, bibtexify(author, year, title))
[1] 'bob2000tto'
[2] 'john1942att'
[3] 'james1765tet'
Run Code Online (Sandbox Code Playgroud)
可以在R中这样做吗?
谢谢!
你要 abbreviate
R> abbreviate('test title one two three')
test title one two three
"ttott"
Run Code Online (Sandbox Code Playgroud)