Skip to content
Prev 326026 / 398503 Next

pasting columns of a dataframe together

Anika:

1. You do realize that all columns of your result will be character
(even if they started out as numeric).

2. That being the case, all your data frame columns can be considered
to be character to begin with.

3. That being the case, convert your data frame to a matrix: mdf <-
as.matrix(df)

4. Then since, paste() is vectorized and recycles:

d <- dim(mdf)
mdf<- paste(mdf[,1],mdf)
dim(mdf) <- d

Cheers,
Bert
On Wed, Jun 26, 2013 at 3:21 PM, Anika Masters <anika.masters at gmail.com> wrote: