Re: [R] mapping one redundant index to another redundant index

From: Gabor Grothendieck <ggrothendieck_at_gmail.com>
Date: Sat, 28 Jun 2008 11:08:59 -0400

merge(tmp1, tmp2) gives the basic data and you can put it in the form requested using:

Tmp1 <- data.frame(x = tmp1)
Tmp2 <- data.frame(x = tmp2)

M <- merge(Tmp1, Tmp2)
data.frame(tmp1 = M$x, tmp2 = M$x)

or using Tmp1 and Tmp2 from above:

library(sqldf)
sqldf("select x tmp1, x tmp2 from Tmp1 natural join Tmp2")

See sqldf home page at:
http://sqldf.googlecode.com

On Sat, Jun 28, 2008 at 7:38 AM, John Lande <john.lande77_at_gmail.com> wrote:
> Dear R users,
>
> I have a simple problem I cannot solve, but I sure you can help.
>
> I have two vector, let say
>
>> tmp1 <- c("a", "a", "b", "c")
>> tmp2 <- c("a", "a", "b", "c", "c", "d")
>
> and I want to create a matrix of two column for which I have all the
> combinations of the same character, let say like this
>
>> tmp3
> tmp1 tmp2
> [1,] "a" "a"
> [2,] "a" "a"
> [3,] "a" "a"
> [4,] "a" "a"
> [5,] "b" "b"
> [6,] "c" "c"
> [7,] "c" "c"
>
>
> how can I perform this task?
>
>
> thank you!
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help_at_r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Sat 28 Jun 2008 - 15:11:38 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sat 28 Jun 2008 - 15:31:01 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive