Quantcast

Merge function - Return NON matches

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Merge function - Return NON matches

RHelpPlease
Hi there,
I wish to merge a common variable between a list and a data.frame & return rows via the data.frame where there is NO match.  Here are some details:

The list, where the variable/col.name = CLAIM_NO
CLAIM_NO
20
83
1440
4439
7002
...

> dim(hrc78_clm_no)
[1] 6678    1

The data.frame, where there exists a variable with the same name, CLAIM_NO.
> dim(bestPartAreadmin)
[1] 13068    93

I wish to merge the two together & only return a data.frame where there is NO match in the CLAIM_NO between both files.

I've read & tried code via the "merge" function.  If "merge" can do this, I'm missing something with the available options.

I'm figuring something like:

clm_no_nomatch <- merge(hrc78_clm_no, bestPartAreadmin, by = "CLAIM_NO",  .. .. ..)

Your help is most appreciated!

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Merge function - Return NON matches

Steve Lianoglou-6
Hi,

To increase the chances of you getting help on this one, please give
example data (a small data.frame, a small list) that you are trying to
do this on, and also show the desired output. Whip these variables up
in your R workspace and paste the output of `dput` for each into your
follow up email.

It's hard (for me, anyways) to get what you're after ... I'm guessing
something that ends up looking like this will end up being one
solution:

subset(your.df, !CLAIM_NO %in% `something`)

but it's hard for me to tell from where I'm setting.

-steve


On Thu, Apr 26, 2012 at 3:33 PM, RHelpPlease <[hidden email]> wrote:

> Hi there,
> I wish to merge a common variable between a list and a data.frame & return
> rows via the data.frame where there is NO match.  Here are some details:
>
> The list, where the variable/col.name = CLAIM_NO
> CLAIM_NO
> 20
> 83
> 1440
> 4439
> 7002
> ...
>
>> dim(hrc78_clm_no)
> [1] 6678    1
>
> The data.frame, where there exists a variable with the same name, CLAIM_NO.
>> dim(bestPartAreadmin)
> [1] 13068    93
>
> I wish to merge the two together & only return a data.frame where there is
> NO match in the CLAIM_NO between both files.
>
> I've read & tried code via the "merge" function.  If "merge" can do this,
> I'm missing something with the available options.
>
> I'm figuring something like:
>
> clm_no_nomatch <- merge(hrc78_clm_no, bestPartAreadmin, by = "CLAIM_NO",  ..
> .. ..)
>
> Your help is most appreciated!
>
>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/Merge-function-Return-NON-matches-tp4590755p4590755.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> [hidden email] 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.



--
Steve Lianoglou
Graduate Student: Computational Systems Biology
 | Memorial Sloan-Kettering Cancer Center
 | Weill Medical College of Cornell University
Contact Info: http://cbio.mskcc.org/~lianos/contact

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Merge function - Return NON matches

RHelpPlease
Hi Steve,
Thanks for replying.  Here's a small piece of the data.frame:

> bestPartAreadmin[1:5,1:6]
  DESY_SORT_KEY   PRVDR_NUM   CLM_THRU_DT   CLAIM_NO   NCH_NEAR_LINE_REC_IDEN_CD   NCH_CLM_TYPE_CD
1     100000193                 290003          20090323               20                                                      V                                60    
2     100000193                 290045          20091124               21                                                      V                                60    
3     100000193                 29T003          20090401               22                                                      V                                60    
4     100000574                 050017          20090527               83                                                      V                                60  
5     100000574                 050017          20090921               84                                                      V                                60  

There's 93 columns total in the data.frame, so these are the first six, where you can see CLAIM_NO.

I wish for the resultant data.frame to "look" just like the data.frame above, but values for CLAIM_NO (above) are those that differ/don't match the corresponding CLAIM_NO values in the list (hrc78_clm_no).

Does this help?

Thanks!
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Merge function - Return NON matches

RHelpPlease
Hi again,
I tried the sample code like this:

> merged_clmno <- subset(bestPartAreadmin, !CLAIM_NO %in% hrc78_clm_no)
> dim(merged_clmno)
[1] 13068    93

Note that:
> dim(bestPartAreadmin)
[1] 13068    93

So, no change between the original data.frame (bestPartAreadmin) & the (should be) less-rows merged_clmno data.frame.

Any further help is most appreciated!
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Merge function - Return NON matches

Sarah Goslee
You'd get better help if you actually did as Steve requested and
provided sample data (a reproducible example!) using dput().

But since you didn't:

> fakedata <- data.frame(a = 1:5, b=11:15, c=c(1,1,1,2,2))
> fakedata
  a  b c
1 1 11 1
2 2 12 1
3 3 13 1
4 4 14 2
5 5 15 2
> notb <- c(12, 14, 15)
> subset(fakedata, !b %in% notb)
  a  b c
1 1 11 1
3 3 13 1

Since you say that doesn't work for you, you absolutely have to
provide us with a reproducible example for anyone to be able to
diagnose your problem.

Sarah

On Thu, Apr 26, 2012 at 4:12 PM, RHelpPlease <[hidden email]> wrote:

> Hi again,
> I tried the sample code like this:
>
>> merged_clmno <- subset(bestPartAreadmin, !CLAIM_NO %in% hrc78_clm_no)
>> dim(merged_clmno)
> [1] 13068    93
>
> Note that:
>> dim(bestPartAreadmin)
> [1] 13068    93
>
> So, no change between the original data.frame (bestPartAreadmin) & the
> (should be) less-rows merged_clmno data.frame.
>
> Any further help is most appreciated!
>

--
Sarah Goslee
http://www.functionaldiversity.org

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Merge function - Return NON matches

Steve Lianoglou-6
In reply to this post by RHelpPlease
Hi,

As Sarah reiterated -- it'd *really* be helpful if you give us data we
can actually work with.

That having been said:

On Thu, Apr 26, 2012 at 4:12 PM, RHelpPlease <[hidden email]> wrote:

> Hi again,
> I tried the sample code like this:
>
>> merged_clmno <- subset(bestPartAreadmin, !CLAIM_NO %in% hrc78_clm_no)
>> dim(merged_clmno)
> [1] 13068    93
>
> Note that:
>> dim(bestPartAreadmin)
> [1] 13068    93
>
> So, no change between the original data.frame (bestPartAreadmin) & the
> (should be) less-rows merged_clmno data.frame.

You're original email said you had a "list" that contains CLAIM_NO's
you want to exclude.

Is `hrc78_clm_no` this "list" -- does it only have claim_no's? passing
a list into the subset call after `%in%` won't work.

If you do `no <- unlist(hrc_78_clm_no`, do you get a character vector
of claim numbers you want to exclude? If so, then `subset(whatever,
!CLAIM_NO %in% no)` should work.

HTH,
-steve


>
> Any further help is most appreciated!
>
> --
> View this message in context: http://r.789695.n4.nabble.com/Merge-function-Return-NON-matches-tp4590755p4590851.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> [hidden email] 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.



--
Steve Lianoglou
Graduate Student: Computational Systems Biology
 | Memorial Sloan-Kettering Cancer Center
 | Weill Medical College of Cornell University
Contact Info: http://cbio.mskcc.org/~lianos/contact

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Merge function - Return NON matches

RHelpPlease
Hi there,
Thanks for your responses.  I haven't used/heard of dput() before.  I'm looking it up & understanding how it works.

Thanks!
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Merge function - Return NON matches

MacQueen, Don
In reply to this post by RHelpPlease
Assuming everything else is good, the "all" or "all.x" or "all.y"
arguments to merge() should do what I think you're asking for. You did
read the help page for merge, right?

-Don

--
Don MacQueen

Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062





On 4/26/12 12:33 PM, "RHelpPlease" <[hidden email]> wrote:

>Hi there,
>I wish to merge a common variable between a list and a data.frame & return
>rows via the data.frame where there is NO match.  Here are some details:
>
>The list, where the variable/col.name = CLAIM_NO
>CLAIM_NO
>20
>83
>1440
>4439
>7002
>...
>
>> dim(hrc78_clm_no)
>[1] 6678    1
>
>The data.frame, where there exists a variable with the same name,
>CLAIM_NO.
>> dim(bestPartAreadmin)
>[1] 13068    93
>
>I wish to merge the two together & only return a data.frame where there is
>NO match in the CLAIM_NO between both files.
>
>I've read & tried code via the "merge" function.  If "merge" can do this,
>I'm missing something with the available options.
>
>I'm figuring something like:
>
>clm_no_nomatch <- merge(hrc78_clm_no, bestPartAreadmin, by = "CLAIM_NO",
>..
>.. ..)
>
>Your help is most appreciated!
>
>
>
>--
>View this message in context:
>http://r.789695.n4.nabble.com/Merge-function-Return-NON-matches-tp4590755p
>4590755.html
>Sent from the R help mailing list archive at Nabble.com.
>
>______________________________________________
>[hidden email] 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.

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Merge function - Return NON matches

