ffbase (version 0.12.8)

unique.ff: Unique values for ff and ffdf objects

Description

Unique values for ff and ffdf objects

Usage

# S3 method for ff
unique(x, incomparables = FALSE, fromLast = FALSE, trace = FALSE, ...)

# S3 method for ffdf unique(x, incomparables = FALSE, fromLast = FALSE, trace = FALSE, ...)

Arguments

x

ff object or ffdf object

incomparables

a vector of values that cannot be compared. FALSE is a special value, meaning that all values can be compared, and may be the only value accepted for methods other than the default. It will be coerced internally to the same type as x.

fromLast

logical indicating if duplication should be considered from the last, i.e., the last (or rightmost) of identical elements will be kept

trace

logical indicating to show on which chunk the function is computing

...

other parameters passed on to chunk

Value

An ffdf with unique values in x or an ff vector with unique values in x if x is a ff vector.

See Also

unique

Examples

Run this code
# NOT RUN {
data(iris)
irisdouble <- rbind(iris, iris)
ffiris <- as.ffdf(irisdouble)
## unique.ff
unique(ffiris$Sepal.Length)
unique(ffiris$Petal.Length)  
ffiris$Species[1] <- NA
unique(ffiris$Species)
levels(unique(ffiris$Species))
## unique.ffdf
uiris <- unique(ffiris, trace=TRUE, by=10)[,]
test <- unique(irisdouble)
dim(iris)
dim(irisdouble)
dim(uiris)
dim(test)

!apply(uiris, MARGIN=1, FUN=function(x) paste(x, collapse=",")) %in% 
  apply(test, MARGIN=1, FUN=function(x) paste(x, collapse=","))

!apply(test, MARGIN=1, FUN=function(x) paste(x, collapse=",")) %in% 
  apply(uiris, MARGIN=1, FUN=function(x) paste(x, collapse=",")) 



# }

Run the code above in your browser using DataLab