If you want to concatenate the *vectors*, you need 'c', which will
also coerce the elements to a common type.
If you want to concatenate the corresponding *elements* of the
vectors, you need 'paste', which will coerce them to character
strings.
-s
On 5/18/09, Henning Wildhagen wrote:
Sorry,
I saw the word concatenate and dived in. Andrew Dolmans solution works fine.
Simon.
- Original Message -
From: "Linlin Yan"
To: "Simon Pickett"
Cc: "Henning Wildhagen" ;
Sent: Monday, May 18, 2009 12:30 PM
Subject: Re: [R] Concatenating tw
ote:
> z<-c(x,y)
>
> cheers, Simon.
>
>
> - Original Message - From: "Henning Wildhagen"
> To:
> Sent: Monday, May 18, 2009 12:09 PM
> Subject: [R] Concatenating two vectors into one
>
>
>> Dear users,
>>
>> a very simple qu
Henning Wildhagen wrote:
Dear users,
a very simple question:
Given two vectors x and y
x<-as.character(c("A","B","C","D","E","F"))
y<-as.factor(c("1","2","3","4","5","6"))
i want to combine them into a single vector z as A1, B2, C3 and so on.
z<-x*y is not working, i tried several others
> z <- paste(x, y, sep = '')
> z
[1] "A1" "B2" "C3" "D4" "E5" "F6"
On Mon, May 18, 2009 at 7:09 PM, Henning Wildhagen wrote:
> Dear users,
>
> a very simple question:
>
> Given two vectors x and y
>
> x<-as.character(c("A","B","C","D","E","F"))
> y<-as.factor(c("1","2","3","4","5","6"))
>
> i wan
On 18-May-09 11:09:45, Henning Wildhagen wrote:
> Dear users,
> a very simple question:
>
> Given two vectors x and y
>
> x<-as.character(c("A","B","C","D","E","F"))
> y<-as.factor(c("1","2","3","4","5","6"))
>
> i want to combine them into a single vector z as A1, B2, C3 and so on.
>
> z<-x*
Something like this should work:
z<- paste(x,y, sep='')
HTH,
Tony
On 18 May, 12:09, "Henning Wildhagen" wrote:
> Dear users,
>
> a very simple question:
>
> Given two vectors x and y
>
> x<-as.character(c("A","B","C","D","E","F"))
> y<-as.factor(c("1","2","3","4","5","6"))
>
> i want to combine
x<-as.character(c("A","B","C","D","E","F"))
y<-as.factor(c("1","2","3","4","5","6"))
?paste
paste(x,y, sep="")
andydol...@gmail.com
2009/5/18 Henning Wildhagen
> Dear users,
>
> a very simple question:
>
> Given two vectors x and y
>
> x<-as.character(c("A","B","C","D","E","F"))
> y<-as.
z<-c(x,y)
cheers, Simon.
- Original Message -
From: "Henning Wildhagen"
To:
Sent: Monday, May 18, 2009 12:09 PM
Subject: [R] Concatenating two vectors into one
Dear users,
a very simple question:
Given two vectors x and y
x<-as.character(c("A&quo
Dear users,
a very simple question:
Given two vectors x and y
x<-as.character(c("A","B","C","D","E","F"))
y<-as.factor(c("1","2","3","4","5","6"))
i want to combine them into a single vector z as A1, B2, C3 and so on.
z<-x*y is not working, i tried several others function, but did not get to
10 matches
Mail list logo