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$gray[i] <-"blue"} # black_gray$gray=="gray14" <- "blue" # black_gray$gray[gray=="gray20"] <- "blue" # subset(black_gray,gray=="gray20",gray) <-rep("blue",10) I have a feeling this is me misunderstanding some very basic stuf about the R engine... So any help will be much appreciated. Thanks in advance Andreas [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.