[R] scanning a data set for strings

Daniel_55 serna.danny at gmail.com
Wed May 2 13:45:09 CEST 2012


Hello,

I'm looking for what I'm sure is a quick answer. I'm working with a data set
that looks like this:

 Week              Game.ID                     VTm VPts HTm HPts
Differential HomeWin
1    1  NFL_20050908_OAK at NE   OAK   20      NE     30           10             
FALSE
2    1 NFL_20050911_ARI at NYG    ARI   19      NYG   42           23             
FALSE
3    1 NFL_20050911_CHI at WAS   CHI    7       WAS    9            2              
FALSE
4    1 NFL_20050911_CIN at CLE    CIN   27       CLE    13          -14           
FALSE
5    1  NFL_20050911_DAL at SD     DAL   28      SD      24           -4            
FALSE
6    1 NFL_20050911_DEN at MIA  DEN   10     MIA    34           24           
FALSE

NFL data. I want to pair each team with the points they received at home and
away and create another table showing this. I know it's easy to do, but all
the methods I am coming up with involve doing each team individually via a
for loop that searches for [i,5]=="NE", [i,5]=="NYG". I would then use the
same method to pair the same team code ("NYG" or "NE") with VPTs when it's
Visiting.

Thanks for the help.

--
View this message in context: http://r.789695.n4.nabble.com/scanning-a-data-set-for-strings-tp4602953.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list