R: subsetting data frame by both certain column names (as a variable) and field values

前端 未结 1 380
闹比i
闹比i 2021-01-27 18:49

I have list of names and I have a data frame with colnames that match sometimes the names in the list. Now I want to subset the data frame based on two criteria: the colnames (a

1条回答
  •  [愿得一人]
    2021-01-27 19:27

    Use the old-fashioned [ and [[ operators:

    name <- "name1"
    df[df[[name]] > 1.5, ]
    (etc)
    

    0 讨论(0)
提交回复
热议问题