I have a list that looks that has many parts to it. My goal is to replace the values within each $section with NA. I want to keep the headers though.
The list looks like this:
$href
[1] "https://api.spotify.com/v1/albums/4vucVTj5GjNV0MllVjsxo5/tracks?offset=0&limit=50"
$items
artists
1 https://open.spotify.com/artist/2ueoLVCXQ948OfhVvAy3Nn, https://api.spotify.com/v1/artists/2ueoLVCXQ948OfhVvAy3Nn, 2ueoLVCXQ948OfhVvAy3Nn, Perfume Genius, artist, spotify:artist:2ueoLVCXQ948OfhVvAy3Nn
2 https://open.spotify.com/artist/2ueoLVCXQ948OfhVvAy3Nn, https://api.spotify.com/v1/artists/2ueoLVCXQ948OfhVvAy3Nn, 2ueoLVCXQ948OfhVvAy3Nn, Perfume Genius, artist, spotify:artist:2ueoLVCXQ948OfhVvAy3Nn
available_markets
1 AD, AR, AT, AU, BE, BG, BO, BR, CA, CH, CL, CO, CR, CY, CZ, DE, DK, DO, EC, EE, ES, FI, FR, GB, GR, GT, HK, HN, HU, ID, IE, IS, IT, JP, LI, LT, LU, LV, MC, MT, MX, MY, NI, NL, NO, NZ, PA, PE, PH, PL, PT, PY, SE, SG, SK, SV, TR, TW, US, UY
2 AD, AR, AT, AU, BE, BG, BO, BR, CA, CH, CL, CO, CR, CY, CZ, DE, DK, DO, EC, EE, ES, FI, FR, GB, GR, GT, HK, HN, HU, ID, IE, IS, IT, JP, LI, LT, LU, LV, MC, MT, MX, MY, NI, NL, NO, NZ, PA, PE, PH, PL, PT, PY, SE, SG, SK, SV, TR, TW, US, UY
disc_number duration_ms explicit
spotify
1 1 166946 FALSE https://open.spotify.com/track/2QX2OeVkckAavMTJtbV7GX
2 1 224620 FALSE https://open.spotify.com/track/15yWH0t80xio9hCjOZpalj
href
id
1 https://api.spotify.com/v1/tracks/2QX2OeVkckAavMTJtbV7GX 2QX2OeVkckAavMTJtbV7GX
2 https://api.spotify.com/v1/tracks/15yWH0t80xio9hCjOZpalj 15yWH0t80xio9hCjOZpalj
name
1 Slip Away - Recorded at Spotify Studios NYC
2 Body's In Trouble - Recorded at Spotify Studios NYC
preview_url track_number type
1 https://p.scdn.co/mp3-preview/fc1e8a296749237d7558ecc09bc5244251d033de?cid=c432b36c21724d2989baf7d4d8a6bfd3 1 track
2 https://p.scdn.co/mp3-preview/ac154324daedaff11d9806367bc980293dfb491b?cid=c432b36c21724d2989baf7d4d8a6bfd3 2 track
uri
1 spotify:track:2QX2OeVkckAavMTJtbV7GX
2 spotify:track:15yWH0t80xio9hCjOZpalj
$limit
[1] 50
$`next`
named list()
$offset
[1] 0
$previous
named list()
$total
[1] 2
How do I convert this list to have only NA values for each row like this?
$href
[1] NA
$items
artists
1 NA
2 NA
available_markets
1 NA
2 NA
disc_number duration_ms explicit
spotify
1 NA
2 NA
href
id
1 NA
2 NA
name
1 NA
2 NA
preview_url track_number type
1 NA
2 NA
uri
1 NA
2 NA
$limit
[1] NA
$`next`
NA
$offset
[1] NA
$previous
NA
$total
[1] NA
Any help would be great to solve this issue. I know how to replace values for a dataframe but not for a list.
Thanks!