Re: [R] Merging multiple columns into one column

2012-09-30 Thread Stephen Politzer-Ahles
Hi Meredith, Why not just use paste()? cuyahoga_nf$newcolumn <- paste(cuyahoga_nf[,1], cuyahoga_nf[,2], cuyahoga_nf[,3], . , cuyahoga_nf[,4]) Best, Steve Politzer_ahles - Original Message - > From: Meredith Ballard LaBeau > To: r-help@r-project.org > Cc: > Sent: Friday, September

Re: [R] Merging multiple columns into one column

2012-09-29 Thread arun
HI, You can try melt().  Not sure how it will perform in large datasets. library(reshape) n<-1e3  set.seed(1)  mat1<-matrix(rnorm(n,15),ncol=20,nrow=50) dat1<-data.frame(mat1) dat2<-data.frame(value=melt(dat1)[,2]) dim(dat2) #[1] 1000    1 head(dat2,6) # value #1 14.37355 #2 15.18364 #3 14.164

Re: [R] Merging multiple columns into one column

2012-09-28 Thread Bert Gunter
?unlist (A data frame is a list, as ?data.frame explains. Also the Intro to R tutorial, which should be read by everyone beginning with R). -- Bert On Fri, Sep 28, 2012 at 2:51 PM, Meredith Ballard LaBeau wrote: > Good Evening- > I have a dataframe that has 10 columns that has a header and 730

Re: [R] Merging multiple columns into one column

2012-09-28 Thread David Winsemius
On Sep 28, 2012, at 2:51 PM, Meredith Ballard LaBeau wrote: > Good Evening- > I have a dataframe that has 10 columns that has a header and 7306 rows in > each column, I want to combine these columns into one. I utilized the stack > function but it only returned 3/4 of the data...my code is: > whe