Skip to content
This repository has been archived by the owner on Jan 11, 2024. It is now read-only.

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Sezer TÜRKMEN (GM Bilgi Sistemleri) authored and Sezer TÜRKMEN (GM Bilgi Sistemleri) committed Nov 24, 2023
1 parent 871971f commit 7017dc5
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 24 deletions.
1 change: 1 addition & 0 deletions .Rhistory
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
shiny::runApp('app')
runApp('app')
shiny::runApp('app')
45 changes: 28 additions & 17 deletions app/app.R
Original file line number Diff line number Diff line change
Expand Up @@ -48,45 +48,56 @@ ui <- fluidPage(
sidebarLayout(
sidebarPanel(
sliderInput("released_year", "Year Filter", min = min(shiny_spotify_set$released_year), max = max(shiny_spotify_set$released_year), value = c(2000, 2023), step = 1, sep = ""),
sliderInput("streams", "Stream filter", min = 0, max = max(shiny_spotify_set$streams), value = 0),
sliderInput("streams", "Stream filter", min = 0, max = max(shiny_spotify_set$streams), value = c(0, max(shiny_spotify_set$streams))),
selectInput("music_type", "Music Features", choices = c("All", music_types), selected = c("danceability","energy"), multiple = TRUE)
),
mainPanel(plotOutput("spotify_plot"))
)
mainPanel(
plotOutput("spotify_plot")
) )
)

server <- function(input, output) {

output$spotify_plot <- renderPlot({
my_df <- shiny_spotify_set %>%
filter(released_year >= input$released_year[1] & released_year <= input$released_year[2] & streams >= input$streams)
filter(released_year >= input$released_year[1] & released_year <= input$released_year[2] & streams >= input$streams[1]& streams <= input$streams[2])

if (!("All" %in% input$music_type)){
my_df <- my_df %>%
select(released_year, input$music_type)
}else{
my_df <- my_df %>%
select(released_year, music_types)
}
music_type_selected <- reactive({
if (!("All" %in% input$music_type)){
return(input$music_type)
} else {
return(music_types)
}
})

my_df <- my_df %>%
select(released_year, !!music_type_selected())

# Group by release year and calculate the mean for each music type
my_df <- my_df %>%
group_by(released_year) %>%
summarise(across(everything(), mean, na.rm = TRUE))

# Reshape data for plotting
# Plotting
my_df <- pivot_longer(my_df, cols = -released_year, names_to = "music_type", values_to = "mean_value")

ggplot(my_df, aes(x = released_year, y = mean_value, color = music_type, size = mean_value)) +
geom_point() +
scale_size_continuous(range = c(3, 10)) + # Adjust dot size
ggplot(my_df, aes(x = released_year, y = mean_value, color = music_type)) +
geom_point(alpha = 0.4, size = 6) +
geom_point(aes(y = mean_value - 0.1), color = "black", alpha = 1, size = 0.5) +
labs(title = "Spotify Data",
x = "Released Year", # X-axis label
y = "Mean Value", # Y-axis label
color = "Music Feature", # Legend title for color
size = "Mean Value") # Legend title for size
color = "Music Feature") + # Legend title for color
theme_minimal() +
theme(panel.grid.major.x = element_line(color = "gray", linetype = "dashed", linewidth = 0.5)) # Year grid lines


})

}
# Increase the maximum upload size to 160 MB
options(shiny.maxRequestSize = 200*1024^2)
options(rsconnect.packrat = TRUE)

# Run the application
shinyApp(ui = ui, server = server)
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ account: sezerlucianturkmen
server: shinyapps.io
hostUrl: https://api.shinyapps.io/v1
appId: 10616281
bundleId: 7964128
bundleId: 7964785
url: https://sezerlucianturkmen.shinyapps.io/shinyspoty/
version: 1
asMultiple: FALSE
Expand Down
4 changes: 2 additions & 2 deletions docs/assignment1.html
Original file line number Diff line number Diff line change
Expand Up @@ -323,8 +323,8 @@ <h3 data-number="4.0.1" class="anchored" data-anchor-id="most-streamed-spotify-s
<span id="cb1-16"><a href="#cb1-16" aria-hidden="true" tabindex="-1"></a>))</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output-display">

