Exactly what I thought too the first time I read ?merge. R sometimes has its
own approach.
John Kane
Kingston ON Canada
> -Original Message-
> From: r-help@r-project.org
> Sent: Mon, 1 Jun 2015 14:47:07 + (UTC)
> To: li...@dewey.myzen.co.uk, r-help@r-project.org
>
You do not appear to understand what merge() does. Go through the worked
examples in ?merge so that you do.
FWIW, I would agree that the Help file is cryptic and difficult to
understand. Perhaps going through a tutorial on database "join" operations
might help.
Cheers,
Bert
Bert Gunter
"Data is
I understood that by would take the intersection of names(x) and names(y),
names(x) being the column names of x and names(y), column names of y.
if x has 5 col and the col names of x are col1, col2... col5 and y has 3 col
and their names are col1, col2, col3, I thought that the merged data set wi
On 01/06/2015 14:46, carol white via R-help wrote:
Hi,By default the merge function should take the intersection of column names
(if this is understood from by = intersect(names(x), names(y)),
Dear Carol
The by parameter specifies which columns are used to merge by. Did you
understand it t
> Sent: Mon, 1 Jun 2015 06:29:41 -0800
> To: wht_...@yahoo.com, r-help@r-project.org
> Subject: RE: [R] merge function
>
> As Burt says it is not exactly clear what you want but is something like
> this what you are looking for?
>
> dat1 <- data.frame(aa = c
As Burt says it is not exactly clear what you want but is something like this
what you are looking for?
dat1 <- data.frame(aa = c("a", "b", "c"), bb = 1:3)
dat2 <- data.frame(xx = c("b", "c", "d"), yy = 3:1)
merge(dat1, dat2, by.x = "aa", by.y = "xx")
For further reference here are some sugg
1. Please read and follow the posting guide.
2. Reproducible example? (... at least I don't understand what you mean)
3. Plain text, not HTML.
Cheers,
Bert
Bert Gunter
"Data is not information. Information is not knowledge. And knowledge is
certainly not wisdom."
-- Clifford Stoll
On Mon,
Take a look at your data. When I loaded what you attached, there were only
9 species that were in common across the two files:
> dim(s16)
[1] 226 83
> dim(s15)
[1] 96 41
> sum(s15$species %in% s16$species)
[1] 10
> sum(s16$species %in% s15$species)
[1] 10
> length(intersect(s16$species, s15$spec
Below , in line
John Kane
Kingston ON Canada
> -Original Message-
> From: michael.eisenr...@gmx.ch
> Sent: Thu, 14 Mar 2013 11:51:49 +0100
> To: r-help@r-project.org
> Subject: [R] merge function to combine two tables
>
> Dear R-help members
>
> I would be grateful if anyone could help
id Name Age
1 2 Ken 45
2 3 Leo 49
Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
> Behalf
> Of Dan Abner
> Sent: Monday, March 11, 2013 2:02 PM
> To:
intersect(names(data1),names(data2))
---
Jeff NewmillerThe . . Go Live...
DCN:Basics: ##.#. ##.#. Live Go...
Live: OO#.. Dead: OO
Ok, let's say I only want the common columns from data1. Is there a
succinct way of doing this for potentially hundreds of "in common"
columns?
On Mon, Mar 11, 2013 at 3:25 PM, Ista Zahn wrote:
> On Mon, Mar 11, 2013 at 3:17 PM, Dan Abner wrote:
>> Hi everyone,
>>
>> I have the following call
On Mon, Mar 11, 2013 at 3:17 PM, Dan Abner wrote:
> Hi everyone,
>
> I have the following call to the merge() function. How does one
> prevent duplicate columns in the resulting data frame that the 2
> parent data frames have in common but are not true key or "by"
> variables?
>
>
> data3<-merge(d
Hi again,
Petr, your solution worked!
Thanks everyone for your input. I'll look more into "setdiff."
Cheers!
--
View this message in context:
http://r.789695.n4.nabble.com/Merge-function-Return-NON-matches-tp4590755p4593101.html
Sent from the R help mailing list archive at Nabble.com.
___
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
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
# 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"
)
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
O
Hi there,
Thanks for your responses. I haven't used/heard of dput() before. I'm
looking it up & understanding how it works.
Thanks!
--
View this message in context:
http://r.789695.n4.nabble.com/Merge-function-Return-NON-matches-tp4590755p4591003.html
Sent from the R help mailing list archive
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 wrote:
> Hi again,
> I tried the sample code like this:
>
>> merged_clmno <- subset(bestPartAreadmin, !CLAIM_NO %in% hrc78_clm_n
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)
>
Hi again,
I tried the sample code like this:
> merged_clmno <- subset(bestPartAreadmin, !CLAIM_NO %in% hrc78_clm_no)
> dim(merged_clmno)
[1] 1306893
Note that:
> dim(bestPartAreadmin)
[1] 1306893
So, no change between the original data.frame (bestPartAreadmin) & the
(should be) less-row
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 10193 290003 20090323 20
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 emai
On Jul 1, 2011, at 06:48 , Jeff Newmiller wrote:
> You haven't provided a reproducible example.
>
> I do notice you are using T and F which are variables that can be redefined
> (which is why TRUE and FALSE are preferred.
Also, if x and y really are "vectors" (I bet they're not, though), you'l
You haven't provided a reproducible example.
I do notice you are using T and F which are variables that can be redefined
(which is why TRUE and FALSE are preferred.
---
Jeff Newmiller The . . Go Live...
DCN: Basics: #
I was mistaken. There were duplicates in my y vector. Please ignore my
previous message. Sorry.
-Original Message-
From: Downey, Patrick
Sent: Thu 6/30/2011 11:08 PM
To: r-help@r-project.org
Subject: merge function
Hello,
I'm clearly confused about the merge function. In the following
Thanks Chuck,
I was trying to implement something more complicated than what I had to and
after finding the reduce() function in bioconductor, everything went
smoothly.
Thanks again
--
View this message in context:
http://r.789695.n4.nabble.com/merge-function-in-R-tp2324684p2327133.html
Sent
On Fri, 13 Aug 2010, fishkbob wrote:
So I have a bunch of c(start,end) points and want to consolidate them into as
few c(start,end) as possible.
For example:
sample startend
A 5 10
B 7 18
C 14
D 16 20
I'd want
Neither you nor your responder have continued the eamil chain very
well so let me put things back together:
on Aug 13, 2010; 03:54pm fishkbob wrote subj = merge function in R?
So I have a bunch of c(start,end) points and want to consolidate
them into as few c(start,end) as possible.
For ex
I too think I worded it incorrectly...
so the second two columns of the matrix are the start and end of an interval
however, because some of the intervals overlap, I want to limit the number
of intervals I have to deal with.
So therefore,
(5 10)should merge with(7 18) making
I think it would be helpful if you could clarify youre question - do you want
distinct sets - maybe use
unique()
but why (5,20) when its (5,10) in the row in youre example? What criteria do
you want the function to select the "sets" by and what kind of output do you
need?
Maybe it's just me w
32 matches
Mail list logo