I have a column (species
) in the data set with two factors. However, the summary function and the environment show an additional factor: an empty string "". The empty string has zero counts. I cant see the empty string manually on examination of data frame. I have tried all sorts of ways to remove the empty string.
dat <- dat[dat$species != "",] #directly removing it
dat[dat$species=="",] <- NA #converting to NA and them removing it dat <- dat[!(is.na(dat$species) | dat$species==""), ]
dat[complete.cases(dat$species),] #complete cases
However, I've had no luck. The empty string persists. I suspect that this is causing a big problem in further analysis.