On Sat, 11 Oct 2014 05:25:14 PM PO SU wrote: > Dear helpeRs, > let a <- 1:10 > let b <- integer(0) first, then i will randomly write a integer > differently in the range(1,10) or NULL into b. for supposed 5 times. then > i want to get a[-b],that means i not want the values at index b. if any > time of 5 times generate a integer, it works fine. but when all the 5 > times generate NULL, it can't work! Because of the a[-integer(0)] > =integer(0) . > I ask the same question once before, now i encount it again, i think > a[-integer(0)] should return a not integer(0) ! Is any one have the same > idea with me ? or give me a oppisite case that a[-integer(0)] need to be > integer(0) ? > Hi PO SU, How about:
if(length(b)) a<-a[-b] Jim ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.