I have a vector of Characters named Vector
, this is the output:
[1] "140222" "140207" "0" "140214" "140228" "140322" "140307" "140419" "140517" "140719" "141018" "150117" "160115"
I want to conditionally remove the only element different to the others, in this case the 0
.
I tried this approach but it seems not working:
for (i in 1:length(Vector) {
if (nchar(Vector[i]) <=3)
{remove(Vector[i])}
}
The error is:
Error in remove(Vector[i]) : ... must contain names or character strings".