-2

May Know what know is there in the below code. I am trying to extract distinct values of Species under iris but not getting . I am trying to code without %>%

iris[,c(distinct("Species"))]
imran p
  • 332
  • 2
  • 12

2 Answers2

0

I am guessing you want to do this:

library(dplyr)    
distinct(iris, Species)

you do not need %>% to begin with, but if you mean that you don't want to use the dplyr package, maybe you can try what @sm925 suggested as a comment: as.character(unique(iris$Species))

NicolasH2
  • 774
  • 5
  • 20
0

This will give you a vector with all unique species: unique(iris$Species)

Thomas
  • 13
  • 1
  • 3