Hi Mark:
> However, if the dataframe contains non-unique rows (two rows with
> exactly the same values in each column) then the unique function will
> delete one of them and that may not be desirable.
In order to get information about equal rows between two dataframes
without removing duplicated
Hi Petr,
Many thanks for your help. I like your solution because (and I did not
know this) the unique function works on ALL the data at once (i.e.,
across all of the columns) which means I don't have to make a unique
ID field by pasting together all of the rows or run through all of the
columns it
On Thu, Dec 16, 2010 at 01:02:29PM -0600, Mark Na wrote:
> Hello,
>
> I have two dataframes DF1 and DF2 that should be identical but are not
> (DF1 has some rows that aren't in DF2, and vice versa). I would like
> to produce a new dataframe DF3 containing rows in DF1 that aren't in
> DF2 (and simi
Hello Mark,
This is how I do it but it's longer than your code :)
unique.rows <- function (df1, df2) {
# Returns any rows of df1 that are not in df2
out <- NULL
for (i in 1:nrow(df1)) {
found <- FALSE
for (j in 1:nrow(df2)) {
if (all(df1[i,] == df2[j,])) {
found <- T
4 matches
Mail list logo