[R] Removing null vector that is not in .csv file data
arun
smartpink111 at yahoo.com
Fri Aug 2 19:54:42 CEST 2013
Hi,
You could remove it by:
vec1<- c( "","1003PI_pilot0101", "1003PI_pilot0102","1003PI_pilot0103", "1003PI_pilot0104", "1003PI_pilot0105", "1003PI_pilot0107")
vec1[vec1!=""]
#[1] "1003PI_pilot0101" "1003PI_pilot0102" "1003PI_pilot0103" "1003PI_pilot0104"
#[5] "1003PI_pilot0105" "1003PI_pilot0107"
#or
vec1[nchar(vec1)>0]
#[1] "1003PI_pilot0101" "1003PI_pilot0102" "1003PI_pilot0103" "1003PI_pilot0104"
#[5] "1003PI_pilot0105" "1003PI_pilot0107"
Without a reproducible example, it would be difficult to comment how you got that.
A.K.
Hello all,
I am a super R novice, using it for work.
I loaded a seemingly normal .csv file into R, and in one of the variables, a null vector was added.
this is what it looks like.
[1] "" "1003PI_pilot0101" "1003PI_pilot0102"
"1003PI_pilot0103" "1003PI_pilot0104" "1003PI_pilot0105"
"1003PI_pilot0107"
However, when I check the head, it looks completely normal, and the first piece of data is "1003PI_pilot0101".
How do I remove this null vector? And why is it there in the
first place? There is nothing in the original .csv data file that
indicates a blank or anything out of the ordinary.
Sorry if this is a super dumb question. I just want to get my work done.
More information about the R-help
mailing list