dimanche 28 décembre 2014

replacing values in column in R dataframe

I want to replace certain values in R data frame(data1) . I am doing data cleaning.


there are n columns in the data frame data1. In one of the column Article_Description I want to do following operation. how can this be done in R


if data1$Article_Description in ('snova glide 4m','SNOVA Glide 4M','SNova Glide 4 M') then data1$Article_Description='SNOVA Glide 4M'; if data1$Article_Description in ('aSTAR Ride 4M','astar ride 4m') then data1$Article_Description='astar ride 4m'; if data1$Article_Description in ('CC Fresh M','cc fresh m') then data1$Article_Description='CC Fresh M'; if data1$Article_Description in ('cc ride m','CC Ride M') then data1$Article_Description='CC Ride M'; if data1$Article_Description in ('astar solution 2m','aSTAR Solution 2M') then data1$Article_Description='astar solution 2m'; if data1$Article_Description in ('astar salvation 3m','aSTAR Salvation 3M') then data1$Article_Description='astar salvation 3m'; if data1$Article_Description in ('cc chill m','CC Chill M') then data1$Article_Description='CC Chill M';


Aucun commentaire:

Enregistrer un commentaire