How to find unique values in an array in R programming language?
In the R language, you can use the unique() function to find unique values in an array. An example is shown below:
# 创建一个包含重复元素的数组
arr <- c(1, 2, 3, 4, 1, 2, 5)
# 使用unique()函数查找唯一值
unique_values <- unique(arr)
print(unique_values)
After running the above code, the unique values in the array arr will be outputted.
[1] 1 2 3 4 5