If your data.frame looks something like this.
ds <- data.frame(ID=c(191, 282, 202, 210), Group=c("", "A", "", "B"), stringsAsFactors=FALSE)
You can check the length of each element and replace it with "N" if the length is zero.
ds$Group <- ifelse(nchar(ds$Group)==0, "N", ds$Group)
wibeasley
source share