<div class="datatables html-widget html-fill-item-overflow-hidden html-fill-item" id="htmlwidget-2d4cd164e466f42158a9" style="width:100%;height:auto;"></div>
<script type="application/json" data-for="htmlwidget-2d4cd164e466f42158a9">{"x":{"filter":"none","vertical":false,"editable":{"target":"row","disable":{"columns":[1,3,4]},"numeric":[3,4,5,6,7,8,10,11,13,15,18,19,20,21,22,23,24],"date":[]},"data":[["1","2","3","4","5","6"],["Anti-Hero","Arcade","Glimpse of Us","Seek &amp; Destroy","Summertime Sadness","Come Back Home - From \"Purple Hearts\""],["Taylor Swift","Duncan Laurence","Joji","SZA","Lana Del Rey","Sofia Carson"],[1,1,1,1,1,1],[2022,2019,2022,2022,2011,2022],[10,3,6,12,1,7],[21,7,10,9,1,12],[9082,6646,6330,1007,20333,367],[56,0,6,0,52,0],["999748277","991336132","988515741","98709329","983637508","97610446"],[242,107,109,5,89,28],[142,47,42,31,143,67],["165","584","158","1","1,632","195"],[9,1,3,0,3,0],["310","","31","0","200","0"],[97,72,170,152,112,145],["E","A","G#","C#","C#","G"],["Major","Minor","Major","Major","Minor","Major"],[64,45,44,65,56,56],[51,27,27,35,24,43],[63,33,32,65,66,53],[12,82,89,44,7,24],[0,0,0,18,0,0],[19,14,14,21,12,12],[5,4,5,7,3,4]],"container":"<table class=\"display\">\n <thead>\n <tr>\n <th> <\/th>\n <th>track_name<\/th>\n <th>artist.s._name<\/th>\n <th>artist_count<\/th>\n <th>released_year<\/th>\n <th>released_month<\/th>\n <th>released_day<\/th>\n <th>in_spotify_playlists<\/th>\n <th>in_spotify_charts<\/th>\n <th>streams<\/th>\n <th>in_apple_playlists<\/th>\n <th>in_apple_charts<\/th>\n <th>in_deezer_playlists<\/th>\n <th>in_deezer_charts<\/th>\n <th>in_shazam_charts<\/th>\n <th>bpm<\/th>\n <th>key<\/th>\n <th>mode<\/th>\n <th>danceability_.<\/th>\n <th>valence_.<\/th>\n <th>energy_.<\/th>\n <th>acousticness_.<\/th>\n <th>instrumentalness_.<\/th>\n <th>liveness_.<\/th>\n <th>speechiness_.<\/th>\n <\/tr>\n <\/thead>\n<\/table>","options":{"columnDefs":[{"className":"dt-right","targets":[3,4,5,6,7,8,10,11,13,15,18,19,20,21,22,23,24]},{"orderable":false,"targets":0}],"order":[],"autoWidth":false,"orderClasses":false}},"evals":[],"jsHooks":[]}</script>
<div class="datatables html-widget html-fill-item-overflow-hidden html-fill-item" id="htmlwidget-8980a5b26df5ce04d27d" style="width:100%;height:auto;"></div>
<script type="application/json" data-for="htmlwidget-8980a5b26df5ce04d27d">{"x":{"filter":"none","vertical":false,"editable":{"target":"row","disable":{"columns":[1,3,4]},"numeric":[3,4,5,6,7,8,10,11,13,15,18,19,20,21,22,23,24],"date":[]},"data":[["1","2","3","4","5","6"],["Anti-Hero","Arcade","Glimpse of Us","Seek &amp; Destroy","Summertime Sadness","Come Back Home - From \"Purple Hearts\""],["Taylor Swift","Duncan Laurence","Joji","SZA","Lana Del Rey","Sofia Carson"],[1,1,1,1,1,1],[2022,2019,2022,2022,2011,2022],[10,3,6,12,1,7],[21,7,10,9,1,12],[9082,6646,6330,1007,20333,367],[56,0,6,0,52,0],["999748277","991336132","988515741","98709329","983637508","97610446"],[242,107,109,5,89,28],[142,47,42,31,143,67],["165","584","158","1","1,632","195"],[9,1,3,0,3,0],["310","","31","0","200","0"],[97,72,170,152,112,145],["E","A","G#","C#","C#","G"],["Major","Minor","Major","Major","Minor","Major"],[64,45,44,65,56,56],[51,27,27,35,24,43],[63,33,32,65,66,53],[12,82,89,44,7,24],[0,0,0,18,0,0],[19,14,14,21,12,12],[5,4,5,7,3,4]],"container":"<table class=\"display\">\n <thead>\n <tr>\n <th> <\/th>\n <th>track_name<\/th>\n <th>artist.s._name<\/th>\n <th>artist_count<\/th>\n <th>released_year<\/th>\n <th>released_month<\/th>\n <th>released_day<\/th>\n <th>in_spotify_playlists<\/th>\n <th>in_spotify_charts<\/th>\n <th>streams<\/th>\n <th>in_apple_playlists<\/th>\n <th>in_apple_charts<\/th>\n <th>in_deezer_playlists<\/th>\n <th>in_deezer_charts<\/th>\n <th>in_shazam_charts<\/th>\n <th>bpm<\/th>\n <th>key<\/th>\n <th>mode<\/th>\n <th>danceability_.<\/th>\n <th>valence_.<\/th>\n <th>energy_.<\/th>\n <th>acousticness_.<\/th>\n <th>instrumentalness_.<\/th>\n <th>liveness_.<\/th>\n <th>speechiness_.<\/th>\n <\/tr>\n <\/thead>\n<\/table>","options":{"columnDefs":[{"className":"dt-right","targets":[3,4,5,6,7,8,10,11,13,15,18,19,20,21,22,23,24]},{"orderable":false,"targets":0}],"order":[],"autoWidth":false,"orderClasses":false}},"evals":[],"jsHooks":[]}</script>
</div>
</div>
<hr>
Expand Down
4 changes: 2 additions & 2 deletions docs/inClass1.html
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,8 @@ <h3 data-number="2.0.1" class="anchored" data-anchor-id="most-streamed-spotify-s
<span id="cb1-16"><a href="#cb1-16" aria-hidden="true" tabindex="-1"></a>))</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output-display">

