I have a data.frame created from a list "y" using the code
map_dfr(y, ~as.data.frame(t(.x)))
The format works for me, but each column of the dataframe is itself a list, rather than the vector I'd like it to be. What can I do to flatten out each list such that I preserve the structure of my dataframe, but change the format of each column?
EDIT: Here's a small bit of the data in its current format. What I'm looking to do is unlist each variable into a vector so it takes the normal data.frame format.
structure(list(member_id = list("A000055", "A000361", "A000367",
"A000369", "A000210", "B001256", "B000013", "B001279", "B001269",
"B001282"), name = list("Robert B. Aderholt", "Rodney Alexander",
"Justin Amash", "Mark Amodei", "Robert E. Andrews", "Michele Bachmann",
"Spencer Bachus", "Ron Barber", "Lou Barletta", "Andy Barr"),
party = list("R", "R", "R", "R", "D", "R", "R", "D", "R",
"R"), state = list("AL", "LA", "MI", "NV", "NJ", "MN",
"AL", "AZ", "PA", "KY"), district = list("4", "5", "3",
"2", "1", "6", "6", "2", "11", "6"), cook_pvi = list(
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL), vote_position = list("No", "Yes", "No", "Yes",
"Yes", "No", "Yes", "Yes", "Yes", "Yes"), dw_nominate = list(
0.361, 0.331, 0.649, 0.376, -0.297, 0.584, 0.387, -0.123,
0.277, 0.485), bill_num = c("S47", "S47", "S47", "S47",
"S47", "S47", "S47", "S47", "S47", "S47"), bill_title = c("Violence Against Women Reauthorization Act of 2013",
"Violence Against Women Reauthorization Act of 2013", "Violence Against Women Reauthorization Act of 2013",
"Violence Against Women Reauthorization Act of 2013", "Violence Against Women Reauthorization Act of 2013",
"Violence Against Women Reauthorization Act of 2013", "Violence Against Women Reauthorization Act of 2013",
"Violence Against Women Reauthorization Act of 2013", "Violence Against Women Reauthorization Act of 2013",
"Violence Against Women Reauthorization Act of 2013")), row.names = c(NA, 10L), class = "data.frame")