How can I list the various values ββin a vector where the values ββare replicative? I mean, similar to the following SQL statement:
SELECT DISTINCT product_code FROM data
You mean unique :
unique
R> x = c(1,1,2,3,4,4,4) R> x [1] 1 1 2 3 4 4 4 R> unique(x) [1] 1 2 3 4
You can also use the sqldf package in R. Z <-sqldf ('SELECT DISTINCT tablename.columnname FROM tablename')
Try using a duplicate function in conjunction with the negation operator "!".
Example:
wdups <- rep(1:5,5) wodups <- wdups[which(!duplicated(wdups))]
Hope this helps.