I have a set of names in last, first format
Name Pos Team Week.x Year.x GID.x h.a.x Oppt.x Week1Points DK.salary.x Week.y Year.y GID.y
1 Abdullah, Ameer RB det 1 2015 2995 a sdg 19.4 4000 2 2015 2995
2 Adams, Davante WR gnb 1 2015 5263 a chi 9.9 4400 2 2015 5263
3 Agholor, Nelson WR phi 1 2015 5378 a atl 1.5 5700 2 2015 5378
4 Aiken, Kamar WR bal 1 2015 5275 a den 0.9 3300 2 2015 5275
5 Ajirotutu, Seyi WR phi 1 2015 3877 a atl 0.0 3000 NA NA NA
6 Allen, Dwayne TE ind 1 2015 4551 a buf 10.7 3400 2 2015 4551
That is just the fist 6 lines. I would like to flip the names to First name Last Name. Here is what I tried.
> strsplit(DKPoints$Name, split = ",")
This splits the name variable, but there are white spaces, so to clear them I tried,
> str_trim(splitnames)
But the results did not come out right. Here is what they look like.
[1] "c(\"Abdullah\", \" Ameer\")" "c(\"Adams\", \" Davante\")"
[3] "c(\"Agholor\", \" Nelson\")" "c(\"Aiken\", \" Kamar\")"
[5] "c(\"Ajirotutu\", \" Seyi\")" "c(\"Allen\", \" Dwayne\")"
Any advice? I would like to get a column for the data frame to look like
Ameer Abdullah
Davabte Adams
Nelson Agholor
Kamar Aiken
Any advice would be much appreciated. Thanks