## What is an R Vector?

a) A basic data structure that stores elements of the same type

b) A collection of matrices

c) A type of data frame

d) A method for visualizing data

### Answer:

a) A basic data structure that stores elements of the same type

### Explanation:

A vector in R is a basic data structure that stores elements of the same type. Vectors are commonly used to store numerical, character, or logical data. They can be created using the `c()`

function, which combines elements into a vector.

```
# Creating a numeric vector
numeric_vector <- c(1, 2, 3, 4, 5)
# Creating a character vector
char_vector <- c("apple", "banana", "cherry")
# Creating a logical vector
logical_vector <- c(TRUE, FALSE, TRUE)
```

In this example, three types of vectors are created: numeric, character, and logical. All elements in a vector must be of the same type, making vectors a simple yet powerful tool for storing and manipulating data in R.

Vectors are fundamental in R programming and are used extensively in data analysis, statistical modeling, and mathematical computations.