chuck.01
This post was updated on .
In reply to this post by RHelpPlease
# dput() example
# lets say you have data called y, like this:
> y
  sp1 sp2 sp3 sp4
d   0   0   0   0
e   0   0   0   0
f   0   0   0   0
 
 # ok, so do this:
> dput(y)
structure(list(sp1 = c(0, 0, 0), sp2 = c(0, 0, 0), sp3 = c(0,
0, 0), sp4 = c(0, 0, 0)), .Names = c("sp1", "sp2", "sp3", "sp4"
), row.names = c("d", "e", "f"), class = "data.frame")

# now copy and paste that into your R terminal to see why it is so nice.
# or assign it a name like so:
y_new <- structure(list(sp1 = c(0, 0, 0), sp2 = c(0, 0, 0), sp3 = c(0,
0, 0), sp4 = c(0, 0, 0)), .Names = c("sp1", "sp2", "sp3", "sp4"
), row.names = c("d", "e", "f"), class = "data.frame")



RHelpPlease wrote
Hi there,
Thanks for your responses.  I haven't used/heard of dput() before.  I'm looking it up & understanding how it works.

Thanks!
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Merge function - Return NON matches

RHelpPlease
Hi there,
I've tried the noted solutions:

"If you do `no <- unlist(hrc_78_clm_no`, do you get a character vector
of claim numbers you want to exclude? If so, then `subset(whatever,
!CLAIM_NO %in% no)` should work."

I converted the CLAIM_NO list to a character, with

> hrc78_clmno_char <- format(as.character(hrc78_clm_no))
> is.character(hrc78_clmno_char)
[1] TRUE

Then I applied your code (above), which didn't work.  Thanks though!

Thanks for the dput() help.  Here is truncated output of the list (its class is data.frame, I call it a list for communication sake) & data.frame.  Again, your help is most appreciated!

Goal: merge the list & data.frame together.  Output the data.frame, but with rows where the CLAIM_NO variable between the list & data.frame do not match.

The List
truncated_list <- hrc78_clm_no[1:100,] #So you can see consistency in previously-mentioned variables
truncated_list <- structure(list(CLAIM_NO = c(20L, 83L, 1440L, 4439L, 7002L, 9562L, 10463L, 12503L, 16195L,
22987L, 30760L, 32108L, 32640L, 33045L, 36241L, 37091L, 37934L,
38663L, 39456L, 40544L, 40630L, 40679L, 40734L, 43054L, 53483L,
54155L, 56151L, 58113L, 61050L, 62056L, 63014L, 68486L, 68541L,
69298L, 69983L, 73379L, 76810L, 79975L, 91124L, 97697L, 100524L,
105808L, 112659L, 112955L, 113422L, 114522L, 124159L, 133566L,
135167L, 137387L, 137954L, 138186L, 144574L, 148573L, 150013L,
152193L, 154680L, 155414L, 165954L, 171223L, 175077L, 176359L,
177656L, 178155L, 182250L, 182393L, 182832L, 184245L, 185542L,
186038L, 186087L, 186098L, 186294L, 186550L, 186897L, 187025L,
190180L, 191472L, 192593L, 196207L, 196689L, 197372L, 197537L,
197590L, 197730L, 197874L, 198294L, 198750L, 198823L, 199076L,
199233L, 199284L, 199468L, 199661L, 199913L, 200150L, 200279L,
200473L, 200927L, 202407L), .Names = c("CLAIM_NO"), class = "data.frame"))

