【发布时间】:2013-05-13 21:14:51
【问题描述】:
我想更改我的 R 函数的输出名称以反映输入的不同字符串。这是我尝试过的:
kd = c("a","b","d","e","b")
test = function(kd){
return(list(assign(paste(kd,"burst",sep="_"),1:6)))
}
这只是一个简单的测试功能。我收到警告(这对我来说同样是一个错误):
Warning message:
In assign(paste(kd, "burst", sep = "_"), 1:6) :
only the first element is used as variable name
理想情况下,我会得到 a_burst = 1、b_burst = 2 等输出,但还没有接近。
我想通过向量的内容拆分数据框,并能够根据该向量的名称命名所有内容,类似于
How to split a data frame by rows, and then process the blocks?
但不完全是。命名是必须的。
【问题讨论】:
标签: r split string-concatenation