I would like to merge two dataframes, but i have a condition that needs to
used for the merge as well.
the rows (observations) in each dataframe are identified by each person's ID
and by the date of the observation.
Basically I would like it to be merged based on both ID (exact match) and
date
best try so far is to do:
tempA <- aggregate(dataA$unique.id,list(dataA$unique.id),length)
which gives me a matrix with ONE instance of each unique.id and the
counts...
(and which I thought was kinda cute)
but it only works for within a single dataset!
tathta wrote:
>
> I have t
Close...
The output I'm looking for is more like this:
output <-
data.frame(unique.id=c(1,3,5,7,9),N.in.x=c(2,3,1,2,1),N.in.y=c(0,1,3,1,1))
The first column can be gotten using a small change to the first table line:
table ( x [ which ( x %in% x ) ] ) ##the 3rd "x" used to be a "y"
but
I have two dataframes, the first column of each dataframe is a unique id
number (the rest of the columns are data variables).
I would like to figure out how many times each id number appears in each
dataframe.
So far I can use:
length( match (dataframeA$unique.id[1], dataframeB$unique.id) )
4 matches
Mail list logo