The following codes has a logical mistake, and will not assign color by categories. The ifelse should be nested.
# tbomegaH2C1S1$color[i] = ifelse( tbomegaH2C1S1$CoatLocation[i]=="OuterCoat", 'red', tbomegaH2C1S1$color[i] )
# tbomegaH2C1S1$color[i] = ifelse( tbomegaH2C1S1$CoatLocation[i]=="InnerCoat", 'blue', tbomegaH2C1S1$color[i] )
tbomegaH2C1S1$color[i] = ifelse( tbomegaH2C1S1$coatflag[i]=="coat", 'red', tbomegaH2C1S1$color[i] )
tbomegaH2C1S1$color[i] = ifelse( tbomegaH2C1S1$essenflag[i]=="essential", 'black', tbomegaH2C1S1$color[i] )
No comments:
Post a Comment