On Mon, Feb 02, 2009 at 09:44:28AM -0500, Shaun Grannis wrote:
> I'm trying to concatenate values from two columns in a data frame. For
> example, I have the following data.frame:
>
> C1 C2 C3 C4 C5
> A B *F C* Q
> G H *I J* T
> K D *R S* E
> P L *M N* O
>
> I'
yes, try this:
dat <- read.table(textConnection(
"C1 C2 C3 C4 C5
A B F C Q
G H I J T
K D R S E
P L M N O"
), header = TRUE)
closeAllConnections()
dat$NewCol <- do.call(paste, c(dat[c("C3", "C4")], sep = ""))
dat
I hope it helps.
Best,
Dimitris
Shaun Grann
2 matches
Mail list logo