-
Notifications
You must be signed in to change notification settings - Fork 31
/
.Rhistory
90 lines (90 loc) · 2.63 KB
/
.Rhistory
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
spotifyKey <- "182878ec396d424283c951d6769e9497"
spotifySecret <- "2a6d8f846edc4667ba9f0ba43cd7fe4c"
library(Rspotify)
library(httr)
library(jsonlite)
spotifyEndpoint <- oauth_endpoint(NULL,
"https://accounts.spotify.com/authorize",
"https://accounts.spotify.com/api/token")
spotifyToken <- spotifyOAuth("Spotify Analysis", spotifyKey, spotifySecret)
library(readr)
playlistURI <- read.csv("this-is-playlist-URI.csv", header = T, sep = ";")
# Empty dataframe
PlaylistSongs <- data.frame(PlaylistID = character(),
Musician = character(),
tracks = character(),
id = character(),
popularity = integer(),
artist = character(),
artistId = character(),
album = character(),
stringsAsFactors=FALSE)
View(PlaylistSongs)
# Getting each playlist
for (i in 1:nrow(playlistURI)) {
i <- cbind(PlaylistID = as.factor(playlistURI[i,2]),
Musician = as.factor(playlistURI[i,1]),
getPlaylistSongs("spotify",
playlistid = as.factor(playlistURI[i,2]),
token=spotifyToken))
PlaylistSongs <- rbind(PlaylistSongs, i)
}
View(PlaylistSongs)
View(PlaylistSongs)
# Empty dataframe
PlaylistSongs <- data.frame(PlaylistID = character(),
Musician = character(),
tracks = character(),
id = character(),
popularity = integer(),
artist = character(),
artistId = character(),
album = character(),
albumId = character(),
stringsAsFactors=FALSE)
View(PlaylistSongs)
# Getting each playlist
for (i in 1:nrow(playlistURI)) {
i <- cbind(PlaylistID = as.factor(playlistURI[i,2]),
Musician = as.factor(playlistURI[i,1]),
getPlaylistSongs("spotify",
playlistid = as.factor(playlistURI[i,2]),
token=spotifyToken))
PlaylistSongs <- rbind(PlaylistSongs, i)
}
View(PlaylistSongs)
View(playlistURI)
spotifyKey <- "182878ec396d424283c951d6769e9497"
spotifySecret <- "2a6d8f846edc4667ba9f0ba43cd7fe4c"
library(Rspotify)
library(httr)
library(jsonlite)
spotifyEndpoint <- oauth_endpoint(NULL,
"https://accounts.spotify.com/authorize",
"https://accounts.spotify.com/api/token")
spotifyToken <- spotifyOAuth("Spotify Analysis", spotifyKey, spotifySecret)
library(readr)
playlistURI <- read.csv("this-is-playlist-URI.csv", header = T, sep = ";")
# Empty dataframe
PlaylistSongs <- data.frame(PlaylistID = character(),
Musician = character(),
tracks = character(),
id = character(),
popularity = integer(),
artist = character(),
artistId = character(),
album = character(),
albumId = character(),
stringsAsFactors=FALSE)
# Getting each playlist
for (i in 1:nrow(playlistURI)) {
i <- cbind(PlaylistID = as.factor(playlistURI[i,2]),
Musician = as.factor(playlistURI[i,1]),
getPlaylistSongs("spotify",
playlistid = as.factor(playlistURI[i,2]),
token=spotifyToken))
PlaylistSongs <- rbind(PlaylistSongs, i)
}
View(i)
dim(PlaylistSongs)
View(playlistURI)