# How to Apply the drop() Function in R (Example Code)

In this R tutorial you’ll learn how to remove redundant dimension information using the drop function.

## Constructing Example Data

x <- matrix(letters[1:5], # Example matrix in R ncol = 1) x # Display matrix in RStudio console # [,1] # [1,] "a" # [2,] "b" # [3,] "c" # [4,] "d" # [5,] "e" |

x <- matrix(letters[1:5], # Example matrix in R ncol = 1) x # Display matrix in RStudio console # [,1] # [1,] "a" # [2,] "b" # [3,] "c" # [4,] "d" # [5,] "e"

## Example: Dropping Dimensions of Matrix Object Using drop() Function

drop(x) # Dropping dimensions # [1] "a" "b" "c" "d" "e" |

drop(x) # Dropping dimensions # [1] "a" "b" "c" "d" "e"