In R, vectors can be created using the c() function, which combines individual elements into a vector. For example, to create a numeric vector, you can use the following syntax: my_vector <- c(1, 2, 3, 4, 5). Similarly, you can create character vectors by inputting strings instead of numbers, like this: my_vector <- c("apple", "banana", "cherry"). Vectors can also be created using the seq() function to generate sequences of numbers or the rep() function to repeat elements within the vector. Overall, vectors are an essential data structure in R for storing and manipulating values of the same data type.
This mind map was published on 15 May 2024 and has been viewed 84 times.