[R] merge question
Jeff Newmiller
jdnewmil at dcn.davis.CA.us
Sun Jun 29 22:00:42 CEST 2014
If you really prefer solution code, then provide reproducible example code as the footer requests.
Use ?merge with the all.x=TRUE parameter, and then perform your calculations on the resulting combined data frame, using ?ifelse and ?is.na as needed.
---------------------------------------------------------------------------
Jeff Newmiller The ..... ..... Go Live...
DCN:<jdnewmil at dcn.davis.ca.us> Basics: ##.#. ##.#. Live Go...
Live: OO#.. Dead: OO#.. Playing
Research Engineer (Solar/Batteries O.O#. #.O#. with
/Software/Embedded Controllers) .OO#. .OO#. rocks...1k
---------------------------------------------------------------------------
Sent from my phone. Please excuse my brevity.
On June 29, 2014 9:24:39 AM PDT, Dr Eberhard Lisse <nospam at lisse.NA> wrote:
>I have two data frames like so
>
>> qpiso
> iso requests
>1 A1 20
>2 A2 199
>3 AD 5
>4 AE 176
>...
>189 ZW 82
>
>> qplegit
> iso requests
>1 A2 36
>2 AE 4
>3 AM 2
>4 AO 1
>...
>100 ZW 3
>
>
>I want to create another dataframe qpspam which contains all pairs
>from pqiso with the values for requests of qplegit being subtracted
>from those which exist in qpiso,
>
>ie
> iso requests
>1 A1 20
>2 A2 163
>3 AD 5
>4 AE 172
>...
>189 ZW 79
>
>but don't know how to do this, and google isn't too helpful.
>
>As usual, a solution is preferred, but a pointer to where I can
>read this up is equally appreciated :-)-O
>
>el
>
>______________________________________________
>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.
More information about the R-help
mailing list