I have read similar headings and unfortunately couldnt find an answer. The problem is that i have the following data:
[,1] [,2] [,3] [,4] [,5] HomeTeam "Arsenal" "Leicester" "Man United" "QPR" "Stoke" AwayTeam "Crystal Palace" "Everton" "Swansea" "Hull" "Aston Villa" and i want it to be as follows:
Teams Opponent HomeTeam Arsenal Crystal Palace AwayTeam Crystal Palace Arsenal HomeTeam1 Leicester Everton AwayTeam1 Everton Leicester HomeTeam2 Man United Swansea AwayTeam2 Swansea Man United i have tried the following command but its incorrect, just to give you an idea what i am trying to do:
odd <- seq(1, 759, by = 2) even <- seq(2, 270, by = 2) df <- data.frame(team = df_1[odd,1], opponent = df_1[even,1]) Question is: how can i modify the command above ? Or can u suggest me any other code. Thanks in advance!
t. Also??transposewould have given you the answer to "how to transpose data?".