简体   繁体   中英

How to write a dataFrame with nestest dataframe to csv in R

I've got a dataFrame via spotify api which contains the data of a playlist. I want to write the song title and the artist to a csv. problem is the dataframe contains a column track.artists which is a dataFrame itself with just one row, which contains a column whith the artist name.

so this doesnt work:

playlist %>%
   select(track.name, track.artist) %>%
   write.csv(path, row.names=FALSE)

I get the error "Unimplemented type 'list' in EncoderElement"

Does this work for you?

playlist %>%
  select(track.name, track.artist) %>%
  unnest(track.artist) %>% 
  write.csv(path, row.names=FALSE)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM