Skip to content
Prev 304281 / 398503 Next

find and replace

I am making the assumption that all the columns are character and not factors:

for (i in c("A", "B", "C", "D", "E")){
    yourdf[[i]] <- ifelse(yourdf[[i]] == 'x'
                    , 'y'
                    , ifelse(yourdf[[i]] == 'a'
                        , 'b'
                        , yourdf[[i]]
                        )
                    )
}
On Mon, Aug 27, 2012 at 4:19 PM, Sapana Lohani <lohani.sapana at ymail.com> wrote: