How to plot a subset of a data frame in R?

前端 未结 4 2254
温柔的废话
温柔的废话 2020-12-13 05:48

Is there a simple way to do this in R:

plot(var1,var2, for all observations in the data frame where var3 < 155)

It is possible by creat

4条回答
  •  猫巷女王i
    2020-12-13 06:04

    with(dfr[dfr$var3 < 155,], plot(var1, var2)) should do the trick.

    Edit regarding multiple conditions:

    with(dfr[(dfr$var3 < 155) & (dfr$var4 > 27),], plot(var1, var2))
    

提交回复
热议问题