将参数传递给r中的子集函数

时间:2016-03-25 01:46:30

标签: r dataframe

我的数据框如下:

         GRID_TYPE    GAME_ID GAME_EVENT_ID PLAYER_ID   PLAYER_NAME    TEAM_ID             TEAM_NAME PERIOD
1 Shot Chart Detail 0021500003             6    201939 Stephen Curry 1610612744 Golden State Warriors      1
2 Shot Chart Detail 0021500003             9    201939 Stephen Curry 1610612744 Golden State Warriors      1
3 Shot Chart Detail 0021500003            14    201939 Stephen Curry 1610612744 Golden State Warriors      1
4 Shot Chart Detail 0021500003            19    201939 Stephen Curry 1610612744 Golden State Warriors      1
5 Shot Chart Detail 0021500003            36    201939 Stephen Curry 1610612744 Golden State Warriors      1
6 Shot Chart Detail 0021500003            38    201939 Stephen Curry 1610612744 Golden State Warriors      1
7 Shot Chart Detail 0021500069             5    201939 Stephen Curry 1610612744 Golden State Warriors      1
8 Shot Chart Detail 0021500069           164    201939 Stephen Curry 1610612744 Golden State Warriors      2
9 Shot Chart Detail 0021500069           195    201939 Stephen Curry 1610612744 Golden State Warriors      2

我想将GAME_ID = "0021500003"

的数据框子集

所以我有gameID = "0021500003"

并使用playerDF<- subset(stephShot, GAME_ID == gameID )

但是我找回了一个空的数据框

当我使用playerDF<- subset(stephShot, GAME_ID =="0021500003" )时,它可以正常工作。

我尝试搜索google / SO并没有遇到任何问题。

我认为这是一个简单的修复,但需要一些帮助。

0 个答案:

没有答案