Hello,

I am working with two different data frames, and I'd like to move data from
one to the other. Here is the first frame:

> head(five)
  Week              Game.ID VTm VPts HTm HPts HDifferential VDifferential
1    1  NFL_20050908_OAK@NE OAK   20  NE   30            10           -10
2    1 NFL_20050911_ARI@NYG ARI   19 NYG   42            23           -23
3    1 NFL_20050911_CHI@WAS CHI    7 WAS    9             2            -2
4    1 NFL_20050911_CIN@CLE CIN   27 CLE   13           -14            14
5    1  NFL_20050911_DAL@SD DAL   28  SD   24            -4             4
6    1 NFL_20050911_DEN@MIA DEN   10 MIA   34            24           -24
  VTm.f HTm.f average
1   OAK    NE 19.4375
2   ARI   NYG 19.4375
3   CHI   WAS 19.4375
4   CIN   CLE 19.4375
5   DAL    SD 19.4375
6   DEN   MIA 19.4375

and here is the other (aggregated means from the first frame).

> head(fiveINFO)
  HTm     HPts     VPts  average
1 ARI 19.87500 19.00000 19.43750
2 ATL 24.75000 19.12500 21.93750
3 BAL 19.37500 13.75000 16.56250
4 BUF 16.50000 17.37500 16.93750
5 CAR 25.12500 23.27273 24.19886
6 CHI 18.77778 14.00000 16.38889

For reference, this data is looking at NFL scores. I want to take the
averages in fiveINFO, frame two, and move them to the corresponding team in
the first frame. five is 266 rows long, while fiveINFO is 32 rows — fiveINFO
contains each HTm only once, while five contains each one 8-10 times,
depending on the number of home games each team plays. 

I'm imagining I'll need to use some kind of for loop for this, but
everything I'm doing is striking out. Help?

--
View this message in context: 
http://r.789695.n4.nabble.com/moving-data-from-one-frame-to-another-tp4625193.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to