我的数据集带有重复。我正在从原始向量中删除一个结果向量(使用这些语句)。
elements_LON <- longitude %in% Point_Long
new_LOG <- longitude[! elements_LON]
**# longitude: Its the original vector
**# Point_Long: Resultant vector (Subset of longitude vector)**** 它使两个向量不相等于绘图,因为它删除了重复的值。我需要根据索引而不是值来执行删除。谁能给我个建议吗?谢谢
发布于 2017-05-22 10:08:17
给定两个向量a和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您现在可以绘制相同的长度向量了。
https://stackoverflow.com/questions/44109799
复制相似问题