Quick question about subsetting via character-class

后端 未结 3 1571
情话喂你
情话喂你 2021-01-28 15:58

I think this is a super quick thing, but I figured I\'d ask since I can\'t for the life of me remember how to do it...

Suppose, I have a data.frame (call it, DF

3条回答
  •  旧巷少年郎
    2021-01-28 16:19

    DF$foo[1] tries to return the first element of the column named foo (which doesn't exist). You want DF[foo[1]].

提交回复
热议问题