[R] Unique subsetting question
Ista Zahn
izahn at psych.rochester.edu
Wed Sep 22 20:34:37 CEST 2010
Hi Andrew,
Perhaps you did not notice my previous email. The answer is still the
same (see below):
On Wed, Sep 22, 2010 at 1:48 PM, AndrewPage <savejarvis at yahoo.com> wrote:
>
> How about this:
>
>
> s = c("aa", "bb", "cc", "", "aa", "dd", "", "aa")
>
> n = c(2, 3, 5, 6, 7, 8, 9, 3)
>
> b = c(TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE)
>
> df = data.frame(n, s, b) # df is a data frame
>
>
> I want to display df with no value in s occurring more than once.
df <- df[!duplicated(df$s),]
Also, I
> want to delete the rows where s contains "".
Same idea here:
df[s != "",]
-Ista
> --
> View this message in context: http://r.789695.n4.nabble.com/Unique-subsetting-question-tp2550453p2550769.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at 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, self-contained, reproducible code.
>
--
Ista Zahn
Graduate student
University of Rochester
Department of Clinical and Social Psychology
http://yourpsyche.org
More information about the R-help
mailing list