Minus operation of data frames

前端 未结 7 742
忘掉有多难
忘掉有多难 2020-12-05 18:53

I have 2 data frames df1 and df2.

df1 <- data.frame(c1=c(\"a\",\"b\",\"c\",\"d\"),c2=c(1,2,3,4) )
df2 <- data.frame(c1=c(\"         


        
7条回答
  •  再見小時候
    2020-12-05 19:08

    If you're not planning on using any of the actual data in d2, then you don't need merge at all:

    df1[!(df1$c1 %in% df2$c1), ]
    

提交回复
热议问题