The (multi-column) data.frame, but greatly truncated
truncated_dataframe <- bestPartAreadmin[1:25, 1:4]
truncated_dataframe <- structure(list(DESY_SORT_KEY = c(100000193L, 100000193L, 100000193L,
100000574L, 100000574L, 100009213L, 100009213L, 100009213L, 100026636L,
100040718L, 100055111L, 100060558L, 100060558L, 100060558L, 100072978L,
100096346L, 100130451L, 100168782L, 100168782L, 100168782L, 100168782L,
100168782L, 100168782L, 100174887L, 100177905L), PRVDR_NUM = structure(c(1368L,
1353L, 1406L, 149L, 149L, 1362L, 1393L, 1367L, 1557L, 1370L,
1360L, 1362L, 1362L, 1362L, 1372L, 1358L, 193L, 196L, 196L, 61L,
166L, 196L, 196L, 311L, 1363L), .Label = c("010001", "010006",
"010015", "010016", "010029", "010033", "010034", "010035", "010039",
"010040", "010046", "010049", "010083", "010092", "010108", "010131",
"010149", "01S001", "01S033", "01S046", "01S145", "020001", "020006",
"020012", "020017", "021306", "021311", "030002", "030006", "030007",
"030010", "030011", "030012", "030013", "030014", "030016", "030023",
"030024", "030030", "030033", "030036", "030037", "030038", "030043",
"030055", "030061", "030062", "030064", "030065", "030067", "030069",
"030078", "030083", "030085", "030087", "030088", "030089", "030092",
"030093", "030100", "030101", "030102", "030103", "030105", "030108",
"030110", "030111", "030114", "030115", "030117", "030118", "030119",
"030120", "030121", "030122", "030123", "030126", "030128", "031300",
"031305", "031311", "032000", "032001", "032002", "032006", "033025",
"033028", "033029", "033032", "033034", "033036", "034004", "034013",
"034020", "034024", "03S002", "03S006", "03S007", "03S016", "03S022",
"03S023", "03S089", "03T002", "03T055", "03T061", "03T069", "03T093",
"03T103", "03T114", "03T117", "03T126", "040004", "040007", "040010",
"040011", "040016", "040022", "040026", "040027", "040029", "040036",
"040041", "040047", "040055", "040062", "040072", "040080", "040084",
"040088", "040091", "040114", "040118", "040119", "043028", "044005",
"04S027", "04S084", "04T041", "04T062", "04T119", "050002", "050006",
"050007", "050008", "050009", "050013", "050014", "050016", "050017",
"050018", "050022", "050024", "050025", "050026", "050030", "050036",
"050038", "050039", "050040", "050042", "050043", "050045", "050046",
"050047", "050055", "050056", "050057", "050058", "050060", "050063",
"050069", "050070", "050071", "050073", "050075", "050076", "050077",
"050078", "050079", "050082", "050084", "050089", "050090", "050091",
"050093", "050099", "050100", "050101", "050102", "050103", "050104",
"050107", "050108", "050110", "050111", "050112", "050113", "050115",
"050116", "050118", "050121", "050122", "050124", "050125", "050126",
"050128", "050129", "050131", "050132", "050133", "050135", "050136",
"050137", "050138", "050139", "050140", "050145", "050146", "050149",
"050150", "050152", "050153", "050158", "050159", "050168", "050169",
"050174", "050179", "050180", "050188", "050191", "050193", "050195",
"050196", "050197", "050204", "050211", "050219", "050222", "050224",
"050225", "050226", "050228", "050230", "050231", "050232", "050234",
"050235", "050236", "050238", "050239", "050242", "050243", "050245",
"050248", "050254", "050257", "050261", "050262", "050264", "050272",
"050276", "050277", "050278", "050279", "050280", "050283", "050289",
"050290", "050291", "050292", "050295", "050296", "050298", "050300",
"050301", "050305", "050308", "050309", "050313", "050315", "050320",
"050324", "050327", "050329", "050334", "050335", "050336", "050342",
"050348", "050351", "050352", "050353", "050359", "050360", "050366",
"050367", "050373", "050376", "050378", "050380", "050382", "050385",
"050390", "050393", "050394", "050396", "050397", "050414", "050417",
"050424", "050425", "050426", "050434", "050435", "050438", "050441",
"050444", "050448", "050454", "050455", "050457", "050464", "050468",
"050471", "050481", "050485", "050488", "050492", "050496", "050498",
"050502", "050503", "050506", "050510", "050512", "050515", "050516",
"050517", "050523", "050526", "050528", "050531", "050534", "050537",
"050541", "050543", "050549", "050551", "050552", "050557", "050567",
"050570", "050573", "050575", "050580", "050581", "050586", "050588",
"050589", "050590", "050597", "050599", "050603", "050604", "050608",
"050609", "050616", "050618", "050624", "050625", "050633", "050636",
"050644", "050660", "050663", "050674", "050678", "050680", "050684",
"050688", "050689", "050690", "050696", "050697", "050701", "050704",
"050708", "050709", "050710", "050714", "050723", "050724", "050726",
"050727", "050732", "050735", "050737", "050738", "050739", "050740",
"050742", "050744", "050745", "050746", "050747", "050751", "050752",
"050755", "050757", "050758", "050760", "050761", "050763", "050764",
"050765", "051300", "051302", "051303", "051305", "051306", "051308",
"051310", "051311", "051315", "051316", "051317", "051318", "051319",
"051320", "051321", "051323", "051324", "051326", "051327", "051328",
"051330", "052031", "052032", "052033", "052034", "052035", "052036",
"052037", "052038", "052039", "052043", "052044", "052045", "052046",
"052047", "052049", "052050", "052051", "052052", "053027", "053031",
"053032", "053034", "053301", "053305", "054009", "054032", "054053",
"054055", "054069", "054074", "054075", "054077", "054078", "054087",
"054093", "054095", "054096", "054104", "054110", "054111", "054123",
"054131", "054135", "054144", "054145", "054146", "05S007", "05S025",
"05S026", "05S038", "05S047", "05S057", "05S069", "05S077", "05S078",
"05S089", "05S116", "05S124", "05S127", "05S128", "05S145", "05S152",
"05S159", "05S193", "05S205", "05S228", "05S239", "05S245", "05S283",
"05S305", "05S320", "05S329", "05S360", "05S373", "05S380", "05S426",
"05S438", "05S464", "05S624", "05S625", "05S636", "05S644", "05S727",
"05S744", "05S745", "05S747", "05S752", "05T007", "05T008", "05T017",
"05T024", "05T026", "05T038", "05T039", "05T057", "05T058", "05T063",
"05T100", "05T115", "05T116", "05T180", "05T191", "05T204", "05T235",
"05T248", "05T278", "05T305", "05T309", "05T327", "05T348", "05T380",
"05T457", "05T485", "05T503", "05T549", "05T603", "05T624", "05T625",
"05T737", "05T752", "05T757", "060001", "060003", "060006", "060009",
"060010", "060011", "060012", "060013", "060014", "060015", "060020",
"060022", "060023", "060024", "060027", "060028", "060030", "060031",
"060032", "060034", "060054", "060064", "060065", "060075", "060100",
"060103", "060104", "060112", "060114", "060119", "061312", "061324",
"061327", "062009", "062011", "062015", "063027", "064007", "064018",
"064024", "06S001", "06S009", "06S010", "06S020", "06S027", "06T015",
"070002", "070003", "070006", "070007", "070008", "070010", "070011",
"070018", "070020", "070022", "070024", "070027", "070028", "070029",
"070033", "070034", "070035", "074003", "080001", "080004", "080007",
"090001", "090004", "090005", "090011", "09S005", "100001", "100002",
"100006", "100007", "100008", "100009", "100012", "100014", "100017",
"100018", "100019", "100022", "100023", "100025", "100026", "100029",
"100030", "100032", "100034", "100035", "100038", "100039", "100043",
"100044", "100045", "100047", "100050", "100052", "100053", "100055",
"100057", "100067", "100068", "100070", "100072", "100073", "100075",
"100076", "100084", "100086", "100087", "100090", "100105", "100110",
"100113", "100118", "100122", "100124", "100125", "100126", "100128",
"100131", "100135", "100137", "100150", "100151", "100154", "100156",
"100157", "100161", "100168", "100173", "100176", "100177", "100180",
"100181", "100183", "100187", "100191", "100204", "100210", "100212",
"100213", "100220", "100223", "100224", "100228", "100230", "100239",
"100242", "100243", "100244", "100246", "100248", "100249", "100252",
"100253", "100255", "100256", "100260", "100265", "100266", "100268",
"100271", "100288", "100289", "100290", "100296", "102017", "102022",
"103028", "103036", "103039", "104015", "104016", "104026", "104040",
"104063", "104065", "104067", "10S006", "10S022", "10S034", "10S067",
"10S087", "10S131", "10S157", "10S223", "10T022", "10T034", "10T068",
"10T173", "10T213", "110010", "110024", "110028", "110035", "110040",
"110041", "110043", "110082", "110083", "110087", "110122", "110161",
"110164", "110165", "110183", "110184", "110187", "110192", "110198",
"110209", "110215", "110219", "110225", "110230", "111336", "114010",
"114012", "11S010", "11S034", "11S076", "11S115", "11S122", "120001",
"120002", "120004", "120005", "120006", "120007", "120014", "120019",
"120022", "120026", "120027", "120028", "123300", "124001", "130002",
"130006", "130007", "130013", "130014", "130018", "130024", "130025",
"130028", "130049", "130065", "131307", "131308", "131310", "131312",
"131313", "131316", "131319", "131323", "131325", "131326", "131327",
"132002", "133025", "134002", "134014", "13T049", "140007", "140008",
"140010", "140012", "140029", "140030", "140034", "140048", "140053",
"140054", "140062", "140080", "140082", "140083", "140084", "140088",
"140093", "140095", "140101", "140103", "140113", "140114", "140115",
"140116", "140117", "140118", "140119", "140120", "140122", "140124",
"140127", "140130", "140133", "140145", "140148", "140162", "140166",
"140172", "140176", "140177", "140179", "140180", "140182", "140184",
"140185", "140186", "140187", "140189", "140191", "140197", "140200",
"140202", "140206", "140208", "140211", "140213", "140223", "140231",
"140233", "140239", "140240", "140242", "140251", "140252", "140258",
"140276", "140281", "140286", "140288", "140290", "140292", "141303",
"141310", "141312", "141326", "141343", "141346", "142006", "143027",
"144005", "144009", "144026", "144031", "14S007", "14S015", "14S054",
"14S095", "14S119", "14S174", "14S208", "14S242", "14T010", "14T082",
"14T258", "150002", "150003", "150004", "150008", "150021", "150033",
"150034", "150035", "150044", "150045", "150046", "150047", "150048",
"150056", "150057", "150058", "150076", "150082", "150084", "150088",
"150090", "150102", "150125", "150126", "150150", "150162", "151303",
"151312", "151315", "152007", "154050", "15S015", "15S021", "15T002",
"15T046", "15T074", "15T125", "160016", "160024", "160029", "160030",
"160033", "160047", "160058", "160064", "160082", "160083", "160146",
"161307", "161326", "161353", "161365", "161372", "161377", "161380",
"162001", "16S040", "170001", "170006", "170016", "170027", "170040",
"170049", "170058", "170086", "170094", "170104", "170122", "170123",
"170142", "170145", "170146", "170150", "170185", "170192", "170197",
"171341", "171366", "171376", "171379", "171380", "171381", "173026",
"173028", "174010", "17M374", "17M376", "17M381", "180009", "180011",
"180012", "180013", "180017", "180027", "180040", "180045", "180066",
"180067", "180088", "180093", "180104", "180130", "180141", "181320",
"184007", "184008", "18S040", "18S067", "190005", "190026", "190036",
"190039", "190041", "190054", "190065", "190098", "190102", "190111",
"190118", "190125", "190144", "190146", "190160", "190176", "190202",
"190236", "190274", "191305", "191309", "191314", "191323", "192030",
"192043", "192045", "192049", "194020", "194044", "194071", "194074",
"194097", "194099", "19S037", "19S064", "19T125", "200008", "200009",
"200033", "200039", "201306", "204005", "204006", "210001", "210002",
"210004", "210008", "210009", "210012", "210015", "210016", "210019",
"210022", "210023", "210025", "210027", "210029", "210032", "210039",
"210040", "210044", "210048", "210054", "210055", "210056", "210057",
"210061", "213028", "220001", "220002", "220012", "220017", "220031",
"220046", "220049", "220060", "220063", "220066", "220067", "220071",
"220075", "220080", "220083", "220084", "220086", "220088", "220095",
"220100", "220101", "220108", "220110", "220116", "220126", "220171",
"222046", "223027", "224007", "224018", "224021", "224023", "224038",
"22S011", "22S066", "22S070", "22S086", "22S116", "230002", "230004",
"230013", "230015", "230017", "230019", "230020", "230024", "230029",
"230031", "230035", "230038", "230041", "230046", "230053", "230054",
"230055", "230066", "230070", "230077", "230081", "230089", "230092",
"230095", "230097", "230099", "230101", "230104", "230105", "230130",
"230132", "230141", "230142", "230146", "230156", "230165", "230167",
"230193", "230195", "230197", "230207", "230227", "230230", "230236",
"230254", "230269", "230270", "230273", "230277", "230302", "231316",
"232030", "234011", "234021", "234038", "234039", "23S029", "23S041",
"23S097", "23S121", "23S135", "23S165", "23S167", "23S193", "23S207",
"23S254", "23T132", "240002", "240004", "240010", "240022", "240030",
"240036", "240038", "240040", "240047", "240050", "240053", "240057",
"240061", "240066", "240075", "240076", "240078", "240080", "240088",
"240115", "240207", "240210", "240213", "241360", "241362", "241370",
"242004", "244009", "24M329", "24S004", "24S080", "24T080", "250007",
"250019", "250031", "250040", "250042", "250048", "250050", "250082",
"250095", "250096", "250099", "250117", "250141", "254007", "25S100",
"260001", "260005", "260006", "260009", "260017", "260021", "260023",
"260025", "260027", "260032", "260040", "260047", "260048", "260065",
"260068", "260077", "260081", "260091", "260094", "260096", "260102",
"260104", "260105", "260108", "260110", "260119", "260141", "260176",
"260177", "260179", "260180", "260186", "260190", "260191", "260195",
"260200", "260209", "260210", "260216", "261302", "261304", "261309",
"261313", "261326", "262017", "264008", "264012", "264016", "264017",
"264025", "26S020", "26S032", "26S048", "26S062", "26S104", "26S105",
"26S180", "26S195", "26S210", "26T005", "270003", "270004", "270012",
"270014", "270017", "270023", "270032", "270049", "270051", "270057",
"271301", "271306", "271316", "271318", "271324", "271328", "271335",
"271340", "271345", "274086", "27S014", "27T014", "27T049", "27T051",
"280003", "280009", "280013", "280020", "280040", "280060", "280061",
"280065", "280081", "280105", "280111", "280125", "281329", "281332",
"281357", "28S003", "28S009", "28S065", "290001", "290002", "290003",
"290005", "290006", "290007", "290008", "290009", "290012", "290019",
"290020", "290021", "290022", "290027", "290032", "290039", "290041",
"290045", "290046", "290047", "290049", "290051", "290053", "290054",
"290055", "2900V0", "291300", "291301", "291302", "291303", "291304",
"291306", "291307", "291308", "291309", "291311", "292002", "292003",
"292004", "292006", "292007", "292008", "293026", "293032", "293033",
"294000", "294002", "294003", "294008", "294009", "294010", "294011",
"29S005", "29S019", "29S032", "29T003", "29T007", "29T009", "29T012",
"29T019", "29T041", "29T046", "29T049", "300003", "300017", "300019",
"300020", "301308", "301309", "301312", "304001", "30S029", "30T019",
"310001", "310010", "310012", "310017", "310034", "310038", "310039",
"310041", "310045", "310047", "310048", "310050", "310054", "310057",
"310060", "310064", "310070", "310075", "310081", "310083", "310086",
"310096", "310108", "310110", "310111", "310112", "310113", "313025",
"313029", "313030", "314011", "314012", "314022", "31S027", "31S040",
"31S058", "31S064", "31S081", "31S083", "31S111", "31T034", "320001",
"320002", "320003", "320005", "320006", "320009", "320014", "320017",
"320018", "320021", "320022", "320038", "320065", "320069", "320074",
"320085", "320086", "323027", "323032", "32S021", "330002", "330005",
"330011", "330013", "330014", "330019", "330024", "330028", "330043",
"330044", "330045", "330046", "330055", "330057", "330059", "330073",
"330078", "330085", "330101", "330102", "330103", "330104", "330106",
"330119", "330125", "330126", "330127", "330128", "330140", "330141",
"330153", "330154", "330158", "330159", "330160", "330162", "330163",
"330164", "330167", "330169", "330182", "330184", "330185", "330188",
"330193", "330194", "330195", "330196", "330198", "330203", "330205",
"330208", "330214", "330215", "330219", "330222", "330223", "330224",
"330225", "330226", "330229", "330231", "330234", "330236", "330249",
"330259", "330261", "330264", "330265", "330270", "330273", "330279",
"330285", "330286", "330290", "330304", "330307", "330316", "330331",
"330340", "330353", "330372", "330386", "330390", "330393", "330394",
"334009", "334020", "33S006", "33S028", "33S044", "33S101", "33S108",
"33S157", "33S160", "33S198", "33S199", "33S204", "33S219", "33S226",
"33S231", "33S241", "33S290", "33T027", "33T043", "33T046", "33T160",
"33T219", "33T234", "33T259", "33T404", "33T405", "340001", "340002",
"340004", "340014", "340021", "340028", "340030", "340032", "340040",
"340050", "340051", "340053", "340061", "340064", "340070", "340073",
"340090", "340091", "340098", "340113", "340114", "340115", "340119",
"340121", "340131", "340141", "340142", "340143", "340145", "340171",
"340183", "343025", "343026", "344001", "344016", "34S155", "34T061",
"350002", "350006", "350015", "350019", "351335", "351336", "35S002",
"360001", "360003", "360006", "360008", "360009", "360012", "360016",
"360017", "360019", "360020", "360027", "360032", "360035", "360048",
"360051", "360052", "360055", "360056", "360059", "360064", "360075",
"360076", "360077", "360079", "360080", "360082", "360084", "360085",
"360087", "360091", "360095", "360098", "360101", "360112", "360115",
"360118", "360123", "360125", "360132", "360133", "360137", "360141",
"360143", "360144", "360145", "360152", "360155", "360159", "360161",
"360163", "360172", "360179", "360180", "360203", "360212", "360218",
"360230", "360262", "361326", "361333", "362004", "362015", "362026",
"362028", "362029", "364029", "36S074", "36S081", "36S137", "36S163",
"36T059", "36T079", "36T082", "36T179", "36T195", "370001", "370006",
"370008", "370013", "370014", "370023", "370025", "370028", "370032",
"370034", "370037", "370048", "370054", "370056", "370078", "370089",
"370091", "370093", "370094", "370106", "370114", "370149", "370166",
"370190", "370202", "370211", "370215", "370227", "371312", "371314",
"371323", "373025", "374020", "37S006", "37S037", "37S148", "37T025",
"37T056", "37T106", "380001", "380002", "380004", "380005", "380007",
"380009", "380014", "380017", "380018", "380020", "380022", "380025",
"380027", "380029", "380037", "380038", "380040", "380047", "380050",
"380051", "380052", "380056", "380060", "380061", "380071", "380075",
"380082", "380089", "380090", "380102", "381305", "381306", "381307",
"381309", "381316", "381319", "381322", "381323", "382004", "38S007",
"38S017", "38S033", "38S060", "38S061", "38T018", "38T075", "390003",
"390006", "390009", "390028", "390036", "390037", "390041", "390042",
"390044", "390045", "390049", "390056", "390057", "390063", "390072",
"390073", "390076", "390079", "390081", "390090", "390097", "390100",
"390101", "390107", "390111", "390113", "390119", "390123", "390127",
"390133", "390137", "390145", "390146", "390151", "390153", "390156",
"390160", "390162", "390164", "390168", "390174", "390178", "390201",
"390219", "390225", "390226", "390228", "390231", "390237", "390256",
"390258", "390265", "390270", "390272", "390278", "390290", "390313",
"390318", "392043", "393025", "393040", "394034", "394050", "394051",
"39S027", "39S037", "39S044", "39S050", "39S097", "39S226", "39T111",
"39T228", "400004", "400125", "410007", "410009", "410010", "410011",
"410012", "414000", "420004", "420007", "420009", "420027", "420048",
"420051", "420065", "420073", "420078", "420079", "420080", "420082",
"420087", "42S018", "430013", "430014", "430015", "430016", "430027",
"430048", "430077", "431325", "434003", "43S014", "43S077", "440025",
"440029", "440034", "440035", "440039", "440048", "440049", "440053",
"440056", "440059", "440063", "440073", "440082", "440083", "440120",
"440133", "440150", "440173", "440185", "440193", "442010", "444002",
"444004", "44S082", "44S161", "44T125", "450002", "450007", "450010",
"450011", "450018", "450021", "450024", "450029", "450033", "450034",
"450035", "450037", "450039", "450040", "450046", "450052", "450054",
"450056", "450058", "450064", "450076", "450079", "450082", "450083",
"450087", "450092", "450099", "450101", "450102", "450104", "450107",
"450130", "450132", "450133", "450135", "450152", "450184", "450193",
"450203", "450209", "450213", "450221", "450224", "450231", "450237",
"450280", "450289", "450299", "450324", "450340", "450346", "450358",
"450388", "450395", "450403", "450431", "450446", "450451", "450462",
"450469", "450484", "450518", "450530", "450563", "450571", "450573",
"450587", "450604", "450610", "450617", "450630", "450634", "450638",
"450639", "450646", "450647", "450658", "450662", "450668", "450670",
"450672", "450675", "450678", "450684", "450686", "450709", "450713",
"450716", "450723", "450775", "450779", "450788", "450809", "450820",
"450847", "450855", "450865", "450867", "450877", "451342", "451369",
"452044", "452049", "452051", "452060", "452063", "452079", "452086",
"453029", "453038", "453056", "453072", "453099", "454000", "454006",
"454064", "454081", "454083", "454084", "454094", "454100", "454103",
"454108", "45S035", "45S039", "45S054", "45S130", "45S209", "45S324",
"45S358", "45S424", "45S639", "45T058", "45T107", "45T184", "45T571",
"460001", "460003", "460004", "460005", "460006", "460007", "460009",
"460010", "460011", "460013", "460015", "460017", "460018", "460021",
"460023", "460026", "460030", "460033", "460035", "460041", "460042",
"460044", "460047", "460049", "460051", "460052", "460054", "461301",
"461303", "461304", "462004", "462005", "463025", "464009", "464012",
"46S001", "46S003", "46S004", "46S009", "46S015", "46S021", "46T009",
"46T021", "46T041", "470003", "471304", "480001", "490004", "490011",
"490017", "490020", "490024", "490033", "490040", "490042", "490043",
"490045", "490046", "490050", "490052", "490059", "490060", "490063",
"490069", "490093", "490094", "490107", "490113", "490118", "490120",
"490122", "490136", "491300", "494001", "49S002", "49S021", "49S032",
"49S043", "49S112", "49S120", "49S122", "49T050", "500001", "500002",
"500003", "500005", "500008", "500011", "500012", "500014", "500015",
"500016", "500019", "500021", "500024", "500025", "500027", "500030",
"500031", "500033", "500036", "500037", "500039", "500041", "500044",
"500050", "500051", "500053", "500054", "500058", "500064", "500072",
"500077", "500079", "500084", "500088", "500108", "500119", "500124",
"500129", "500141", "500150", "500151", "501309", "501314", "501333",
"501334", "503025", "504003", "504009", "50S001", "50S015", "50T058",
"50T079", "50T108", "510007", "510008", "510022", "510030", "510048",
"510085", "511300", "511312", "511314", "511319", "514008", "520011",
"520013", "520019", "520027", "520030", "520035", "520037", "520044",
"520045", "520048", "520051", "520059", "520062", "520063", "520066",
"520070", "520071", "520075", "520078", "520083", "520087", "520089",
"520091", "520096", "520097", "520098", "520103", "520109", "520136",
"520138", "520160", "520177", "521300", "521320", "521321", "521334",
"521345", "521349", "521358", "524000", "524001", "524018", "524025",
"52S088", "530002", "530008", "530009", "530012", "530014", "530015",
"530025", "530032", "530033", "531304", "531312", "534004", "650001",
"670006", "670023", "670024", "670034", "670041", "670043", "670044",
"670046", "670047", "670055", "670899", "673033", "673034", "67T050"
), class = "factor"), CLAIM_NO = c(21L, 20L, 22L, 83L, 84L, 1440L,
1442L, 1441L, 4439L, 7002L, 9562L, 10463L, 10464L, 10462L, 12503L,
16195L, 22987L, 30759L, 30758L, 30756L, 30757L, 30760L, 30761L,
32108L, 32642L), NCH_NEAR_LINE_REC_IDEN_CD = structure(c(1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), .Label = "V", class = "factor")), .Names = c("DESY_SORT_KEY",
"PRVDR_NUM", "CLAIM_NO", "NCH_NEAR_LINE_REC_IDEN_CD"), row.names = c(NA,
25L), class = "data.frame")

