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
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
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
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
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
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
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
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
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
--- 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
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
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
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]]
___
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
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
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
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
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'
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
19 matches
Mail list logo