Try to set the drop argument.
df <- data.frame(col1 = sample(1:10, 50, replace = TRUE))
df[!duplicated(df$col1),,drop = FALSE]
#> col1
#> 1 4
#> 2 6
#> 3 3
#> 4 8
#> 5 9
#> 9 5
#> 10 10
#> 11 2
#> 16 1
If drop is TRUE the result is coerced to the lowest possible dimension, and TRUE is the default value.
And you also can use tidyversesfilter` function.
library(tidyverse)
df <- data.frame(col1 = sample(1:10, 50, replace = TRUE))
df %>% filter(!duplicated(.$col1))
#> col1
#> 1 3
#> 2 10
#> 3 4
#> 4 6
#> 5 2
#> 6 1
#> 7 9
#> 8 5
#> 9 8
#> 10 7