Thanks for your feedback so far & hope these data samples further help.  It is most appreciated!
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Merge function - Return NON matches

PIKAL Petr
Hi

If you used shorter names for your objects you will get probably more
readable advice

Is this what you wanted?

truncated_dataframe[truncated_dataframe$CLAIM_NO %in%
setdiff(truncated_dataframe$CLAIM_NO, truncated_list$CLAIM_NO),]

Regards
Petr

 

> Hi there,
> I've tried the noted solutions:
>
> "If you do `no <- unlist(hrc_78_clm_no`, do you get a character vector
> of claim numbers you want to exclude? If so, then `subset(whatever,
> !CLAIM_NO %in% no)` should work."
>
> I converted the CLAIM_NO list to a character, with
>
> > hrc78_clmno_char <- format(as.character(hrc78_clm_no))
> > is.character(hrc78_clmno_char)
> [1] TRUE
>
> Then I applied your code (above), which didn't work.  Thanks though!
>
> Thanks for the dput() help.  Here is truncated output of the list (its
class
> is data.frame, I call it a list for communication sake) & data.frame.
> Again, your help is most appreciated!
>
> Goal: merge the list & data.frame together.  Output the data.frame, but
with
> rows where the CLAIM_NO variable between the list & data.frame *do not
> match*.
>
> *The List*
> truncated_list <- hrc78_clm_no[1:100,] #So you can see consistency in
> previously-mentioned variables
> truncated_list <- structure(list(CLAIM_NO = c(20L, 83L, 1440L, 4439L,
7002L,

> 9562L, 10463L, 12503L, 16195L,
> 22987L, 30760L, 32108L, 32640L, 33045L, 36241L, 37091L, 37934L,
> 38663L, 39456L, 40544L, 40630L, 40679L, 40734L, 43054L, 53483L,
> 54155L, 56151L, 58113L, 61050L, 62056L, 63014L, 68486L, 68541L,
> 69298L, 69983L, 73379L, 76810L, 79975L, 91124L, 97697L, 100524L,
> 105808L, 112659L, 112955L, 113422L, 114522L, 124159L, 133566L,
> 135167L, 137387L, 137954L, 138186L, 144574L, 148573L, 150013L,
> 152193L, 154680L, 155414L, 165954L, 171223L, 175077L, 176359L,
> 177656L, 178155L, 182250L, 182393L, 182832L, 184245L, 185542L,
> 186038L, 186087L, 186098L, 186294L, 186550L, 186897L, 187025L,
> 190180L, 191472L, 192593L, 196207L, 196689L, 197372L, 197537L,
> 197590L, 197730L, 197874L, 198294L, 198750L, 198823L, 199076L,
> 199233L, 199284L, 199468L, 199661L, 199913L, 200150L, 200279L,
> 200473L, 200927L, 202407L), .Names = c("CLAIM_NO"), class =
"data.frame"))

