Abhishek Pratap
2010-Apr-05 17:38 UTC
[R] Adding a prefix to all values in a col in a data.frame
Hi All I am looking for a way to prefix a constant value to all the rows in column in a data frame. Eg. V1 2 3 4 5 I want to make it like this V1 number2 number3 number4 number5 Thanks! -Abhi [[alternative HTML version deleted]]
Henrique Dallazuanna
2010-Apr-05 17:41 UTC
[R] Adding a prefix to all values in a col in a data.frame
Try this: DF <- transform(DF, V1 = sprintf('number%d', V1)) On Mon, Apr 5, 2010 at 2:38 PM, Abhishek Pratap <abhishek.vit at gmail.com> wrote:> Hi All > > I am looking for a way to prefix a constant value to all the rows in column > in a data frame. > > Eg. > > V1 > 2 > 3 > 4 > 5 > > I want to make it like this > > V1 > number2 > number3 > number4 > number5 > > Thanks! > -Abhi > > ? ? ? ?[[alternative HTML version deleted]] > > ______________________________________________ > R-help at 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. >-- Henrique Dallazuanna Curitiba-Paran?-Brasil 25? 25' 40" S 49? 16' 22" O