Q:

Deleting values based on a vector indexes

My data set carries duplication. I am deleting a resultant vector from an original vector (using these statements).
  elements_LON <- longitude %in% Point_Long
  new_LOG <- longitude[! elements_LON]

  **# longitude: Its the original vector 
  **# Point_Long: Resultant vector (Subset of longitude vector)**** 

It makes two vectors un-equal for plotting as it deletes repeated values as well. I need to perform deletion based on the indices and not on the values. Can anyone please suggest a way ? Thanks 

A:

Given two vectors a and b
(a <- seq(1:10)) #initial values
[1]  1  2  3  4  5  6  7  8  9 10
b <- c(3,5,7) #values to exclude
(c <- ifelse(!(a %in% b),a,NA)) # initial vector minus the values of b (but of the same length as a)
[1]  1  2 NA  4 NA  6 NA  8  9 10

you can plot the same length vectors now