>
> *The (multi-column) data.frame, but greatly truncated*
> truncated_dataframe <- bestPartAreadmin[1:25, 1:4]
> truncated_dataframe <- structure(list(DESY_SORT_KEY = c(100000193L,
> 100000193L, 100000193L,
> 100000574L, 100000574L, 100009213L, 100009213L, 100009213L, 100026636L,
> 100040718L, 100055111L, 100060558L, 100060558L, 100060558L, 100072978L,
> 100096346L, 100130451L, 100168782L, 100168782L, 100168782L, 100168782L,
> 100168782L, 100168782L, 100174887L, 100177905L), PRVDR_NUM =
> structure(c(1368L,
> 1353L, 1406L, 149L, 149L, 1362L, 1393L, 1367L, 1557L, 1370L,
> 1360L, 1362L, 1362L, 1362L, 1372L, 1358L, 193L, 196L, 196L, 61L,
> 166L, 196L, 196L, 311L, 1363L), .Label = c("010001", "010006",
> "010015", "010016", "010029", "010033", "010034", "010035", "010039",
> "010040", "010046", "010049", "010083", "010092", "010108", "010131",
> "010149", "01S001", "01S033", "01S046", "01S145", "020001", "020006",
> "020012", "020017", "021306", "021311", "030002", "030006", "030007",
> "030010", "030011", "030012", "030013", "030014", "030016", "030023",
> "030024", "030030", "030033", "030036", "030037", "030038", "030043",
> "030055", "030061", "030062", "030064", "030065", "030067", "030069",
> "030078", "030083", "030085", "030087", "030088", "030089", "030092",
> "030093", "030100", "030101", "030102", "030103", "030105", "030108",
> "030110", "030111", "030114", "030115", "030117", "030118", "030119",
> "030120", "030121", "030122", "030123", "030126", "030128", "031300",
> "031305", "031311", "032000", "032001", "032002", "032006", "033025",
> "033028", "033029", "033032", "033034", "033036", "034004", "034013",
> "034020", "034024", "03S002", "03S006", "03S007", "03S016", "03S022",
> "03S023", "03S089", "03T002", "03T055", "03T061", "03T069", "03T093",
> "03T103", "03T114", "03T117", "03T126", "040004", "040007", "040010",
> "040011", "040016", "040022", "040026", "040027", "040029", "040036",
> "040041", "040047", "040055", "040062", "040072", "040080", "040084",
> "040088", "040091", "040114", "040118", "040119", "043028", "044005",
> "04S027", "04S084", "04T041", "04T062", "04T119", "050002", "050006",
> "050007", "050008", "050009", "050013", "050014", "050016", "050017",
> "050018", "050022", "050024", "050025", "050026", "050030", "050036",
> "050038", "050039", "050040", "050042", "050043", "050045", "050046",
> "050047", "050055", "050056", "050057", "050058", "050060", "050063",
> "050069", "050070", "050071", "050073", "050075", "050076", "050077",
> "050078", "050079", "050082", "050084", "050089", "050090", "050091",
> "050093", "050099", "050100", "050101", "050102", "050103", "050104",
> "050107", "050108", "050110", "050111", "050112", "050113", "050115",
> "050116", "050118", "050121", "050122", "050124", "050125", "050126",
> "050128", "050129", "050131", "050132", "050133", "050135", "050136",
> "050137", "050138", "050139", "050140", "050145", "050146", "050149",
> "050150", "050152", "050153", "050158", "050159", "050168", "050169",
> "050174", "050179", "050180", "050188", "050191", "050193", "050195",
> "050196", "050197", "050204", "050211", "050219", "050222", "050224",
> "050225", "050226", "050228", "050230", "050231", "050232", "050234",
> "050235", "050236", "050238", "050239", "050242", "050243", "050245",
> "050248", "050254", "050257", "050261", "050262", "050264", "050272",
> "050276", "050277", "050278", "050279", "050280", "050283", "050289",
> "050290", "050291", "050292", "050295", "050296", "050298", "050300",
> "050301", "050305", "050308", "050309", "050313", "050315", "050320",
> "050324", "050327", "050329", "050334", "050335", "050336", "050342",
> "050348", "050351", "050352", "050353", "050359", "050360", "050366",
> "050367", "050373", "050376", "050378", "050380", "050382", "050385",
> "050390", "050393", "050394", "050396", "050397", "050414", "050417",
> "050424", "050425", "050426", "050434", "050435", "050438", "050441",
> "050444", "050448", "050454", "050455", "050457", "050464", "050468",
> "050471", "050481", "050485", "050488", "050492", "050496", "050498",
> "050502", "050503", "050506", "050510", "050512", "050515", "050516",
> "050517", "050523", "050526", "050528", "050531", "050534", "050537",
> "050541", "050543", "050549", "050551", "050552", "050557", "050567",
> "050570", "050573", "050575", "050580", "050581", "050586", "050588",
> "050589", "050590", "050597", "050599", "050603", "050604", "050608",
> "050609", "050616", "050618", "050624", "050625", "050633", "050636",
> "050644", "050660", "050663", "050674", "050678", "050680", "050684",
> "050688", "050689", "050690", "050696", "050697", "050701", "050704",
> "050708", "050709", "050710", "050714", "050723", "050724", "050726",
> "050727", "050732", "050735", "050737", "050738", "050739", "050740",
> "050742", "050744", "050745", "050746", "050747", "050751", "050752",
> "050755", "050757", "050758", "050760", "050761", "050763", "050764",
> "050765", "051300", "051302", "051303", "051305", "051306", "051308",
> "051310", "051311", "051315", "051316", "051317", "051318", "051319",
> "051320", "051321", "051323", "051324", "051326", "051327", "051328",
> "051330", "052031", "052032", "052033", "052034", "052035", "052036",
> "052037", "052038", "052039", "052043", "052044", "052045", "052046",
> "052047", "052049", "052050", "052051", "052052", "053027", "053031",
> "053032", "053034", "053301", "053305", "054009", "054032", "054053",
> "054055", "054069", "054074", "054075", "054077", "054078", "054087",
> "054093", "054095", "054096", "054104", "054110", "054111", "054123",
> "054131", "054135", "054144", "054145", "054146", "05S007", "05S025",
> "05S026", "05S038", "05S047", "05S057", "05S069", "05S077", "05S078",
> "05S089", "05S116", "05S124", "05S127", "05S128", "05S145", "05S152",
> "05S159", "05S193", "05S205", "05S228", "05S239", "05S245", "05S283",
> "05S305", "05S320", "05S329", "05S360", "05S373", "05S380", "05S426",
> "05S438", "05S464", "05S624", "05S625", "05S636", "05S644", "05S727",
> "05S744", "05S745", "05S747", "05S752", "05T007", "05T008", "05T017",
> "05T024", "05T026", "05T038", "05T039", "05T057", "05T058", "05T063",
> "05T100", "05T115", "05T116", "05T180", "05T191", "05T204", "05T235",
> "05T248", "05T278", "05T305", "05T309", "05T327", "05T348", "05T380",
> "05T457", "05T485", "05T503", "05T549", "05T603", "05T624", "05T625",
> "05T737", "05T752", "05T757", "060001", "060003", "060006", "060009",
> "060010", "060011", "060012", "060013", "060014", "060015", "060020",
> "060022", "060023", "060024", "060027", "060028", "060030", "060031",
> "060032", "060034", "060054", "060064", "060065", "060075", "060100",
> "060103", "060104", "060112", "060114", "060119", "061312", "061324",
> "061327", "062009", "062011", "062015", "063027", "064007", "064018",
> "064024", "06S001", "06S009", "06S010", "06S020", "06S027", "06T015",
> "070002", "070003", "070006", "070007", "070008", "070010", "070011",
> "070018", "070020", "070022", "070024", "070027", "070028", "070029",
> "070033", "070034", "070035", "074003", "080001", "080004", "080007",
> "090001", "090004", "090005", "090011", "09S005", "100001", "100002",
> "100006", "100007", "100008", "100009", "100012", "100014", "100017",
> "100018", "100019", "100022", "100023", "100025", "100026", "100029",
> "100030", "100032", "100034", "100035", "100038", "100039", "100043",
> "100044", "100045", "100047", "100050", "100052", "100053", "100055",
> "100057", "100067", "100068", "100070", "100072", "100073", "100075",
> "100076", "100084", "100086", "100087", "100090", "100105", "100110",
> "100113", "100118", "100122", "100124", "100125", "100126", "100128",
> "100131", "100135", "100137", "100150", "100151", "100154", "100156",
> "100157", "100161", "100168", "100173", "100176", "100177", "100180",
> "100181", "100183", "100187", "100191", "100204", "100210", "100212",
> "100213", "100220", "100223", "100224", "100228", "100230", "100239",
> "100242", "100243", "100244", "100246", "100248", "100249", "100252",
> "100253", "100255", "100256", "100260", "100265", "100266", "100268",
> "100271", "100288", "100289", "100290", "100296", "102017", "102022",
> "103028", "103036", "103039", "104015", "104016", "104026", "104040",
> "104063", "104065", "104067", "10S006", "10S022", "10S034", "10S067",
> "10S087", "10S131", "10S157", "10S223", "10T022", "10T034", "10T068",
> "10T173", "10T213", "110010", "110024", "110028", "110035", "110040",
> "110041", "110043", "110082", "110083", "110087", "110122", "110161",
> "110164", "110165", "110183", "110184", "110187", "110192", "110198",
> "110209", "110215", "110219", "110225", "110230", "111336", "114010",
> "114012", "11S010", "11S034", "11S076", "11S115", "11S122", "120001",
> "120002", "120004", "120005", "120006", "120007", "120014", "120019",
> "120022", "120026", "120027", "120028", "123300", "124001", "130002",
> "130006", "130007", "130013", "130014", "130018", "130024", "130025",
> "130028", "130049", "130065", "131307", "131308", "131310", "131312",
> "131313", "131316", "131319", "131323", "131325", "131326", "131327",
> "132002", "133025", "134002", "134014", "13T049", "140007", "140008",
> "140010", "140012", "140029", "140030", "140034", "140048", "140053",
> "140054", "140062", "140080", "140082", "140083", "140084", "140088",
> "140093", "140095", "140101", "140103", "140113", "140114", "140115",
> "140116", "140117", "140118", "140119", "140120", "140122", "140124",
> "140127", "140130", "140133", "140145", "140148", "140162", "140166",
> "140172", "140176", "140177", "140179", "140180", "140182", "140184",
> "140185", "140186", "140187", "140189", "140191", "140197", "140200",
> "140202", "140206", "140208", "140211", "140213", "140223", "140231",
> "140233", "140239", "140240", "140242", "140251", "140252", "140258",
> "140276", "140281", "140286", "140288", "140290", "140292", "141303",
> "141310", "141312", "141326", "141343", "141346", "142006", "143027",
> "144005", "144009", "144026", "144031", "14S007", "14S015", "14S054",
> "14S095", "14S119", "14S174", "14S208", "14S242", "14T010", "14T082",
> "14T258", "150002", "150003", "150004", "150008", "150021", "150033",
> "150034", "150035", "150044", "150045", "150046", "150047", "150048",
> "150056", "150057", "150058", "150076", "150082", "150084", "150088",
> "150090", "150102", "150125", "150126", "150150", "150162", "151303",
> "151312", "151315", "152007", "154050", "15S015", "15S021", "15T002",
> "15T046", "15T074", "15T125", "160016", "160024", "160029", "160030",
> "160033", "160047", "160058", "160064", "160082", "160083", "160146",
> "161307", "161326", "161353", "161365", "161372", "161377", "161380",
> "162001", "16S040", "170001", "170006", "170016", "170027", "170040",
> "170049", "170058", "170086", "170094", "170104", "170122", "170123",
> "170142", "170145", "170146", "170150", "170185", "170192", "170197",
> "171341", "171366", "171376", "171379", "171380", "171381", "173026",
> "173028", "174010", "17M374", "17M376", "17M381", "180009", "180011",
> "180012", "180013", "180017", "180027", "180040", "180045", "180066",
> "180067", "180088", "180093", "180104", "180130", "180141", "181320",
> "184007", "184008", "18S040", "18S067", "190005", "190026", "190036",
> "190039", "190041", "190054", "190065", "190098", "190102", "190111",
> "190118", "190125", "190144", "190146", "190160", "190176", "190202",
> "190236", "190274", "191305", "191309", "191314", "191323", "192030",
> "192043", "192045", "192049", "194020", "194044", "194071", "194074",
> "194097", "194099", "19S037", "19S064", "19T125", "200008", "200009",
> "200033", "200039", "201306", "204005", "204006", "210001", "210002",
> "210004", "210008", "210009", "210012", "210015", "210016", "210019",
> "210022", "210023", "210025", "210027", "210029", "210032", "210039",
> "210040", "210044", "210048", "210054", "210055", "210056", "210057",
> "210061", "213028", "220001", "220002", "220012", "220017", "220031",
> "220046", "220049", "220060", "220063", "220066", "220067", "220071",
> "220075", "220080", "220083", "220084", "220086", "220088", "220095",
> "220100", "220101", "220108", "220110", "220116", "220126", "220171",
> "222046", "223027", "224007", "224018", "224021", "224023", "224038",
> "22S011", "22S066", "22S070", "22S086", "22S116", "230002", "230004",
> "230013", "230015", "230017", "230019", "230020", "230024", "230029",
> "230031", "230035", "230038", "230041", "230046", "230053", "230054",
> "230055", "230066", "230070", "230077", "230081", "230089", "230092",
> "230095", "230097", "230099", "230101", "230104", "230105", "230130",
> "230132", "230141", "230142", "230146", "230156", "230165", "230167",
> "230193", "230195", "230197", "230207", "230227", "230230", "230236",
> "230254", "230269", "230270", "230273", "230277", "230302", "231316",
> "232030", "234011", "234021", "234038", "234039", "23S029", "23S041",
> "23S097", "23S121", "23S135", "23S165", "23S167", "23S193", "23S207",
> "23S254", "23T132", "240002", "240004", "240010", "240022", "240030",
> "240036", "240038", "240040", "240047", "240050", "240053", "240057",
> "240061", "240066", "240075", "240076", "240078", "240080", "240088",
> "240115", "240207", "240210", "240213", "241360", "241362", "241370",
> "242004", "244009", "24M329", "24S004", "24S080", "24T080", "250007",
> "250019", "250031", "250040", "250042", "250048", "250050", "250082",
> "250095", "250096", "250099", "250117", "250141", "254007", "25S100",
> "260001", "260005", "260006", "260009", "260017", "260021", "260023",
> "260025", "260027", "260032", "260040", "260047", "260048", "260065",
> "260068", "260077", "260081", "260091", "260094", "260096", "260102",
> "260104", "260105", "260108", "260110", "260119", "260141", "260176",
> "260177", "260179", "260180", "260186", "260190", "260191", "260195",
> "260200", "260209", "260210", "260216", "261302", "261304", "261309",
> "261313", "261326", "262017", "264008", "264012", "264016", "264017",
> "264025", "26S020", "26S032", "26S048", "26S062", "26S104", "26S105",
> "26S180", "26S195", "26S210", "26T005", "270003", "270004", "270012",
> "270014", "270017", "270023", "270032", "270049", "270051", "270057",
> "271301", "271306", "271316", "271318", "271324", "271328", "271335",
> "271340", "271345", "274086", "27S014", "27T014", "27T049", "27T051",
> "280003", "280009", "280013", "280020", "280040", "280060", "280061",
> "280065", "280081", "280105", "280111", "280125", "281329", "281332",
> "281357", "28S003", "28S009", "28S065", "290001", "290002", "290003",
> "290005", "290006", "290007", "290008", "290009", "290012", "290019",
> "290020", "290021", "290022", "290027", "290032", "290039", "290041",
> "290045", "290046", "290047", "290049", "290051", "290053", "290054",
> "290055", "2900V0", "291300", "291301", "291302", "291303", "291304",
> "291306", "291307", "291308", "291309", "291311", "292002", "292003",
> "292004", "292006", "292007", "292008", "293026", "293032", "293033",
> "294000", "294002", "294003", "294008", "294009", "294010", "294011",
> "29S005", "29S019", "29S032", "29T003", "29T007", "29T009", "29T012",
> "29T019", "29T041", "29T046", "29T049", "300003", "300017", "300019",
> "300020", "301308", "301309", "301312", "304001", "30S029", "30T019",
> "310001", "310010", "310012", "310017", "310034", "310038", "310039",
> "310041", "310045", "310047", "310048", "310050", "310054", "310057",
> "310060", "310064", "310070", "310075", "310081", "310083", "310086",
> "310096", "310108", "310110", "310111", "310112", "310113", "313025",
> "313029", "313030", "314011", "314012", "314022", "31S027", "31S040",
> "31S058", "31S064", "31S081", "31S083", "31S111", "31T034", "320001",
> "320002", "320003", "320005", "320006", "320009", "320014", "320017",
> "320018", "320021", "320022", "320038", "320065", "320069", "320074",
> "320085", "320086", "323027", "323032", "32S021", "330002", "330005",
> "330011", "330013", "330014", "330019", "330024", "330028", "330043",
> "330044", "330045", "330046", "330055", "330057", "330059", "330073",
> "330078", "330085", "330101", "330102", "330103", "330104", "330106",
> "330119", "330125", "330126", "330127", "330128", "330140", "330141",
> "330153", "330154", "330158", "330159", "330160", "330162", "330163",
> "330164", "330167", "330169", "330182", "330184", "330185", "330188",
> "330193", "330194", "330195", "330196", "330198", "330203", "330205",
> "330208", "330214", "330215", "330219", "330222", "330223", "330224",
> "330225", "330226", "330229", "330231", "330234", "330236", "330249",
> "330259", "330261", "330264", "330265", "330270", "330273", "330279",
> "330285", "330286", "330290", "330304", "330307", "330316", "330331",
> "330340", "330353", "330372", "330386", "330390", "330393", "330394",
> "334009", "334020", "33S006", "33S028", "33S044", "33S101", "33S108",
> "33S157", "33S160", "33S198", "33S199", "33S204", "33S219", "33S226",
> "33S231", "33S241", "33S290", "33T027", "33T043", "33T046", "33T160",
> "33T219", "33T234", "33T259", "33T404", "33T405", "340001", "340002",
> "340004", "340014", "340021", "340028", "340030", "340032", "340040",
> "340050", "340051", "340053", "340061", "340064", "340070", "340073",
> "340090", "340091", "340098", "340113", "340114", "340115", "340119",
> "340121", "340131", "340141", "340142", "340143", "340145", "340171",
> "340183", "343025", "343026", "344001", "344016", "34S155", "34T061",
> "350002", "350006", "350015", "350019", "351335", "351336", "35S002",
> "360001", "360003", "360006", "360008", "360009", "360012", "360016",
> "360017", "360019", "360020", "360027", "360032", "360035", "360048",
> "360051", "360052", "360055", "360056", "360059", "360064", "360075",
> "360076", "360077", "360079", "360080", "360082", "360084", "360085",
> "360087", "360091", "360095", "360098", "360101", "360112", "360115",
> "360118", "360123", "360125", "360132", "360133", "360137", "360141",
> "360143", "360144", "360145", "360152", "360155", "360159", "360161",
> "360163", "360172", "360179", "360180", "360203", "360212", "360218",
> "360230", "360262", "361326", "361333", "362004", "362015", "362026",
> "362028", "362029", "364029", "36S074", "36S081", "36S137", "36S163",
> "36T059", "36T079", "36T082", "36T179", "36T195", "370001", "370006",
> "370008", "370013", "370014", "370023", "370025", "370028", "370032",
> "370034", "370037", "370048", "370054", "370056", "370078", "370089",
> "370091", "370093", "370094", "370106", "370114", "370149", "370166",
> "370190", "370202", "370211", "370215", "370227", "371312", "371314",
> "371323", "373025", "374020", "37S006", "37S037", "37S148", "37T025",
> "37T056", "37T106", "380001", "380002", "380004", "380005", "380007",
> "380009", "380014", "380017", "380018", "380020", "380022", "380025",
> "380027", "380029", "380037", "380038", "380040", "380047", "380050",
> "380051", "380052", "380056", "380060", "380061", "380071", "380075",
> "380082", "380089", "380090", "380102", "381305", "381306", "381307",
> "381309", "381316", "381319", "381322", "381323", "382004", "38S007",
> "38S017", "38S033", "38S060", "38S061", "38T018", "38T075", "390003",
> "390006", "390009", "390028", "390036", "390037", "390041", "390042",
> "390044", "390045", "390049", "390056", "390057", "390063", "390072",
> "390073", "390076", "390079", "390081", "390090", "390097", "390100",
> "390101", "390107", "390111", "390113", "390119", "390123", "390127",
> "390133", "390137", "390145", "390146", "390151", "390153", "390156",
> "390160", "390162", "390164", "390168", "390174", "390178", "390201",
> "390219", "390225", "390226", "390228", "390231", "390237", "390256",
> "390258", "390265", "390270", "390272", "390278", "390290", "390313",
> "390318", "392043", "393025", "393040", "394034", "394050", "394051",
> "39S027", "39S037", "39S044", "39S050", "39S097", "39S226", "39T111",
> "39T228", "400004", "400125", "410007", "410009", "410010", "410011",
> "410012", "414000", "420004", "420007", "420009", "420027", "420048",
> "420051", "420065", "420073", "420078", "420079", "420080", "420082",
> "420087", "42S018", "430013", "430014", "430015", "430016", "430027",
> "430048", "430077", "431325", "434003", "43S014", "43S077", "440025",
> "440029", "440034", "440035", "440039", "440048", "440049", "440053",
> "440056", "440059", "440063", "440073", "440082", "440083", "440120",
> "440133", "440150", "440173", "440185", "440193", "442010", "444002",
> "444004", "44S082", "44S161", "44T125", "450002", "450007", "450010",
> "450011", "450018", "450021", "450024", "450029", "450033", "450034",
> "450035", "450037", "450039", "450040", "450046", "450052", "450054",
> "450056", "450058", "450064", "450076", "450079", "450082", "450083",
> "450087", "450092", "450099", "450101", "450102", "450104", "450107",
> "450130", "450132", "450133", "450135", "450152", "450184", "450193",
> "450203", "450209", "450213", "450221", "450224", "450231", "450237",
> "450280", "450289", "450299", "450324", "450340", "450346", "450358",
> "450388", "450395", "450403", "450431", "450446", "450451", "450462",
> "450469", "450484", "450518", "450530", "450563", "450571", "450573",
> "450587", "450604", "450610", "450617", "450630", "450634", "450638",
> "450639", "450646", "450647", "450658", "450662", "450668", "450670",
> "450672", "450675", "450678", "450684", "450686", "450709", "450713",
> "450716", "450723", "450775", "450779", "450788", "450809", "450820",
> "450847", "450855", "450865", "450867", "450877", "451342", "451369",
> "452044", "452049", "452051", "452060", "452063", "452079", "452086",
> "453029", "453038", "453056", "453072", "453099", "454000", "454006",
> "454064", "454081", "454083", "454084", "454094", "454100", "454103",
> "454108", "45S035", "45S039", "45S054", "45S130", "45S209", "45S324",
> "45S358", "45S424", "45S639", "45T058", "45T107", "45T184", "45T571",
> "460001", "460003", "460004", "460005", "460006", "460007", "460009",
> "460010", "460011", "460013", "460015", "460017", "460018", "460021",
> "460023", "460026", "460030", "460033", "460035", "460041", "460042",
> "460044", "460047", "460049", "460051", "460052", "460054", "461301",
> "461303", "461304", "462004", "462005", "463025", "464009", "464012",
> "46S001", "46S003", "46S004", "46S009", "46S015", "46S021", "46T009",
> "46T021", "46T041", "470003", "471304", "480001", "490004", "490011",
> "490017", "490020", "490024", "490033", "490040", "490042", "490043",
> "490045", "490046", "490050", "490052", "490059", "490060", "490063",
> "490069", "490093", "490094", "490107", "490113", "490118", "490120",
> "490122", "490136", "491300", "494001", "49S002", "49S021", "49S032",
> "49S043", "49S112", "49S120", "49S122", "49T050", "500001", "500002",
> "500003", "500005", "500008", "500011", "500012", "500014", "500015",
> "500016", "500019", "500021", "500024", "500025", "500027", "500030",
> "500031", "500033", "500036", "500037", "500039", "500041", "500044",
> "500050", "500051", "500053", "500054", "500058", "500064", "500072",
> "500077", "500079", "500084", "500088", "500108", "500119", "500124",
> "500129", "500141", "500150", "500151", "501309", "501314", "501333",
> "501334", "503025", "504003", "504009", "50S001", "50S015", "50T058",
> "50T079", "50T108", "510007", "510008", "510022", "510030", "510048",
> "510085", "511300", "511312", "511314", "511319", "514008", "520011",
> "520013", "520019", "520027", "520030", "520035", "520037", "520044",
> "520045", "520048", "520051", "520059", "520062", "520063", "520066",
> "520070", "520071", "520075", "520078", "520083", "520087", "520089",
> "520091", "520096", "520097", "520098", "520103", "520109", "520136",
> "520138", "520160", "520177", "521300", "521320", "521321", "521334",
> "521345", "521349", "521358", "524000", "524001", "524018", "524025",
> "52S088", "530002", "530008", "530009", "530012", "530014", "530015",
> "530025", "530032", "530033", "531304", "531312", "534004", "650001",
> "670006", "670023", "670024", "670034", "670041", "670043", "670044",
> "670046", "670047", "670055", "670899", "673033", "673034", "67T050"
> ), class = "factor"), CLAIM_NO = c(21L, 20L, 22L, 83L, 84L, 1440L,
> 1442L, 1441L, 4439L, 7002L, 9562L, 10463L, 10464L, 10462L, 12503L,
> 16195L, 22987L, 30759L, 30758L, 30756L, 30757L, 30760L, 30761L,
> 32108L, 32642L), NCH_NEAR_LINE_REC_IDEN_CD = structure(c(1L,
> 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
> 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), .Label = "V", class = "factor")),
.Names =
> c("DESY_SORT_KEY",
> "PRVDR_NUM", "CLAIM_NO", "NCH_NEAR_LINE_REC_IDEN_CD"), row.names = c(NA,

> 25L), class = "data.frame")
>
> Thanks for your feedback so far & hope these data samples further help.
It

> is most appreciated!
>
> --
> View this message in context: http://r.789695.n4.nabble.com/Merge-
> function-Return-NON-matches-tp4590755p4592934.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> [hidden email] 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.

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Merge function - Return NON matches

RHelpPlease
Hi again,
Petr, your solution worked!

Thanks everyone for your input.  I'll look more into "setdiff."

Cheers!
Loading...