9 AM
> To: r-help@r-project.org
> Subject: [R] Combine two dataframe with different row number and
> interpolation between values
>
> Dear all,
> I am trying to combine two large dataframe in order to make a dataframe
with
> exactly the dimension of the second dataframe
l Message-
> From: R-help On Behalf Of javad bayat
> Sent: Wednesday, August 31, 2022 8:09 AM
> To: r-help@r-project.org
> Subject: [R] Combine two dataframe with different row number and
> interpolation between values
>
> Dear all,
> I am trying to combine two large dataf
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of sun
> Sent: Tuesday, November 13, 2007 4:50 AM
> To: [EMAIL PROTECTED]
> Subject: [R] combine two dataframe
>
> I have two data frame A and B adn want to cross them.
> A has format as:
>
> a1
" <[EMAIL PROTECTED]>
>> To: "sun" <[EMAIL PROTECTED]>
>> Cc: <[EMAIL PROTECTED]>
>> Sent: Tuesday, November 13, 2007 6:07 PM
>> Subject: Re: [R] combine two dataframe
>>
>>
>> > Try this:
>> >
>> >> A <-
lt;[EMAIL PROTECTED]>
> To: "sun" <[EMAIL PROTECTED]>
> Cc: <[EMAIL PROTECTED]>
> Sent: Tuesday, November 13, 2007 6:07 PM
> Subject: Re: [R] combine two dataframe
>
>
> > Try this:
> >
> >> A <- data.frame(a1 = c(1, 2, 1), a2 =
duplicated many many times.
kind regards,
Sun
- Original Message -
From: "Gabor Grothendieck" <[EMAIL PROTECTED]>
To: "sun" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Tuesday, November 13, 2007 6:07 PM
Subject: Re: [R] combine two dataframe
> Try
try this
x<-c(1,2,3,2,3,1,1,3,2)
A<-matrix(x,3,3,byrow=T)
B<-matrix(c(1,2,2,1),2,2)
A1<-matrix(rep(A,each=2),6,3)
B1<-rbind(B,B,B)
data.frame(A1,B1)
X1 X2 X3 X1.1 X2.1
1 1 2 312
2 1 2 321
3 2 3 112
4 2 3 121
5 1 3 212
6 1 3 221
Try this:
> A <- data.frame(a1 = c(1, 2, 1), a2 = c(2, 3, 3), a3 = c(3, 1, 2))
> B <- data.frame(b1 = 1:2, b2 = 2:1)
>
> library(sqldf)
> sqldf("select * from A, B")
a1 a2 a3 b1 b2
1 1 2 3 1 2
2 1 2 3 2 1
3 2 3 1 1 2
4 2 3 1 2 1
5 1 3 2 1 2
6 1 3 2 2 1
On Nov 13,
Try this:
merge(B, A)
On 13/11/2007, sun <[EMAIL PROTECTED]> wrote:
> I have two data frame A and B adn want to cross them.
> A has format as:
>
> a1 a2 a3
> 1 23
> 2 31
> 1 32
> ...
>
> B:
>
> b1 b2
> 1 2
> 2 1
> ...
>
> the combine result shall be something like
>
> a1 a
I have two data frame A and B adn want to cross them.
A has format as:
a1 a2 a3
1 23
2 31
1 32
...
B:
b1 b2
1 2
2 1
...
the combine result shall be something like
a1 a2 a3 b1 b2
1 2 3 1 2
1 2 3 2 1
2 3 1 1 2
2 3 1 2 1
1 3 2 1 2
1 3
10 matches
Mail list logo