Here’s one way:
a[!(duplicated(a) | rev(duplicated(rev(a))))]
# [1] 1 2 4 5 6 8
More Related Contents:
- Delete rows that exist in another data frame? [duplicate]
- duplicates in multiple columns
- Remove duplicates keeping entry with largest absolute value
- Techniques for finding near duplicate records
- Cbind Error ” Object not found”
- Creating co-occurrence matrix
- Can lists be created that name themselves based on input object names?
- How can I count runs in a sequence?
- Remove an entire column from a data.frame in R
- How can I make consistent-width plots in ggplot (with legends)?
- R.exe, Rcmd.exe, Rscript.exe and Rterm.exe: what’s the difference?
- How to flatten a list of lists?
- Unicode Characters in ggplot2 PDF Output
- How to organize large R programs?
- Plotting over multiple pages
- Stepwise regression using p-values to drop variables with nonsignificant p-values
- Finding overlap in ranges with R
- R Convert to date from multiple formats
- R ifelse avoiding change in date format [duplicate]
- When should I use the := operator in data.table?
- Generate paired stacked bar charts in ggplot (using position_dodge only on some variables)
- Generate correlated random numbers from binomial distributions
- Use hist() function in R to get percentages as opposed to raw frequencies
- R Knitr PDF: Is there a posssibility to automatically save PDF reports (generated from .Rmd) through a loop?
- beautiful Pie Charts with R
- Collapse all columns by an ID column [duplicate]
- Add data to ggvis tooltip that’s contained in the input dataset but not directly in the vis
- Error in Confusion Matrix : the data and reference factors must have the same number of levels
- Add number of observations per group in boxplot
- R fast single item lookup from list vs data.table vs hash