Vectors come in two different flavors: atomic vectors and lists.
所以list 也是vector的一种。
paste() Right now, my_char is a character vector of length 3. Let's say we want to join the elements of my_char together into one
| continuous character string (i.e. a character vector of length 1). We can do this using the paste() function.Type paste(my_char, collapse = " ")
Try paste("Hello",
| "world!", sep = " "), where the `sep` argument tells R that we want to separate the joined elements with a single space.
> paste(1:3, c("X", "Y", "Z"), sep = "")
[1] "1X" "2Y" "3Z"
LETTERS is a predefined variable in R containing a character vector of all 26 letters in the English alphabet.

本文介绍R语言中字符向量的操作方法,包括如何使用paste()函数将多个字符串元素合并为一个连续的字符串,并展示了如何指定分隔符来定制字符串的连接方式。
1183

被折叠的 条评论
为什么被折叠?



