Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想删除向量中的第一个和第六个元素, 有更好的方法吗?
> x=c(4,42,232,4,55,74,45) > x=x[-1] > x=x[-5] > x [1] 42 232 4 55 45
我可以删除它们一次,而不是两次?
x <- c(4,42,232,4,55,74,45) x <- x[-c(1,5)] x [1] 42 232 4 74 45