Re: [R] Concatenation?

2021-02-18 Thread pikappa . devel
How about paste? site <- c('MU','MU','MU','MC','MC','MC')depth <- c(0,1,2,0,1,2)paste(site, depth, sep="") result: [1] "MU0" "MU1" "MU2" "MC0" "MC1" "MC2" On Wed, 2021-02-17 at 21:09 +, Parkhurst, David wrote: > If I have a vector of site abbreviations and a vector of depths in > those water bo

Re: [R] Concatenation?

2021-02-17 Thread Eric Berger
desired <- paste(site,depth,sep="") On Wed, Feb 17, 2021 at 11:10 PM Parkhurst, David wrote: > If I have a vector of site abbreviations and a vector of depths in those > water bodies, is there a simple way in R to combine them to make a third > vector? > Examples: > > sitedepth des

[R] Concatenation?

2021-02-17 Thread Parkhurst, David
If I have a vector of site abbreviations and a vector of depths in those water bodies, is there a simple way in R to combine them to make a third vector? Examples: sitedepth desired MU 0 MU0 MU 1 MU1 MU 2 MU2 MC 0

Re: [R] Concatenation

2010-05-21 Thread santana sarma
Many thanks - the problem is solved. Didn't realize that it was indeed simple. Thanks again. Cheers, [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the post

Re: [R] Concatenation

2010-05-21 Thread David Winsemius
On May 21, 2010, at 12:21 AM, santana sarma wrote: Hi David, SORRY - I am trying to be more clearer this time. Let's say the dataframe has some rows and columns, with unique rownames and column names. The rest of the data in the dataframe are just numbers. So have you tried any of the s

Re: [R] Concatenation

2010-05-21 Thread Wu Gong
Sorry, I made a mistake. Should add "byrow = TRUE". Using randomly created values can't check the result, a sequence will be better. olddata <- data.frame(matrix(1:200, nrow=40, byrow = TRUE)) newdata <- data.frame(matrix(as.vector(t(olddata)), nrow=nrow(olddata)/10,byrow = TRUE)) dim(olddata) di

Re: [R] Concatenation

2010-05-21 Thread Wu Gong
A dummy way is to resequence or rematrix olddata <- data.frame(matrix(rnorm(200), nrow=40)) newdata <- data.frame(matrix(as.vector(t(olddata)), nrow=nrow(olddata)/10)) dim(olddata) dim(newdata) - A R learner. -- View this message in context: http://r.789695.n4.nabble.com/Concatenation-tp

Re: [R] Concatenation

2010-05-21 Thread Shi, Tao
ry, for example, >> >>>>apply(df[1:10,], 2, paste, collapse=" ") >> >>>>but this will turn everything into strings. Is this what you want? >> >>>>..Tao >> >> >> >> >> >>>>- Original Mes

Re: [R] Concatenation

2010-05-20 Thread santana sarma
uot; ") > > but this will turn everything into strings. Is this what you want? > > ..Tao > > > > > - Original Message > > From: santana sarma > > To: David Winsemius > > Cc: r-help@r-project.org > > Sent: Thu, May 20, 2010 9:21:33 P

Re: [R] Concatenation

2010-05-20 Thread Shi, Tao
--- Original Message > From: santana sarma > To: David Winsemius > Cc: r-help@r-project.org > Sent: Thu, May 20, 2010 9:21:33 PM > Subject: Re: [R] Concatenation > > Hi David, SORRY - I am trying to be more clearer this time. Let's > say the dataframe has some

Re: [R] Concatenation

2010-05-20 Thread santana sarma
Hi David, SORRY - I am trying to be more clearer this time. Let's say the dataframe has some rows and columns, with unique rownames and column names. The rest of the data in the dataframe are just numbers. I wish to concatenate those rows. That means : I wish to concatenate first 10 rows' values

Re: [R] Concatenation

2010-05-20 Thread David Winsemius
On May 20, 2010, at 11:05 PM, santana sarma wrote: Hi, I have a dataframe with some 800 rows and 14 columns. Could you please advise how I can concatenate the rows - one after another. Similarly for columns, one below the other. Not sure exactly what you are after: unlist might accompl

[R] Concatenation

2010-05-20 Thread santana sarma
Hi, I have a dataframe with some 800 rows and 14 columns. Could you please advise how I can concatenate the rows - one after another. Similarly for columns, one below the other. Many thanks. Cheers, Santana [[alternative HTML version deleted]] ___

Re: [R] Concatenation, was Re: Physical Units in Calculations

2009-04-13 Thread Stavros Macrakis
On Mon, Apr 13, 2009 at 5:15 AM, Peter Dalgaard wrote: > Stavros Macrakis wrote: >> ...c of two time differences is currently a numeric vector, >> losing its units (hours, days, etc.) completely. > > That's actually a generic feature/issue of c(). ... > There is some potential for redesigning thi

Re: [R] Concatenation, was Re: Physical Units in Calculations

2009-04-13 Thread hadley wickham
On Mon, Apr 13, 2009 at 4:15 AM, Peter Dalgaard wrote: > Stavros Macrakis wrote: > >> It would of course be nice if the existing difftime class could be fit >> into this, as it is currently pretty much a second-class citizen.  For >> example, c of two time differences is currently a numeric vector

[R] Concatenation, was Re: Physical Units in Calculations

2009-04-13 Thread Peter Dalgaard
Stavros Macrakis wrote: It would of course be nice if the existing difftime class could be fit into this, as it is currently pretty much a second-class citizen. For example, c of two time differences is currently a numeric vector, losing its units (hours, days, etc.) completely. That's actual

Re: [R] Concatenation and Evaluation

2008-02-04 Thread John Erb-Downward
Thank you, thank you both! get() is exactly what I needed. I apologize for not putting in reproducible code. I'm not very good at this and was more worried that I would create problems that didn't exist (and the files I'm working with are too big). Again, thank you. -John On Feb 4, 200

Re: [R] Concatenation and Evaluation

2008-02-04 Thread Bert Gunter
Genentech -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of John Erb-Downward Sent: Monday, February 04, 2008 8:41 AM To: r-help@r-project.org Subject: [R] Concatenation and Evaluation Hello all, I've run into what I bet is a silly problem; however, I'

[R] Concatenation and Evaluation

2008-02-04 Thread John Erb-Downward
Hello all, I've run into what I bet is a silly problem; however, I've been trying to get around it now for a couple weeks and every time I think I have the answer it still doesn't work. So I apologize in advance if this is painfully obvious, but I've run out of ideas and would really ap