If I have:
s <- data.frame(ID=c(191, 282, 202, 210), Group=c(\"\", \"A\", \"\", \"B\"), stringsAsFactors=FALSE) s ID Group 1 191 2 282 A 3 20
We can use data.table to assign the values in "Group2" to "Group" where the "Group" is "" specified in the "i" condition.
data.table
""
library(data.table) setDT(s)[Group=="", Group:= Group2]
As the assignment happens in place, it is considered to be efficient.