swirl 4: Vectors

来源:互联网 发布:淘宝内衣真人秀图片 编辑:程序博客网 时间:2024/06/14 11:01

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.

0 0