extract ( [] [[]] )

If you don't specify a column, the operation is done to all columns of a data frame. So, to quickly set all instance of, say a space character to NA, the following works:

junk = data.frame(x=c("A"," "), y=c(" ","B")) 
junk[junk == " "] <- NA
junk
       x    y
1    A <NA>
2 <NA>    B