[R] merge 2 data.frames in dependence of 2 values

2014-11-13 Thread Matthias Weber
Hello togehter,

i have a little problem. Maybe anyone can help me.

I have 2 data.frames, which look like as follows:
First:

NAMEMONTH BONUS
1  Andy 2014-10   100
2  Pete 2014-10200
3  Marc2014-10300
4  Andy2014-11400

Second:

  NAME  MONTHBONUS_2
1Andy2014-10   150
2Pete 2014-11   180
3Jason   2014-10   190
4Paul 2014-10   210
5Andy2014-11   30

How can I merge this 2 data.frames, if I want the following result:

NAMEMONTH BONUSBONUS_2
1 Andy 2014-10   100150
2 Pete 2014-11 180
3 Marc2014-10300
4 Andy2014-11   400 30
5 Pete 2014-10   200
6 Jason  2014-10 190
7 Paul 2014-10 210

The important thing is, that for every accordance in the Columns NAME and 
MONTH I get a new line.

Thanks for your help.

Best regards.

Mat


This e-mail may contain trade secrets, privileged, undisclosed or otherwise 
confidential information. If you have received this e-mail in error, you are 
hereby notified that any review, copying or distribution of it is strictly 
prohibited. Please inform us immediately and destroy the original transmittal. 
Thank you for your cooperation.

Diese E-Mail kann Betriebs- oder Geschaeftsgeheimnisse oder sonstige 
vertrauliche Informationen enthalten. Sollten Sie diese E-Mail irrtuemlich 
erhalten haben, ist Ihnen eine Kenntnisnahme des Inhalts, eine 
Vervielfaeltigung oder Weitergabe der E-Mail ausdruecklich untersagt. Bitte 
benachrichtigen Sie uns und vernichten Sie die empfangene E-Mail. Vielen Dank.

[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] merge 2 data.frames in dependence of 2 values

2014-11-13 Thread Rui Barradas

Hello,

See ?merge, in particular the argument 'all'.

dat1 - read.table(text = 
NAMEMONTH BONUS
1  Andy 2014-10   100
2  Pete 2014-10200
3  Marc2014-10300
4  Andy2014-11400
, header = TRUE, stringsAsFactors = FALSE)


dat2 - read.table(text = 
  NAME  MONTHBONUS_2
1Andy2014-10   150
2Pete 2014-11   180
3Jason   2014-10   190
4Paul 2014-10   210
5Andy2014-11   30
, header = TRUE, stringsAsFactors = FALSE)

merge(dat1, dat2, all = TRUE)


Hope this helps,

Rui Barradas

Em 13-11-2014 14:02, Matthias Weber escreveu:

Hello togehter,

i have a little problem. Maybe anyone can help me.

I have 2 data.frames, which look like as follows:
First:

 NAMEMONTH BONUS
1  Andy 2014-10   100
2  Pete 2014-10200
3  Marc2014-10300
4  Andy2014-11400

Second:

   NAME  MONTHBONUS_2
1Andy2014-10   150
2Pete 2014-11   180
3Jason   2014-10   190
4Paul 2014-10   210
5Andy2014-11   30

How can I merge this 2 data.frames, if I want the following result:

 NAMEMONTH BONUSBONUS_2
1 Andy 2014-10   100150
2 Pete 2014-11 180
3 Marc2014-10300
4 Andy2014-11   400 30
5 Pete 2014-10   200
6 Jason  2014-10 190
7 Paul 2014-10 210

The important thing is, that for every accordance in the Columns NAME and 
MONTH I get a new line.

Thanks for your help.

Best regards.

Mat


This e-mail may contain trade secrets, privileged, undisclosed or otherwise 
confidential information. If you have received this e-mail in error, you are 
hereby notified that any review, copying or distribution of it is strictly 
prohibited. Please inform us immediately and destroy the original transmittal. 
Thank you for your cooperation.

Diese E-Mail kann Betriebs- oder Geschaeftsgeheimnisse oder sonstige 
vertrauliche Informationen enthalten. Sollten Sie diese E-Mail irrtuemlich 
erhalten haben, ist Ihnen eine Kenntnisnahme des Inhalts, eine 
Vervielfaeltigung oder Weitergabe der E-Mail ausdruecklich untersagt. Bitte 
benachrichtigen Sie uns und vernichten Sie die empfangene E-Mail. Vielen Dank.

