Displaying 1 result from an estimated 1 matches for "black_gray".
2009 May 24
2
help with replacing factors
Hi,
In the example dataset below - how can I cahnge "gray20", to "blue"
# data
black <- rep(c("black","red"),10)
gray <- rep(c("gray10","gray20"),10)
black_gray <- data.frame(black,gray)
# none of this desperate things works
# replace(black_gray$gray, gray=="gray20","red")
# if(black_gray$gray=="gray20"){black_gray$gray<-"blue"}
# for (i in
black_gray$gray)if(black_gray$gray[i]=="gray20"){black_gray$...