I have:
ls = 1:14
I change value of every element except the first, last, and every 4th element from counting from the end
I would like:
ls = c(1, 2, "", "", "", 6, "", "", "", 10, "", "", "", 14)
Any suggestions how to achieve this?
像这样的东西会起作用:
ls[-c(1, seq(14, 1, -4))] = ""
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.