HI all, if first name is Alex then I want concatenate the second column to Alex to produce Alex and the second column value
DF1 <- read.table(header=TRUE, text='first YR Alex 2001 Bob 2001 Cory 2001 Cory 2002 Bob 2002 Bob 2003 Alex 2002 Alex 2003 Alex 2004') Output data frame DF2 Alex-2001 2001 Bob 2001 Cory 2001 Cory 2002 Bob 2002 Bob 2003 Alex-2002 2002 Alex-2003 2003 Alex-2004 2004 I tried this one but did not work. DF1$first[DF1$first=="Alex"] <- paste(DF1$first, DF1$YR, sep='-') Thank you in advance [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.