-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.R
More file actions
98 lines (75 loc) · 2.58 KB
/
Copy pathserver.R
File metadata and controls
98 lines (75 loc) · 2.58 KB
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
91
92
93
94
95
96
97
98
library(shiny)
library(googleVis)
library(dplyr)
library(stringr)
library(DT)
shinyServer(function(input, output,session){
map_data <- reactive({
print (as.numeric(input$Publish_Year/100))
new %>%
filter(century<= as.integer(input$Publish_Year/100)+1 & century>= as.integer(input$Publish_Year/100))%>%
select(c(lon,lat, country, count))
})
map_reactive <- reactive({
#print (map_data())
gvisGeoChart(data = map_data(),
locationvar = 'country', colorvar = 'count',
options=list(
width = 'auto', height = 'auto',
colorAxis = color_axis
)
)
})
output$map_motion <- renderGvis({
map_reactive()
})# end of generating map
#generate interactive dataset for recommendation
rec_data = reactive({
data_rating %>%
filter(period %in% input$period & type %in% input$type & country %in% input$country)%>%
select(book.image, title)
})
#generate images for recommendation
output$rec_pic1 <- renderText({
c('<img src="',as.character(rec_data()$book.image[1]),'" width = "150" >')
})
output$rec_pic2 <- renderText({
c('<img src="',as.character(rec_data()$book.image[2]),'" width = "150" >')
})
output$rec_pic3 <- renderText({
c('<img src="',as.character(rec_data()$book.image[3]),'" width = "150" >')
})
output$tbl = renderDataTable(data_rating[,c('author','pages','publish.date','rating','title','country')])
terms_1 <- reactive({
withProgress({
setProgress(message = "Processing corpus...")
getTermMatrix(rec_data()$title[1])
#print(rec_data()$title[1])
})
})
wordcloud_rep <- repeatable(wordcloud)
output$plot_1 = renderPlot({
wordcloud(terms_1(), max.words = 100, random.order = FALSE, colors = brewer.pal(8, "Dark2"))
})
terms_2 <- reactive({
withProgress({
setProgress(message = "Processing corpus...")
getTermMatrix(rec_data()$title[2])
})
})
wordcloud_rep <- repeatable(wordcloud)
output$plot_2 = renderPlot({
wordcloud(terms_2(), max.words = 100, random.order = FALSE, colors = brewer.pal(8, "Dark2"))
})
terms_3 <- reactive({
withProgress({
setProgress(message = "Processing corpus...")
getTermMatrix(rec_data()$title[3])
#print(rec_data()$title[3])
})
})
wordcloud_rep <- repeatable(wordcloud)
output$plot_3 = renderPlot({
wordcloud(terms_3(), max.words = 100, random.order = FALSE, colors = brewer.pal(8, "Dark2"))
})
})