<div class="datatables html-widget html-fill-item-overflow-hidden html-fill-item" id="htmlwidget-cdaf7296deab61ca84ff" style="width:100%;height:auto;"></div>
<script type="application/json" data-for="htmlwidget-cdaf7296deab61ca84ff">{"x":{"filter":"none","vertical":false,"editable":{"target":"row","disable":{"columns":[1,3,4]},"numeric":[3,4,5,6,7,8,10,11,13,15,18,19,20,21,22,23,24],"date":[]},"data":[["1","2","3","4","5","6"],["Anti-Hero","Arcade","Glimpse of Us","Seek &amp; Destroy","Summertime Sadness","Come Back Home - From \"Purple Hearts\""],["Taylor Swift","Duncan Laurence","Joji","SZA","Lana Del Rey","Sofia Carson"],[1,1,1,1,1,1],[2022,2019,2022,2022,2011,2022],[10,3,6,12,1,7],[21,7,10,9,1,12],[9082,6646,6330,1007,20333,367],[56,0,6,0,52,0],["999748277","991336132","988515741","98709329","983637508","97610446"],[242,107,109,5,89,28],[142,47,42,31,143,67],["165","584","158","1","1,632","195"],[9,1,3,0,3,0],["310","","31","0","200","0"],[97,72,170,152,112,145],["E","A","G#","C#","C#","G"],["Major","Minor","Major","Major","Minor","Major"],[64,45,44,65,56,56],[51,27,27,35,24,43],[63,33,32,65,66,53],[12,82,89,44,7,24],[0,0,0,18,0,0],[19,14,14,21,12,12],[5,4,5,7,3,4]],"container":"<table class=\"display\">\n <thead>\n <tr>\n <th> <\/th>\n <th>track_name<\/th>\n <th>artist.s._name<\/th>\n <th>artist_count<\/th>\n <th>released_year<\/th>\n <th>released_month<\/th>\n <th>released_day<\/th>\n <th>in_spotify_playlists<\/th>\n <th>in_spotify_charts<\/th>\n <th>streams<\/th>\n <th>in_apple_playlists<\/th>\n <th>in_apple_charts<\/th>\n <th>in_deezer_playlists<\/th>\n <th>in_deezer_charts<\/th>\n <th>in_shazam_charts<\/th>\n <th>bpm<\/th>\n <th>key<\/th>\n <th>mode<\/th>\n <th>danceability_.<\/th>\n <th>valence_.<\/th>\n <th>energy_.<\/th>\n <th>acousticness_.<\/th>\n <th>instrumentalness_.<\/th>\n <th>liveness_.<\/th>\n <th>speechiness_.<\/th>\n <\/tr>\n <\/thead>\n<\/table>","options":{"columnDefs":[{"className":"dt-right","targets":[3,4,5,6,7,8,10,11,13,15,18,19,20,21,22,23,24]},{"orderable":false,"targets":0}],"order":[],"autoWidth":false,"orderClasses":false}},"evals":[],"jsHooks":[]}</script>
<div class="datatables html-widget html-fill-item-overflow-hidden html-fill-item" id="htmlwidget-3731d4110175b5fab11c" style="width:100%;height:auto;"></div>
<script type="application/json" data-for="htmlwidget-3731d4110175b5fab11c">{"x":{"filter":"none","vertical":false,"editable":{"target":"row","disable":{"columns":[1,3,4]},"numeric":[3,4,5,6,7,8,10,11,13,15,18,19,20,21,22,23,24],"date":[]},"data":[["1","2","3","4","5","6"],["Anti-Hero","Arcade","Glimpse of Us","Seek &amp; Destroy","Summertime Sadness","Come Back Home - From \"Purple Hearts\""],["Taylor Swift","Duncan Laurence","Joji","SZA","Lana Del Rey","Sofia Carson"],[1,1,1,1,1,1],[2022,2019,2022,2022,2011,2022],[10,3,6,12,1,7],[21,7,10,9,1,12],[9082,6646,6330,1007,20333,367],[56,0,6,0,52,0],["999748277","991336132","988515741","98709329","983637508","97610446"],[242,107,109,5,89,28],[142,47,42,31,143,67],["165","584","158","1","1,632","195"],[9,1,3,0,3,0],["310","","31","0","200","0"],[97,72,170,152,112,145],["E","A","G#","C#","C#","G"],["Major","Minor","Major","Major","Minor","Major"],[64,45,44,65,56,56],[51,27,27,35,24,43],[63,33,32,65,66,53],[12,82,89,44,7,24],[0,0,0,18,0,0],[19,14,14,21,12,12],[5,4,5,7,3,4]],"container":"<table class=\"display\">\n <thead>\n <tr>\n <th> <\/th>\n <th>track_name<\/th>\n <th>artist.s._name<\/th>\n <th>artist_count<\/th>\n <th>released_year<\/th>\n <th>released_month<\/th>\n <th>released_day<\/th>\n <th>in_spotify_playlists<\/th>\n <th>in_spotify_charts<\/th>\n <th>streams<\/th>\n <th>in_apple_playlists<\/th>\n <th>in_apple_charts<\/th>\n <th>in_deezer_playlists<\/th>\n <th>in_deezer_charts<\/th>\n <th>in_shazam_charts<\/th>\n <th>bpm<\/th>\n <th>key<\/th>\n <th>mode<\/th>\n <th>danceability_.<\/th>\n <th>valence_.<\/th>\n <th>energy_.<\/th>\n <th>acousticness_.<\/th>\n <th>instrumentalness_.<\/th>\n <th>liveness_.<\/th>\n <th>speechiness_.<\/th>\n <\/tr>\n <\/thead>\n<\/table>","options":{"columnDefs":[{"className":"dt-right","targets":[3,4,5,6,7,8,10,11,13,15,18,19,20,21,22,23,24]},{"orderable":false,"targets":0}],"order":[],"autoWidth":false,"orderClasses":false}},"evals":[],"jsHooks":[]}</script>
</div>
</div>
<hr>
Expand Down
4 changes: 2 additions & 2 deletions docs/inClass2.html
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,8 @@ <h3 data-number="3.0.1" class="anchored" data-anchor-id="most-streamed-spotify-s
<span id="cb1-16"><a href="#cb1-16" aria-hidden="true" tabindex="-1"></a>))</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output-display">

