try this one,
`%ni%` - Negate(`%in%`)
Best,
baptiste
__
R-help@r-project.org 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,
Hi,
I would like to compare a column of data with a vector.
I have this data.frame for example;
x - data.frame(A = c(1:5), B = c(1,1,2,2,2))
Now I have a search vector:
search - c(1,3,5)
when I now try to get all the data-rows which have a 1, a 3, or a 5 in column A
and a 2 in column B,
I
Martin Batholdy wrote:
Hi,
I would like to compare a column of data with a vector.
I have this data.frame for example;
x - data.frame(A = c(1:5), B = c(1,1,2,2,2))
Now I have a search vector:
search - c(1,3,5)
when I now try to get all the data-rows which have a 1, a 3, or a 5 in column A
thanks!
Now I have one more question;
How can I do the reverse?
when %in% is == (for two vectors of different lengths); what is the equivalent
to != ?
On 21.03.2010, at 22:33, Erik Iverson wrote:
Martin Batholdy wrote:
Hi,
I would like to compare a column of data with a vector.
I
Martin Batholdy wrote:
thanks!
Now I have one more question;
How can I do the reverse?
when %in% is == (for two vectors of different lengths); what is the equivalent
to != ?
a %in% b returns a logical vector, so
!a %in% b
returns its negation. See order of precedence in ?Syntax.
Just read the help page:
?%in%
%w/o% - function(x,y) x[!x %in% y] #-- x without y
(1:10) %w/o% c(3,7,12)
--
David.
On Mar 21, 2010, at 5:57 PM, Martin Batholdy wrote:
thanks!
Now I have one more question;
How can I do the reverse?
when %in% is == (for two vectors of different lengths);
6 matches
Mail list logo