[[alternative HTML version deleted]]

__
R-help@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@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.


Re: [R] merge 2 data.frames in dependence of 2 values

2014-11-13 Thread William Dunlap
merge(df1, df2, all=TRUE)


Bill Dunlap
TIBCO Software
wdunlap tibco.com

On Thu, Nov 13, 2014 at 6:02 AM, Matthias Weber 
matthias.we...@fntsoftware.com wrote:

 Hello togehter,

 i have a little problem. Maybe anyone can help me.

 I have 2 data.frames, which look like as follows:
 First:

 NAMEMONTH BONUS
 1  Andy 2014-10   100
 2  Pete 2014-10200
 3  Marc2014-10300
 4  Andy2014-11400

 Second:

   NAME  MONTHBONUS_2
 1Andy2014-10   150
 2Pete 2014-11   180
 3Jason   2014-10   190
 4Paul 2014-10   210
 5Andy2014-11   30

 How can I merge this 2 data.frames, if I want the following result:

 NAMEMONTH BONUSBONUS_2
 1 Andy 2014-10   100150
 2 Pete 2014-11 180
 3 Marc2014-10300
 4 Andy2014-11   400 30
 5 Pete 2014-10   200
 6 Jason  2014-10 190
 7 Paul 2014-10 210

 The important thing is, that for every accordance in the Columns NAME
 and MONTH I get a new line.

 Thanks for your help.

 Best regards.

 Mat

 
 This e-mail may contain trade secrets, privileged, undisclosed or
 otherwise confidential information. If you have received this e-mail in
 error, you are hereby notified that any review, copying or distribution of
 it is strictly prohibited. Please inform us immediately and destroy the
 original transmittal. Thank you for your cooperation.

 Diese E-Mail kann Betriebs- oder Geschaeftsgeheimnisse oder sonstige
 vertrauliche Informationen enthalten. Sollten Sie diese E-Mail irrtuemlich
 erhalten haben, ist Ihnen eine Kenntnisnahme des Inhalts, eine
 Vervielfaeltigung oder Weitergabe der E-Mail ausdruecklich untersagt. Bitte
 benachrichtigen Sie uns und vernichten Sie die empfangene E-Mail. Vielen
 Dank.

 [[alternative HTML version deleted]]

 __
 R-help@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.


[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] merge 2 data.frames in dependence of 2 values

2014-11-13 Thread Michael Dewey



On 13/11/2014 14:02, Matthias Weber wrote:

Hello togehter,

i have a little problem. Maybe anyone can help me.


I think you might find
?merge
enlightening

Indeed given that the word merge occurs in your subject line and your 
text it is surprising you have not already found it.




I have 2 data.frames, which look like as follows:
First:

 NAMEMONTH BONUS
1  Andy 2014-10   100
2  Pete 2014-10200
3  Marc2014-10300
4  Andy2014-11400

Second:

   NAME  MONTHBONUS_2
1Andy2014-10   150
2Pete 2014-11   180
3Jason   2014-10   190
4Paul 2014-10   210
5Andy2014-11   30

How can I merge this 2 data.frames, if I want the following result:

 NAMEMONTH BONUSBONUS_2
1 Andy 2014-10   100150
2 Pete 2014-11 180
3 Marc2014-10300
4 Andy2014-11   400 30
5 Pete 2014-10   200
6 Jason  2014-10 190
7 Paul 2014-10 210

The important thing is, that for every accordance in the Columns NAME and 
MONTH I get a new line.

Thanks for your help.

Best regards.

Mat


This e-mail may contain trade secrets, privileged, undisclosed or otherwise 
confidential information. If you have received this e-mail in error, you are 
hereby notified that any review, copying or distribution of it is strictly 
prohibited. Please inform us immediately and destroy the original transmittal. 
Thank you for your cooperation.

Diese E-Mail kann Betriebs- oder Geschaeftsgeheimnisse oder sonstige 
vertrauliche Informationen enthalten. Sollten Sie diese E-Mail irrtuemlich 
erhalten haben, ist Ihnen eine Kenntnisnahme des Inhalts, eine 
Vervielfaeltigung oder Weitergabe der E-Mail ausdruecklich untersagt. Bitte 
benachrichtigen Sie uns und vernichten Sie die empfangene E-Mail. Vielen Dank.

