Reputation: 1480
I have a vector of objects
A<-c(a,b,c,d,e,f,g,h,i,j,k,l,ll,m,n,o,p,q,r,s,t,x,y,z,aa,bb,cc,dd,ee)
All vector elements are 0 except the first (a)
A
[1] "s2" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0"
"0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0"
I would like to eliminate all 0s in the expression without indicating the possition and then eliminating, more an expression like
A<-names(which(A!=0))
A
NULL
However I get the error above. Would you happen to know how could I eliminate the zeros and obtain as a result of A "s2"
Upvotes: 0
Views: 51