gpt4 book ai didi

r - 用 R 创建一个连续的字母列表

转载 作者:行者123 更新时间:2023-12-03 08:35:47 28 4
gpt4 key购买 nike

我希望能够在 R 中创建一个字母序列(以帮助从 SPSS 文件导入数据)

创建一个数字序列非常容易,例如:

seq(1,1000)
[1] 1 2 3 4 5 6 ... 1000

paste("something_",1:12,sep="")
[1] something1 something2 ... something12

但是是否有任何功能可以附加、粘贴或创建这样的字母序列?
paste("This_",a:z,sep="")
[1]This_a This_b This_c ... This_4z

提前致谢!

最佳答案

这就是你要找的:

> paste("This_", letters, sep="")

> [1] "This_a" "This_b" "This_c" "This_d" "This_e" "This_f" "This_g" "This_h"
[9] "This_i" "This_j" "This_k" "This_l" "This_m" "This_n" "This_o" "This_p"
[17] "This_q" "This_r" "This_s" "This_t" "This_u" "This_v" "This_w" "This_x"
[25] "This_y" "This_z"

关于r - 用 R 创建一个连续的字母列表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1439513/

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