<div class="datatables html-widget html-fill-item-overflow-hidden html-fill-item" id="htmlwidget-6d354f5c826225d25a79" style="width:100%;height:auto;"></div>
<script type="application/json" data-for="htmlwidget-6d354f5c826225d25a79">{"x":{"filter":"none","vertical":false,"editable":{"target":"row","disable":{"columns":[1,3,4]},"numeric":[3,4,5,6,7,8,10,11,13,15,18,19,20,21,22,23,24],"date":[]},"data":[["1","2","3","4","5","6"],["Anti-Hero","Arcade","Glimpse of Us","Seek &amp; Destroy","Summertime Sadness","Come Back Home - From \"Purple Hearts\""],["Taylor Swift","Duncan Laurence","Joji","SZA","Lana Del Rey","Sofia Carson"],[1,1,1,1,1,1],[2022,2019,2022,2022,2011,2022],[10,3,6,12,1,7],[21,7,10,9,1,12],[9082,6646,6330,1007,20333,367],[56,0,6,0,52,0],["999748277","991336132","988515741","98709329","983637508","97610446"],[242,107,109,5,89,28],[142,47,42,31,143,67],["165","584","158","1","1,632","195"],[9,1,3,0,3,0],["310","","31","0","200","0"],[97,72,170,152,112,145],["E","A","G#","C#","C#","G"],["Major","Minor","Major","Major","Minor","Major"],[64,45,44,65,56,56],[51,27,27,35,24,43],[63,33,32,65,66,53],[12,82,89,44,7,24],[0,0,0,18,0,0],[19,14,14,21,12,12],[5,4,5,7,3,4]],"container":"<table class=\"display\">\n <thead>\n <tr>\n <th> <\/th>\n <th>track_name<\/th>\n <th>artist.s._name<\/th>\n <th>artist_count<\/th>\n <th>released_year<\/th>\n <th>released_month<\/th>\n <th>released_day<\/th>\n <th>in_spotify_playlists<\/th>\n <th>in_spotify_charts<\/th>\n <th>streams<\/th>\n <th>in_apple_playlists<\/th>\n <th>in_apple_charts<\/th>\n <th>in_deezer_playlists<\/th>\n <th>in_deezer_charts<\/th>\n <th>in_shazam_charts<\/th>\n <th>bpm<\/th>\n <th>key<\/th>\n <th>mode<\/th>\n <th>danceability_.<\/th>\n <th>valence_.<\/th>\n <th>energy_.<\/th>\n <th>acousticness_.<\/th>\n <th>instrumentalness_.<\/th>\n <th>liveness_.<\/th>\n <th>speechiness_.<\/th>\n <\/tr>\n <\/thead>\n<\/table>","options":{"columnDefs":[{"className":"dt-right","targets":[3,4,5,6,7,8,10,11,13,15,18,19,20,21,22,23,24]},{"orderable":false,"targets":0}],"order":[],"autoWidth":false,"orderClasses":false}},"evals":[],"jsHooks":[]}</script>
<div class="datatables html-widget html-fill-item-overflow-hidden html-fill-item" id="htmlwidget-6cf905cb78a894c82e4b" style="width:100%;height:auto;"></div>
<script type="application/json" data-for="htmlwidget-6cf905cb78a894c82e4b">{"x":{"filter":"none","vertical":false,"editable":{"target":"row","disable":{"columns":[1,3,4]},"numeric":[3,4,5,6,7,8,10,11,13,15,18,19,20,21,22,23,24],"date":[]},"data":[["1","2","3","4","5","6"],["Anti-Hero","Arcade","Glimpse of Us","Seek &amp; Destroy","Summertime Sadness","Come Back Home - From \"Purple Hearts\""],["Taylor Swift","Duncan Laurence","Joji","SZA","Lana Del Rey","Sofia Carson"],[1,1,1,1,1,1],[2022,2019,2022,2022,2011,2022],[10,3,6,12,1,7],[21,7,10,9,1,12],[9082,6646,6330,1007,20333,367],[56,0,6,0,52,0],["999748277","991336132","988515741","98709329","983637508","97610446"],[242,107,109,5,89,28],[142,47,42,31,143,67],["165","584","158","1","1,632","195"],[9,1,3,0,3,0],["310","","31","0","200","0"],[97,72,170,152,112,145],["E","A","G#","C#","C#","G"],["Major","Minor","Major","Major","Minor","Major"],[64,45,44,65,56,56],[51,27,27,35,24,43],[63,33,32,65,66,53],[12,82,89,44,7,24],[0,0,0,18,0,0],[19,14,14,21,12,12],[5,4,5,7,3,4]],"container":"<table class=\"display\">\n <thead>\n <tr>\n <th> <\/th>\n <th>track_name<\/th>\n <th>artist.s._name<\/th>\n <th>artist_count<\/th>\n <th>released_year<\/th>\n <th>released_month<\/th>\n <th>released_day<\/th>\n <th>in_spotify_playlists<\/th>\n <th>in_spotify_charts<\/th>\n <th>streams<\/th>\n <th>in_apple_playlists<\/th>\n <th>in_apple_charts<\/th>\n <th>in_deezer_playlists<\/th>\n <th>in_deezer_charts<\/th>\n <th>in_shazam_charts<\/th>\n <th>bpm<\/th>\n <th>key<\/th>\n <th>mode<\/th>\n <th>danceability_.<\/th>\n <th>valence_.<\/th>\n <th>energy_.<\/th>\n <th>acousticness_.<\/th>\n <th>instrumentalness_.<\/th>\n <th>liveness_.<\/th>\n <th>speechiness_.<\/th>\n <\/tr>\n <\/thead>\n<\/table>","options":{"columnDefs":[{"className":"dt-right","targets":[3,4,5,6,7,8,10,11,13,15,18,19,20,21,22,23,24]},{"orderable":false,"targets":0}],"order":[],"autoWidth":false,"orderClasses":false}},"evals":[],"jsHooks":[]}</script>
</div>
</div>
<hr>
Expand Down

0 comments on commit 7017dc5

Please sign in to comment.