Skip to content
Prev 66965 / 398506 Next

need any advises for code optimization.

Hi again,

The arguments to %in% are in the wrong order in your version.  Because
of that, the statement
  row.names(to.drop) %in% row.names(whole)
will be TRUE for the first nrow(to.drop) elements, and FALSE for the remainder.

To fix it, just switch the order around, or use the simpler version:
  whole[!row.names(whole) %in% row.names(to.drop),]

The fact that your row names are different to the row indices in whole
will be what is causing the error when trying my variant.

Cheers,
Rich
On Apr 4, 2005 10:21 PM, Wladimir Eremeev <wl at eimb.ru> wrote: