I have a (11590 x 2) df with two factor variables (values, ind), as follows:
> head(df)
values ind
8632 acanthite X138
40132 acanthite X638
1 actinolite X1
1387 actinolite X23
1765 actinolite X29
1891 actinolite X31
When I try to get all the unique values, why do I get the following error? How should I get around this error to get a df with only the records for unique values? Any help would be appreciated.
> unidf<-unique(df,"values")
Error: argument 'incomparables != FALSE' is not used (yet)
R is interpreting the second parameter to your call to unique()
as the value of incomparables
. Your call is being interpreted as this:
unidf<-unique(df, incomparables="values")
If you want to get unique rows from your data frame using only the values
column then try this:
unidff <- df[!duplicated(df$values), ]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With