show unique R

# Create a vector with duplicate values
vector <- c(1, 2, 3, 4, 2, 3, 1, 5, 6, 5)

# Use the unique function to obtain unique elements
unique_elements <- unique(vector)

# Display the unique elements
print(unique_elements)

Explanation: 1. Create a Vector: A vector named vector is created using the c() function, containing multiple numeric values, including duplicates. 2. Use unique Function: The unique() function in R is applied to the vector to extract only the unique elements from it. 3. Store Unique Elements: The unique elements obtained from the unique() function are stored in a new variable called unique_elements. 4. Display Unique Elements: The print() function is used to display the unique elements extracted from the original vector.