• R/O
  • SSH

コミット

タグ
未設定

よく使われているワード(クリックで追加)

javaandroidc++linuxc#objective-c誰得cocoaqtpythonrubywindowsphpgameguibathyscaphec翻訳omegat計画中(planning stage)frameworktwitterdombtronvb.nettestarduinodirectxpreviewerゲームエンジン

コミットメタ情報

リビジョン24d555a9b69339fe0942398fc45beb68f97b0296 (tree)
日時2021-09-15 23:09:20
作者Lorenzo Isella <lorenzo.isella@gmai...>
コミッターLorenzo Isella

ログメッセージ

Further improvements to the interface.

変更サマリ

差分

diff -r 4823b9185b9f -r 24d555a9b693 R-codes/shiny_report_tam.R
--- a/R-codes/shiny_report_tam.R Wed Sep 15 15:48:55 2021 +0200
+++ b/R-codes/shiny_report_tam.R Wed Sep 15 16:09:20 2021 +0200
@@ -13,7 +13,7 @@
1313 library(viridis)
1414 library(janitor)
1515 library(kableExtra)
16-
16+library(forcats)
1717
1818
1919 ################################################################
@@ -202,11 +202,11 @@
202202 `selected-text-format` = "count > 3"),multiple = T),
203203
204204
205- ## pickerInput("viz_type","Select what you want to see",
206- ## choices=(c("Raw data", "Visualization")),
207- ## selected="Raw data",
208- ## options = list(`actions-box` = TRUE,
209- ## `selected-text-format` = "count > 3"),multiple = F),
205+ pickerInput("viz_type","Select what you want to see",
206+ choices=(c("Tabular data", "Visualization")),
207+ selected="Tabular data",
208+ options = list(`actions-box` = TRUE,
209+ `selected-text-format` = "count > 3"),multiple = F),
210210
211211
212212
@@ -228,17 +228,18 @@
228228
229229 ),
230230
231- mainPanel(
232- plotOutput("myplot"## ,
233- ## hover = "plot_hover"
234- ## click = "plot_click"
235- ) ,
236- ## DTOutput("info") #### <- CHANGED THIS ####
237- ## ,
231+mainPanel(
232+ conditionalPanel(
233+ condition = "input.viz_type == 'Visualization' ",
234+ plotOutput("myplot"
235+ )
236+ ),
237+ conditionalPanel(
238+ condition = "input.viz_type == 'Tabular data' ",
238239 DTOutput("table")
239240
240241 )
241-
242+)
242243
243244 )
244245
@@ -320,7 +321,9 @@
320321 df1 <- reactive({ compound_data() %>%
321322 group_by(year, beneficiary_country) %>%
322323 summarise(expenditure=sum(estimated_amount, na.rm=T)) %>%
323- ungroup
324+ ungroup %>%
325+ arrange(year) %>%
326+ mutate(year=as_factor(year))
324327 })
325328
326329
@@ -345,9 +348,11 @@
345348 gpl1 <- df1() %>%
346349 ggplot(aes(x = year, y = expenditure, fill=beneficiary_country)) +
347350 geom_col()+
351+
348352 my_ggplot_theme2("top")+
349353 scale_y_continuous(labels=function(x) format(x, big.mark = ",", scientific = FALSE),breaks=pretty_breaks(n=4))+
350- scale_x_continuous(breaks = function(x) unique(floor(pretty(x))))+
354+ ## scale_x_continuous(breaks = function(x) unique(floor(pretty(x))))+
355+ ## scale_x_continuous(breaks = 2000:2030 )+
351356 scale_fill_manual(NULL## , labels=c("Inward Flows","Outward Flows" )
352357 , values=my_pal) +
353358 xlab("Year")+