I probably didn't provide enough on my original post. I didnt mean to imply it's the name of columns I wanted. What I was planning to do was to create a list of column names, c2 <- c("names", "height", "films", ..), and select from the list of named lists, sw_people ( from repurrrsive package ). Selecting a single column is easily done with sw_people %>% map("name"), but selecting more than one column will result in "recursive indexing failed at level 2"...
sw_people is structured as follows:
> sw_people[1:2]
[[1]]
[[1]]$name
[1] "Luke Skywalker"
[[1]]$height
[1] "172"
[[1]]$films
[1] "http://swapi.co/api/films/6/" "http://swapi.co/api/films/3/" "http://swapi.co/api/films/2/" "http://swapi.co/api/films/1/"
[5] "http://swapi.co/api/films/7/"
[[1]]$mass
140
[[1]]$species
human
[[2]]
[[2]]$name
[1] "C-3PO"
[[2]]$height
[1] "167"
[[2]]$films
[1] "http://swapi.co/api/films/5/" "http://swapi.co/api/films/4/" "http://swapi.co/api/films/6/" "http://swapi.co/api/films/3/"
[5] "http://swapi.co/api/films/2/" "http://swapi.co/api/films/1/"
[[2]]$mass
130
[[2]]$species
droid
And what I wanted to do was what sw_people %>% transpose() would produce.
If I have nms <- c("name", "height", "films"), the result will be,
name = list("Luke Skywalker", "C3PO", "Chewie"...)
height = list(140, 145, 350, ...)
films = list(list(...), list(...), list(...), ...),
all enclosed in a single list or a tibble. I hope this is a bit more clear.