Re: [R] Help with creating subset of a data frame

2018-07-09 Thread Bert Gunter
%in% instead of == ?"%in%" Cheers, Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Mon, Jul 9, 2018 at 3:35 PM, Bhaskar Mitra wrote: > Hello

[R] Help with creating subset of a data frame

2018-07-09 Thread Bhaskar Mitra
Hello Everyone, I am trying to create a subset of a data frame (df1) based on the first three unique values in the first column (v1). Here are my codes: b <- unique(df1$v1)[1:3] df2 <- subset(df1,df1$v1==b) df1: v1 v2v3 1 ab 1 a1 b1 2 a2 b2 2 a3 b3 3 a4 b4