Re: [R-sig-eco] How to remove space among columns

2013-03-27 Thread Manuel Spínola
Thank you very much to all of you. I tried the Bret Collier suggestion and it worked. Best, Manuel 2013/3/27 Bret Collier > l=data.frame(col1=c(0,1,0), col2=c(1,0,1), col3=c(1, 0, 1), col4=c(0, 0, > 1), col5=c("a", "a", "b"), col6=c("c", "d", "d")) > ll=paste(l$col1, l$col2, l$col3, l$col4,

Re: [R-sig-eco] How to remove space among columns

2013-03-27 Thread Bret Collier
l=data.frame(col1=c(0,1,0), col2=c(1,0,1), col3=c(1, 0, 1), col4=c(0, 0, 1), col5=c("a", "a", "b"), col6=c("c", "d", "d")) ll=paste(l$col1, l$col2, l$col3, l$col4, sep="") data.frame(ll, a=l$col5, b=l$col6) see ?paste bret On 3/27/2013 8:15 AM, Manuel Spínola wrote: Thank you very much to all

Re: [R-sig-eco] How to remove space among columns

2013-03-27 Thread Roman Luštrik
Manuel, you've been provided by a few alternatives. Here's mine. x <- read.table(text ="col1 col2 col3 col4 col5 col6 01 1 0 ac 10 0 0 ad 01 1 1 bd", header = TRUE) x$newx <- apply(x[, 1:4], 1, paste, collapse = "") >

Re: [R-sig-eco] How to remove space among columns

2013-03-27 Thread Pierre THIRIET
Hi Manuel, try this combination of paste(), which collapse your variables into a single one, and cbind() for binding this new variable with the others of your initial data frame mat=as.data.frame(matrix(1:18,3,6)) mat2=cbind(newV=with(mat,paste(V1,V2,V3,V4,sep="")),mat[,5:6]) is it what you wa

Re: [R-sig-eco] How to remove space among columns

2013-03-27 Thread Yu-Chun Kao
Hi Manuel, You can use the function "paste" paste(col1,col2.col3,col4, sep = "") in a new data frame. data.frame( col1 = paste(col1,col2.col3,col4, sep = ""), col2 = col5, col3 = col6) I think it will work Yu-Chun 2013/3/27 Manuel Spínola : > Thank you very much to all that answered my questi

Re: [R-sig-eco] How to remove space among columns

2013-03-27 Thread Manuel Spínola
Thank you very much to all that answered my question, some one of you asked me to be more specific, here is my question again: I hava a data frame: col1 col2 col3 col4 col5 col6 01 1 0 ac 10 0 0 ad 01 1 1 bd I want to en

Re: [R-sig-eco] How to remove space among columns

2013-03-26 Thread Roman Luštrik
How do you want to remove the space, so that when you print a data frame that the columns are closer together? Pr perhaps you're trying to merge column names into a single string? Perhaps something third? Can you expand your answer? Cheers, Roman 2013/3/27 Manuel Spínola > Dera list members,

[R-sig-eco] How to remove space among columns

2013-03-26 Thread Manuel Spínola
Dera list members, How to remove spaces among columns in a data frame. 1 2 3 4 to become 1234 Best, Manuel -- *Manuel Spínola, Ph.D.* Instituto Internacional en Conservación y Manejo de Vida Silvestre Universidad Nacional Apartado 1350-3000 Heredia COSTA RICA mspin...@una.ac.cr mspinol...@gm