[[alternative HTML version deleted]]

__
R-help@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.


-
No virus found in this message.
Checked by AVG - www.avg.com
Version: 2015.0.5557 / Virus Database: 4213/8566 - Release Date: 11/13/14




--
Michael
http://www.dewey.myzen.co.uk

__
R-help@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] merge 2 data.frames

2013-02-06 Thread Mat
Hello together,

i have probably a easy question, but how can i sum 2 data.frames among each
other.
I have 2 data.frames which look like this one:

Cu.No.  place  level
1 123London  A
2111 Paris   B

Cu.No.  place  level
1 333Berlin  C
2444 MadridA

and now i want this data in the same data.frame. like this one:

Cu.No.  place  level
1 123London  A
2111 Paris   B
3 333Berlin  C
4444 MadridA

how can i do this.

Thanks.

Mat



--
View this message in context: 
http://r.789695.n4.nabble.com/merge-2-data-frames-tp4657702.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.


Re: [R] merge 2 data.frames

2013-02-06 Thread Eik Vettorazzi
Hi Mat,
just have a look at ?rbind

cheers.

Am 06.02.2013 15:55, schrieb Mat:
 Hello together,
 
 i have probably a easy question, but how can i sum 2 data.frames among each
 other.
 I have 2 data.frames which look like this one:
 
 Cu.No.  place  level
 1 123London  A
 2111 Paris   B
 
 Cu.No.  place  level
 1 333Berlin  C
 2444 MadridA
 
 and now i want this data in the same data.frame. like this one:
 
 Cu.No.  place  level
 1 123London  A
 2111 Paris   B
 3 333Berlin  C
 4444 MadridA
 
 how can i do this.
 
 Thanks.
 
 Mat
 
 
 
 --
 View this message in context: 
 http://r.789695.n4.nabble.com/merge-2-data-frames-tp4657702.html
 Sent from the R help mailing list archive at Nabble.com.
 
 __
 R-help@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.
 


-- 
Eik Vettorazzi

Department of Medical Biometry and Epidemiology
University Medical Center Hamburg-Eppendorf

Martinistr. 52
20246 Hamburg

T ++49/40/7410-58243
F ++49/40/7410-57790
--
Pflichtangaben gemäß Gesetz über elektronische Handelsregister und 
Genossenschaftsregister sowie das Unternehmensregister (EHUG):

Universitätsklinikum Hamburg-Eppendorf; Körperschaft des öffentlichen Rechts; 
Gerichtsstand: Hamburg

Vorstandsmitglieder: Prof. Dr. Martin Zeitz (Vorsitzender), Dr. Alexander 
Kirstein, Joachim Prölß, Prof. Dr. Dr. Uwe Koch-Gromus

__
R-help@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.


Re: [R] merge 2 data.frames

2013-02-06 Thread Alice Xiong
 x-matrix(c(1,11,11,2,3,4),2,3)
y-matrix(x(7,8,9,10,11,12),2,3)
if you want to merge them by row, then use:
rbind(x,y)
if you want to merge them by column, then use
cbind(x,y)

hope this can help you out*

Alice Xiong

On Wed, Feb 6, 2013 at 8:55 AM, Mat matthias.we...@fnt.de wrote:

 Hello together,

 i have probably a easy question, but how can i sum 2 data.frames among each
 other.
 I have 2 data.frames which look like this one:

 Cu.No.  place  level
 1 123London  A
 2111 Paris   B

 Cu.No.  place  level
 1 333Berlin  C
 2444 MadridA

 and now i want this data in the same data.frame. like this one:

 Cu.No.  place  level
 1 123London  A
 2111 Paris   B
 3 333Berlin  C
 4444 MadridA

 how can i do this.

 Thanks.

 Mat



 --
 View this message in context:
 http://r.789695.n4.nabble.com/merge-2-data-frames-tp4657702.html
 Sent from the R help mailing list archive at Nabble.com.

 __
 R-help@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.


[[alternative HTML version deleted]]

__
R-help@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.