last day (15 days later) » 

9:04 PM
0
A: Match values from list of data frames R

AidanGawronskiAgain still just for one column but solves your issue: games_list <- list() for(p in 1:length(para)) { # create the list of the same table over and over games_list[[p]] <- games # create the new column games_list[[p]]$Home.att <- NA # loop through for (g in 1:nrow(games_list[[p]])) {...

 
Seems to be working. Loops not my strong side, thanks.
 
Just beware that as it stands right now for(p in 1:length(para)) loops through each of the dataframes in para. Each time it is overwriting what was there previously. I didn't realize there would be matches in every df in para.
 
Just realized that one, is there a easy fix that it would just take correct parameters for correct dates? As there is parameters for each game date?
 
for(p in 1) will give you para 1, for(p in 2) will give you para 2 etc.
 
I understand that, but it will override "past" values each time? As that para list is made for those parameters to match dates in games.
 
9:04 PM
Just make 4 tables
 
I have 1500 length parameter list... This is minimal example. So maybe need to create new data frame, where to fill this data in.
 
see the revision.
 
Looks like now I will end up with correct parameters for that date. Don't want to bother more, thanks.
 
Want to chat?
I have a few minutes if I can help
 
No thats good, I think I can figure out how to subset thos lists only to contain correct values.
I have names for each list in names(para) and then just keep values for for that date / or name
 
9:06 PM
okay if you understand then that's cool
any questions about it? I don't know what you want really so doing the best I can
 
will visit again if I get stuck, hopefully that was the hard part
 
Were you hoping for one BIG dataframe?
what did you want the end result to be?
 
yeah, that was my goal
1 big data frame and home.att... are just new variables
but I can rbind those list as soon as I have cleared dubplicate rows from them
I think thats one way to do it
or I can just unlist them when I have kept only rows that match list name in them...
 
final_frame <- c()
for(x in 1:length(para)) {
row <- cbind(names(para)[x], games_list[[x]])
final_frame <- rbind(final_frame, row)
}
So that last bit can make a dataframe with the date, and the dataframe, and the new column
but before doing that add all the other columns to your "games_list"
Anyways I think you'll figure it out from here. I'll check in later.
 
Thanks, much appreciated
 

last day (15 days later) »