-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathapp.R
1094 lines (962 loc) · 60.4 KB
/
app.R
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# Altmetrics R Shiny app
# Corey Bradshaw
# Flinders University
## remove everything
rm(list = ls())
# load libraries
library(shiny)
library(shinybusy)
library(rAltmetric)
library(magrittr)
library(purrr)
library(dplyr)
library(rcrossref)
library(ggplot2)
library(ggpubr)
library(car)
library(ggrepel)
library(tidyverse)
## call functions
source(file.path("./functions/", "AICc.R"), local=T)
source(file.path("./functions/", "deltaIC.R"), local=T)
source(file.path("./functions/", "weightIC.R"), local=T)
source(file.path("./functions/", "linregER.R"), local=T)
source(file.path("./functions/", "AltFunc.R"), local=T)
source(file.path("./functions/", "safe_altmetrics.R"), local=T)
source(file.path("./functions/", "alm.R"), local=T)
source(file.path("./functions/", "setBackgroundColor.R"), local=T)
ui <- fluidPage(
tags$head(
tags$meta(name="google-site-verification", content="bVQ54bgpekDeCqy30pOSnGOMgbNXXV1AdwIoMRXSAAI"),
tags$script(type='text/javascript', src="embed.js")
),
setBackgroundColor(
color = "#f8fbf9",
gradient = c("linear"),
direction = c("bottom")
),
# title of app
titlePanel("AltmetricShiny: fetch, sort & analyse Altmetric data"),
wellPanel(style = "background: #e4feea",
tags$a(href="https://github.com/cjabradshaw/AltmetricShiny", tags$img(height = 200, src = "altmetric_logo.png", style="float:right")),
tags$p(style="font-family:Avenir", tags$i(class="fab fa-r-project", title="R Project"),"Shiny App by", tags$a(href="https://globalecologyflinders.com/people/#CJAB", "Corey Bradshaw "),
tags$a(href = "mailto:corey.bradshaw@flinders.edu.au","(",tags$i(class="far fa-envelope"),"e-mail"),";",
tags$a(href = "https://github.com/cjabradshaw", tags$i(class="fab fa-github",title="Github"),"Github)")),
tags$h4(style="font-family:Avenir", "Preamble"),
tags$p(style="font-family:Avenir", "Ever wanted to collate the", tags$a(href="https://www.altmetric.com/about-altmetrics/what-are-altmetrics/","Altmetric"),
"data for your articles, but couldn't be bothered to do it manually? I've made the process substantially easier by designing this",
tags$i(class="fab fa-r-project"),"Shiny app. All you need to do is collate a list of",tags$a(href="https://www.doi.org", "'digital object identifiers'"),
"('doi') for the articles of interest, and the app does it all for you. The app also produces outputs that plot the distribution of not only the relevant
Altmetric scores, but also the rank percentiles for each article relative to articles of the same age in the journal, and to all articles in the journal
with Altmetric data."), tags$p(style="font-family:Avenir", "The app also gives you the option of fetching citation data from",
tags$a(href="https://www.crossref.org", "Crossref"), "to examine the patterns between Altmetric and citation trends."),
tags$p(style="font-family:Avenir", "This", tags$i(class="fab fa-github"), "Github ",
tags$a(href = "https://github.com/cjabradshaw/AltmetricShiny", "repository"),
"provides all the 'under-the-bonnet'",tags$i(class="fab fa-r-project"),"code for the app."),
tags$h4(style="font-family:Avenir", "Instructions"),
tags$ol(tags$li(tags$p(style="font-family:Avenir", "Create a delimited text file of", tags$strong("exactly the same format"), "as the example file in this",
tags$a(href="https://github.com/cjabradshaw/AltmetricShiny/blob/main/doisampSm.csv","repository", tags$i(class="far fa-file")), ",
although you can specify the delimit character (", tags$em("comma"),", ", tags$em("space"),", ", tags$em("tab"),").")),
tags$li(tags$p(style="font-family:Avenir", "Load your delimited text file in the app by clicking the",tags$i(class="fas fa-file-import"),
tags$strong("choose file"), "button.")),
tags$li(tags$p(style="font-family:Avenir", "Select whether you want to include Crossref citation data (",
tags$i(class="fas fa-bookmark"), tags$strong("include Crossref citation data?"), "). Downloading these data will increase processing time.")),
tags$a(href="https://globalecologyflinders.com/", tags$img(height = 100, src = "GEL Logo Kaurna transparent.png", style="float:right",
title="Global Ecology @ Flinders University")),
tags$li(tags$p(style="font-family:Avenir", "Select whether you want to add doi labels",
tags$i(class="fas fa-tag"), "to the plots.")),
tags$li(tags$p(style="font-family:Avenir", "Select whether you want to restrict the results to a particular date range",
tags$i(class="fas fa-clock"))),
tags$li(tags$p(style="font-family:Avenir", "Choose how you want the output file to be", tags$i(class="fas fa-sort"),
"sorted by selecting one of the four choices in the drop-down menu:", tags$strong("Altmetric score"),",",tags$strong("context rank percentile"),",",
tags$strong("all-time rank percentile"),", or",tags$strong("publication date"),".")),
tags$li(tags$p(style="font-family:Avenir", "Click the", tags$i(class="fas fa-network-wired"), tags$strong("fetch data"), "button.")),
tags$li(tags$p(style="font-family:Avenir", "Download the results table as a tab-delimited", tags$i(class="fas fa-file-alt"), "file by clicking the", tags$i(class="fas fa-download"),
tags$strong("download"), "button.")))
),
tabsetPanel(id="tabs",
tabPanel(value="tab1", title="fetch & process data",
sidebarLayout(
sidebarPanel(
wellPanel(style = "background: #c7fdd4",
fileInput("file1", label=tags$p(tags$i(class='fas fa-file-import'),"choose delimited file with doi data (1 column)"),
multiple=F, buttonLabel="choose file", placeholder="no file selected"),
tags$hr(),
radioButtons("sep",label=tags$p(tags$i(class="fas fa-file-csv"),"separator"),choices=c(comma=',',space="",tab="\t"), inline=T),
checkboxInput("header1", "header?", TRUE),
tags$hr(),
radioButtons("CRcitations", label=tags$p(tags$i(class='fas fa-bookmark'), "include Crossref citation data?"), inline=T,
choiceNames = list((icon("fas fa-thumbs-down")), (icon("fas fa-thumbs-up"))), choiceValues = list("no","yes")),
tags$hr(),
radioButtons("doilabs", label=tags$p(tags$i(class='fas fa-tag'), "include doi labels on plots?"), inline=T,
choiceNames = list((icon("fas fa-thumbs-down")), (icon("fas fa-thumbs-up"))), choiceValues = list("no","yes")),
tags$hr(),
dateRangeInput("timerange",label=tags$p(tags$i(class='fas fa-clock'), "restrict results to a date range?"),
start="1970-01-01", end=NULL, format="dd-M-yyyy", startview="decade", separator=" to "),
tags$hr(),
selectInput("sortind",label=tags$p(tags$i(class='fas fa-sort'), "choose sort index"),
c("Altmetric score"="as","context rank percentile"="cp","all-time rank percentile"="ap","publication date"="d")),
tags$hr(),
actionButton("fetchButton", label="fetch data",icon=shiny::icon("fas fa-network-wired")),
br(),
tags$small(style="font-family:Avenir", "(refresh page to clear data)"),
tags$hr(),
downloadButton('downloadData', 'download',icon = shiny::icon("download"))
),
),
# open main panel
mainPanel(style = "background: #f8fbf9",
fluidRow(
tags$div(id = "firstOutput",
h3("input data"),
add_busy_spinner(spin="fading-circle", color="#17ca3a", timeout=500, position="bottom-right", height = 250, width = 250),
dataTableOutput("table1"))
),
fluidRow(
add_busy_spinner(spin="fading-circle", color="#17ca3a", timeout=500, position="bottom-right", height = 250, width = 250),
tags$div(id = "placeholder") # the dynamic UI will be inserted relative to this placeholder
),
) # close mainPanel
) # sidebarLayout
), # end tab1
tabPanel(value="tab2", title=tags$strong("highlights"), style = "background: #e9f8ec",
tags$br(),
tags$p(style="font-family:Avenir", tags$strong("Some summary highlights from your sample (user-set time restrictions are reflected in these values):")),
tags$img(height = 150, src = "highlights.png", style="float:right"),
mainPanel(
tags$script(type='text/javascript', ' _altmetric_embed_init(); '),
add_busy_spinner(spin="fading-circle", color="#17ca3a", timeout=500, position="bottom-right", height = 250, width = 250),
textOutput('error'),
tags$br(),
htmlOutput('daterange'),
tags$br(),
htmlOutput('totDOI'),
tags$br(),
htmlOutput('missingAltm'),
tags$br(),
htmlOutput('Narticles'),
tags$br(),
htmlOutput('topAS'),
tags$br(),
htmlOutput('topASartDetails', inline=T),
uiOutput('topASButton'),
tags$br(),
htmlOutput('medianAS'),
tags$br(),
htmlOutput('rangeAS'),
tags$br(),
htmlOutput('IQrangeAS'),
tags$br(),
htmlOutput('topCP'),
tags$br(),
htmlOutput('topAP'),
tags$br(),
htmlOutput('nArtPol'),
tags$br(),
htmlOutput('SArtPol'),
tags$br(),
tags$head(tags$style("#daterange{font-family:Avenir;color:red}"
)),
tags$head(tags$style("#totDOI{font-family:Avenir;font-style:italic}"
)),
tags$head(tags$style("#missingAltm{font-family:Avenir;font-style:italic}"
)),
tags$head(tags$style("#Narticles{font-family:Avenir;font-style:italic}"
)),
tags$head(tags$style("#topAS{font-family:Avenir;font-style:italic}"
)),
tags$head(tags$style("#topASartDetails{font-family:Avenir;font-style:italic}"
)),
tags$head(tags$style("#medianAS{font-family:Avenir;font-style:italic}"
)),
tags$head(tags$style("#rangeAS{font-family:Avenir;font-style:italic}"
)),
tags$head(tags$style("#IQrangeAS{font-family:Avenir;font-style:italic}"
)),
tags$head(tags$style("#topCP{font-family:Avenir;font-style:italic}"
)),
tags$head(tags$style("#topAP{font-family:Avenir;font-style:italic}"
)),
tags$head(tags$style("#nArtPol{font-family:Avenir;font-style:italic}"
)),
tags$head(tags$style("#SArtPol{font-family:Avenir;font-style:italic}"
)),
tags$br()
)
), # end tab2
tabPanel(value="tab3", title=tags$strong("histograms"), style = "background: #e9f8ec",
tags$br(),
tags$p(style="font-family:Avenir", "These histograms show the distribution of three different Altmetrics:"),
tags$ul(tags$li(tags$p(style="font-family:Avenir", tags$strong("A: Altmetric score"), " — this is the Altmetric '",
tags$a(href="https://www.altmetric.com/about-our-data/the-donut-and-score/", "attention score"),
"' as an indicator of the volume of attention an article has received (higher scores = more attention.")),
tags$li(tags$p(style="font-family:Avenir", tags$strong("B: Context-rank percentile score"),
" — this is the percentile of the Altmetric",
tags$a(href="https://www.altmetric.com/about-our-data/the-donut-and-score/",
"attention score"), tags$a(href="https://help.altmetric.com/support/solutions/articles/6000233313-putting-the-altmetric-attention-score-in-context","rank"),
"in context of all articles of the same age in the journal. Here, low percentiles = top.")),
tags$li(tags$p(style="font-family:Avenir", tags$strong("C: All time-rank percentile"), " — this is the percentile of the Altmetric",
tags$a(href="https://www.altmetric.com/about-our-data/the-donut-and-score/",
"attention score"), tags$a(href="https://help.altmetric.com/support/solutions/articles/6000233313-putting-the-altmetric-attention-score-in-context","rank"),
"in context of all articles with Altmetric data ever published in the journal. Here, low percentiles = top."))
), # end ul
mainPanel(
tags$br(),
tags$p(style="font-family:Avenir","In each panel below, the median metric is indicated in the panel's title and also shown as a red, dashed vertical line."),
add_busy_spinner(spin="fading-circle", color="#17ca3a", timeout=500, position="bottom-right", height = 250, width = 250),
plotOutput(width="150%","histplots"),
tags$br()
)
), # end tab3
tabPanel(value="tab4", title=tags$strong("inter-relationships"), style = "background: #e9f8ec",
tags$br(),
tags$p(style="font-family:Avenir", "The following plots show the relationship between each of the two percentile rank measures
(by age and all-time) and the log of the Altmetric scores:"),
tags$ul(tags$li(tags$p(style="font-family:Avenir", tags$strong("A: Context-rank percentile score ~ Altmetric score"))),
tags$li(tags$p(style="font-family:Avenir", tags$strong("B: All time-rank percentile score ~ Altmetric score")))
), # end ul
mainPanel(
tags$br(),
tags$p(style="font-family:Avenir","The information-theoretic evidence ratio (ER) for a linear trend and the adjusted R",
tags$sup("2"), "for each relationship are:"),
htmlOutput('ERASCP'),
htmlOutput('ERASAP'),
tags$head(tags$style("#ERASCP{font-family:Avenir}"
)),
tags$head(tags$style("#ERASAP{font-family:Avenir}"
)),
tags$br(),
tags$p(style="font-family:Avenir","In each panel below, the loess trend is indicated by the blue line, and the linear trend by a
red dashed line."),
tags$br(),
add_busy_spinner(spin="fading-circle", color="#17ca3a", timeout=500, position="bottom-right", height = 250, width = 250),
plotOutput(width="150%", height="1200px", "interplots")
)
), # end tab4
tabPanel(value="tab5", title=tags$strong("temporal trends"), style = "background: #e9f8ec",
tags$br(),
tags$p(style="font-family:Avenir", "The following time plots show the temporal patterns in the three different Altmetrics, as well
as the trend in policy-document citations:"),
tags$ul(tags$li(tags$p(style="font-family:Avenir", tags$strong("A: Altmetric score"), " — this is the Altmetric '",
tags$a(href="https://www.altmetric.com/about-our-data/the-donut-and-score/", "attention score"),
"' as an indicator of the volume of attention an article has received (higher scores = more attention.")),
tags$li(tags$p(style="font-family:Avenir", tags$strong("B: Context-rank percentile score"),
" — this is the percentile of the Altmetric",
tags$a(href="https://www.altmetric.com/about-our-data/the-donut-and-score/",
"attention score"), tags$a(href="https://help.altmetric.com/support/solutions/articles/6000233313-putting-the-altmetric-attention-score-in-context","rank"),
"in context of all articles of the same age in the journal. Here, low percentiles = top.")),
tags$li(tags$p(style="font-family:Avenir", tags$strong("C: All time-rank percentile"), " — this is the percentile of the Altmetric",
tags$a(href="https://www.altmetric.com/about-our-data/the-donut-and-score/",
"attention score"), tags$a(href="https://help.altmetric.com/support/solutions/articles/6000233313-putting-the-altmetric-attention-score-in-context","rank"),
"in context of all articles with Altmetric data ever published in the journal. Here, low percentiles = top.")),
tags$li(tags$p(style="font-family:Avenir", tags$strong("D: Policy-document citations"), " — the number of policy-document
citations over time"))
), # end ul
mainPanel(
tags$br(),
tags$p(style="font-family:Avenir","The information-theoretic evidence ratio (ER) for a linear trend and the adjusted R",
tags$sup("2"), "for each index are:"),
htmlOutput('ERASt'),
htmlOutput('ERCPt'),
htmlOutput('ERAPt'),
tags$head(tags$style("#ERASt{font-family:Avenir}"
)),
tags$head(tags$style("#ERCPt{font-family:Avenir}"
)),
tags$head(tags$style("#ERAPt{font-family:Avenir}"
)),
tags$br(),
tags$p(style="font-family:Avenir","In the panels below, the loess trend is indicated by the blue line, and the linear trend by a
red dashed line."),
tags$br(),
add_busy_spinner(spin="fading-circle", color="#17ca3a", timeout=500, position="bottom-right", height = 250, width = 250),
plotOutput(height="1600px", width="150%", "timeplots")
)
), # end tab5
tabPanel(value="tab6", title=tags$strong("citation analysis"), style = "background: #e9f8ec",
tags$br(),
tags$p(style="font-family:Avenir", "If you selected to include Crossref citation data, the following plots show the power-law relationship
between article citations and each of the three different Altmetrics:"),
tags$ul(tags$li(tags$p(style="font-family:Avenir", tags$strong("A: Altmetric score"), " — this is the Altmetric '",
tags$a(href="https://www.altmetric.com/about-our-data/the-donut-and-score/", "attention score"),
"' as an indicator of the volume of attention an article has received (higher scores = more attention.")),
tags$li(tags$p(style="font-family:Avenir", tags$strong("B: Context-rank percentile score"),
" — this is the percentile of the Altmetric",
tags$a(href="https://www.altmetric.com/about-our-data/the-donut-and-score/",
"attention score"), tags$a(href="https://help.altmetric.com/support/solutions/articles/6000233313-putting-the-altmetric-attention-score-in-context","rank"),
"in context of all articles of the same age in the journal. Here, low percentiles = top.")),
tags$li(tags$p(style="font-family:Avenir", tags$strong("C: All time-rank percentile"), " — this is the percentile of the Altmetric",
tags$a(href="https://www.altmetric.com/about-our-data/the-donut-and-score/",
"attention score"), tags$a(href="https://help.altmetric.com/support/solutions/articles/6000233313-putting-the-altmetric-attention-score-in-context","rank"),
"in context of all articles with Altmetric data ever published in the journal. Here, low percentiles = top."))
), # end ul
mainPanel(
tags$br(),
tags$p(style="font-family:Avenir","The information-theoretic evidence ratio (ER) for a linear trend and the adjusted R",
tags$sup("2"), "for each index are:"),
htmlOutput('ERASc'),
htmlOutput('ERCPc'),
htmlOutput('ERAPc'),
tags$head(tags$style("#ERASc{font-family:Avenir}"
)),
tags$head(tags$style("#ERCPc{font-family:Avenir}"
)),
tags$head(tags$style("#ERAPc{font-family:Avenir}"
)),
tags$br(),
tags$p(style="font-family:Avenir","In each panel below, the linear trend is indicated by a red dashed line."),
tags$br(),
add_busy_spinner(spin="fading-circle", color="#17ca3a", timeout=500, position="bottom-right", height = 250, width = 250),
plotOutput(height="1600px", width="150%", "citationplots")
)
), # end tab6
tabPanel(value="tab7", title=tags$strong("output table descriptors"), style = "background: #e9f8ec",
tags$br(),
tags$a(href="https://flinders.edu.au/", tags$img(height = 100, src = "F_V_CMYK.png", style="float:right",title="Flinders University")),
tags$h2(style="font-family:Avenir", "Description of columns in the output file"),
tags$ol(tags$li(tags$p(style="font-family:Avenir", tags$strong("first author"), "(COLUMN", tags$em("firstAu"),
") — first author of the article")),
tags$li(tags$p(style="font-family:Avenir", tags$strong("publication date"), "(COLUMN", tags$em("PublDate"),
") — DD/MM/YY date of the article's publication")),
tags$li(tags$p(style="font-family:Avenir", tags$strong("article title"), "(COLUMN", tags$em("title"),
") — the first 20 characters of the article's title")),
tags$a(href="https://epicaustralia.org.au/", tags$img(height = 150, src = "CABAHlogo.png",
style="float:right",
title="ARC Centre of Excellence for Australian Biodiversity and Heritage")),
tags$li(tags$p(style="font-family:Avenir", tags$strong("journal name"), "(COLUMN", tags$em("Journal"),
") — the journal in which the article was published")),
tags$li(tags$p(style="font-family:Avenir", tags$strong("digital object identifier"), "(COLUMN", tags$em("doi"),
") — the article's", tags$a(href="https://www.doi.org", "doi"))),
tags$li(tags$p(style="font-family:Avenir", tags$strong("Altmetric attention score"), "(COLUMN", tags$em("AltmScore"),
") — the downloaded Altmetric",
tags$a(href="https://www.altmetric.com/about-our-data/the-donut-and-score/", "attention score"),
"of the article")),
tags$li(tags$p(style="font-family:Avenir", tags$strong("'In-context' rank percentile (by age)"), "(COLUMN", tags$em("rnkCxtPc"),
") — the percentile of the Altmetric rank relative to all articles in the journal of the same age")),
tags$li(tags$p(style="font-family:Avenir", tags$strong("'In-context' rank percentile (all time)"), "(COLUMN", tags$em("rnkAllPc"),
") — the percentile of the Altmetric rank relative to all articles in the journal")),
tags$li(tags$p(style="font-family:Avenir", tags$strong("Number of Crossref citations"), "(COLUMN", tags$em("CRcites"),
") — total number of citations to date according to", tags$a(href="https://www.crossref.org", "Crossref"),
"(if Crossref citations selected)")),
tags$li(tags$p(style="font-family:Avenir", tags$strong("Number of Crossref citations/year"), "(COLUMN", tags$em("CRcitesYr"),
") — total number of citations/year to date according to", tags$a(href="https://www.crossref.org", "Crossref"),
"(if Crossref citations selected)")),
tags$li(tags$p(style="font-family:Avenir", tags$strong("Number of policy-document citations"), "(COLUMN", tags$em("polCit"),
") — total number of citations found in", tags$a(href="https://www.altmetric.com/blog/announcing-our-new-and-improved-policy-tracker/",
"policy documents"), "around the world for articles in the sample")),
tags$a(href="https://github.com/cjabradshaw/AltmetricShiny/blob/main/LICENSE",
tags$img(height = 50, src = "GNU GPL3.png", style="float:right", title="GNU General Public Licence v3.0")),
tags$br()
) # end ol
) # end tab7
) # end tabsetPanel
) # close fluidPage
server <- function(input, output, session) {
observeEvent(input$file1, {
if(input$tabs == "tab1"){
output$table1 <- renderDataTable({
file_to_read = input$file1
if(is.null(file_to_read)){
return()
}
read.table(file_to_read$datapath, sep=input$sep, header=input$header1)
}) # end output table1
datin <- reactive({
fileinp <- input$file1
if(is.null(fileinp)){return()}
inpdat <- data.frame(read.table(fileinp$datapath, sep=input$sep, header = input$header1))
return(inpdat)
}) # end datin
sortInd <- reactiveValues()
observe({
sortInd$x <- as.character(input$sortind)
})
# when action button pressed ...
observeEvent(input$fetchButton, {
removeUI("div:has(>#firstOutput)")
insertUI(
selector = "#placeholder",
where = "afterEnd", # inserts UI after the end of the placeholder element
ui = fluidRow(
h3("fetching data ... (this can take some time depending on the number of articles in your sample)"),
output$etable <- renderDataTable({
if(is.null(datin())){return ()}
results.list <<- AltFunc(datsamp=(datin()), InclCit=input$CRcitations, sortindex=sortInd$x)
results <<- results.list$rnkDatAsort
})))
}) # end observeEvent
output$downloadData <- downloadHandler(
filename = function() {
paste("AltmetricListOut", ".txt", sep = "")
},
content = function(file) {
write.table(results, file, sep="\t", row.names = F)
}
)
} # end if for tab1
}) # end Events
observeEvent(input$tabs, {
if(input$tabs == "tab2"){
date_start <- as.Date(input$timerange[1], origin = "1970-01-01")
date_end <- as.Date(input$timerange[2], origin = "1970-01-01")
results <<- results[(results$PublDate >= date_start) & (results$PublDate <= date_end), ]
output$daterange <- renderText({
paste("SPECIFIED DATE RANGE: ", format(date_start, "%d %B %Y"), " to ", format(date_end, "%d %B %Y"), sep="")
})
output$totDOI <- renderText({
paste("• number of digital object identifiers (doi) processed in this sample: ", results.list$missingAltm + length(results$AltmScore), sep="")
})
output$missingAltm <- renderText({
paste("• number of digital object identifiers (doi) with missing Altmetrics data in this sample: ", results.list$missingAltm, sep="")
})
output$Narticles <- renderText({
paste("• number of articles with Altmetrics data in this sample: ", length(results$AltmScore), sep="")
})
output$topAS <- renderText({
paste("• top Altmetric attention score in this sample: ", round(results$AltmScore[1], 1), sep="")
})
output$topASButton <- renderUI({
tags$meta(name="citation_doi", content=results$doi[1])
tags$script(type='text/javascript', src="embed.js")
withTags(div('data-badge-type'="donut", 'data-doi'=results$doi[1], className="altmetric-embed"))
})
output$medianAS <- renderText({
paste("• median Altmetric attention score for this sample: ", round(10^median(log10(results$AltmScore), na.rm=T), 1), sep="")
})
output$rangeAS <- renderText({
paste("• Altmetric attention score range for this sample: ", round(min(results$AltmScore, na.rm=T), 1)," — ",round(max(results$AltmScore, na.rm=T), 1), sep="")
})
output$IQrangeAS <- renderText({
paste("• Altmetric attention score inter-quartile range for this sample: ", round(10^quantile(log10(results$AltmScore), probs=0.25, na.rm=T), 1)," — ",round(quantile(results$AltmScore, probs=0.75, na.rm=T), 1), sep="")
})
output$topASartDetails <- renderText({
paste("• top Altmetric-scoring article in this sample: ", results$firstAu[1], ". ", as.numeric(format(results$PublDate[1], format="%Y")), ". '", results$title[1], "'", ". ", results$Journal[1], " doi:", results$doi[1], sep="")
})
output$topCP <- renderText({
paste("• median top percentile rank (by age) of this sample: ", "top ",round(median(results$rnkCxtPc, na.rm=T), 2),"%", sep="")
})
output$topAP <- renderText({
paste("• median top percentile rank (all time) of this sample: ", "top ",round(median(results$rnkAllPc, na.rm=T), 2),"%", sep="")
})
output$nArtPol <- renderText({
paste("• number articles in this sample cited in policy documents: ", length(which(results$polCit > 0)), sep="")
})
output$SArtPol <- renderText({
paste("• total number of policy-document citations in this sample: ", sum(results$polCit, na.rm=T), sep="")
})
} # end if for tab2
if(input$tabs == "tab3"){
date_start <- as.Date(input$timerange[1], origin = "1970-01-01")
date_end <- as.Date(input$timerange[2], origin = "1970-01-01")
results <<- results[(results$PublDate >= date_start) & (results$PublDate <= date_end), ]
output$histplots <- renderPlot({
input$histplots
Ctheme = theme(
axis.title.x = element_text(size = 16),
axis.text.x = element_text(size = 14),
axis.title.y = element_text(size = 16),
axis.text.y = element_text(size = 14),
plot.title = element_text(size = 18))
AS <- ggplot(data=results, aes(log10(AltmScore))) +
geom_histogram(bins=round(dim(results)[1]/5),col="grey",fill="black",alpha=0.5) +
geom_vline(xintercept=median(log10(results$AltmScore), na.rm=T), linetype=2, color="red", size=1) +
labs(title=paste("median = ", round(10^median(log10(results$AltmScore), na.rm=T),1),sep="")) +
labs(x="log Altmetric score", y="frequency") +
Ctheme
CP <- ggplot(data=results, aes((rnkCxtPc))) +
geom_histogram(bins=round(dim(results)[1]/5),col="grey",fill="black",alpha=0.5) +
geom_vline(xintercept=median((results$rnkCxtPc), na.rm=T), linetype=2, color="red", size=1) +
labs(title=paste("median = top ", round(median((results$rnkCxtPc), na.rm=T),1),"%",sep="")) +
labs(x="rank % (by age)", y=NULL) +
Ctheme
AP <- ggplot(data=results, aes((rnkAllPc))) +
geom_histogram(bins=round(dim(results)[1]/5),col="grey",fill="black",alpha=0.5) +
geom_vline(xintercept=median((results$rnkAllPc), na.rm=T), linetype=2, color="red", size=1) +
labs(title=paste("median = top ", round(median((results$rnkAllPc),na.rm=T),1),"%",sep="")) +
labs(x="rank % (all time)", y=NULL) +
Ctheme
ggarrange(AS, CP, AP,
labels=c("A", "B", "C"),
ncol=3, nrow=1)
})
} # end if for tab3
if(input$tabs == "tab4"){
date_start <- as.Date(input$timerange[1], origin = "1970-01-01")
date_end <- as.Date(input$timerange[2], origin = "1970-01-01")
results <<- results[(results$PublDate >= date_start) & (results$PublDate <= date_end), ]
output$ERASCP <- renderText({
ER <- linregER(log10(results$AltmScore), logit(results$rnkCxtPc/100))[1]
ERf <- ifelse(ER > 100, format(ER, format="e", digits=3), round(ER, 3))
paste("A. evidence ratio = ", ERf,";",
" R<sup>2</sup>", " = ",round(linregER(log10(results$AltmScore), logit(results$rnkCxtPc/100))[2], 3),sep="")
})
output$ERASAP <- renderText({
ER <- linregER(log10(results$AltmScore), logit(results$rnkAllPc/100))[1]
ERf <- ifelse(ER > 100, format(ER, format="e", digits=3), round(ER, 3))
paste("B. evidence ratio = ", ERf,";",
" R<sup>2</sup>", " = ", round(linregER(log10(results$AltmScore), logit(results$rnkAllPc/100))[2], 3),sep="")
})
if (input$doilabs == "yes") {
output$interplots <- renderPlot({
input$interplots
Ctheme = theme(
axis.title.x = element_text(size = 16),
axis.text.x = element_text(size = 14),
axis.title.y = element_text(size = 16),
axis.text.y = element_text(size = 14))
ASCP <- ggplot(data=results, aes(x=log10(AltmScore), y=logit(rnkCxtPc/100))) +
geom_point() +
geom_smooth() +
geom_smooth(method=lm, se=F, linetype="dashed", color="dark red") +
labs(x=NULL, y="logit rank proportion (by age)") +
geom_label_repel(aes(label = doi),
box.padding = 0.35,
point.padding = 0.5,
segment.color = 'grey50',
segment.alpha = 0.7,
show.legend = F,
alpha=0.7) +
scale_radius(c(0.45,0.45)) +
Ctheme
ASAP <- ggplot(data=results, aes(x=log10(AltmScore), y=logit(rnkAllPc/100))) +
geom_point() +
geom_smooth() +
geom_smooth(method=lm, se=F, linetype="dashed", color="dark red") +
labs(x="log Altmetric score", y="logit rank proportion (all time)") +
geom_label_repel(aes(label = doi),
box.padding = 0.35,
point.padding = 0.5,
segment.color = 'grey50',
segment.alpha = 0.7,
show.legend = F,
alpha=0.7) +
scale_radius(c(0.45,0.45)) +
Ctheme
ASAP
ggarrange(ASCP, ASAP,
labels=c("A", "B"),
ncol=1, nrow=2
)
})
} # end if
if (input$doilabs == "no") {
output$interplots <- renderPlot({
input$interplots
Ctheme = theme(
axis.title.x = element_text(size = 16),
axis.text.x = element_text(size = 14),
axis.title.y = element_text(size = 16),
axis.text.y = element_text(size = 14))
ASCP <- ggplot(data=results, aes(x=log10(AltmScore), y=logit(rnkCxtPc/100))) +
geom_point() +
geom_smooth() +
geom_smooth(method=lm, se=F, linetype="dashed", color="dark red") +
labs(x=NULL, y="logit rank proportion (by age)") +
scale_radius(c(0.45,0.45)) +
Ctheme
ASAP <- ggplot(data=results, aes(x=log10(AltmScore), y=logit(rnkAllPc/100))) +
geom_point() +
geom_smooth() +
geom_smooth(method=lm, se=F, linetype="dashed", color="dark red") +
labs(x="log Altmetric score", y="logit rank proportion (all time)") +
scale_radius(c(0.45,0.45)) +
Ctheme
ggarrange(ASCP, ASAP,
labels=c("A", "B"),
ncol=1, nrow=2
)
})
} # end if
} # end if for tab4
if(input$tabs == "tab5"){
date_start <- as.Date(input$timerange[1], origin = "1970-01-01")
date_end <- as.Date(input$timerange[2], origin = "1970-01-01")
results <<- results[(results$PublDate >= date_start) & (results$PublDate <= date_end), ]
output$ERASt <- renderText({
ER <- linregER(results$PublDate, log10(results$AltmScore))[1]
ERf <- ifelse(ER > 100, format(ER, format="e", digits=3), round(ER, 3))
paste("A. evidence ratio = ", ERf,";",
" R<sup>2</sup>", " = ",round(linregER(results$PublDate, log10(results$AltmScore))[2], 3),sep="")
})
output$ERCPt <- renderText({
ER <- linregER(results$PublDate, results$rnkCxtPc)[1]
ERf <- ifelse(ER > 100, format(ER, format="e", digits=3), round(ER, 3))
paste("B. evidence ratio = ", ERf,";",
" R<sup>2</sup>", " = ", round(linregER(results$PublDate, results$rnkCxtPc)[2], 3),sep="")
})
output$ERAPt <- renderText({
ER <- linregER(results$PublDate, results$rnkAllPc)[1]
ERf <- ifelse(ER > 100, format(ER, format="e", digits=3), round(ER, 3))
paste("C. evidence ratio = ", ERf,";",
" R<sup>2</sup>", " = ", round(linregER(results$PublDate, results$rnkAllPc)[2], 3),sep="")
})
if (input$doilabs == "yes") {
if (input$CRcitations == "yes") {
output$timeplots <- renderPlot({
input$timeplots
Ctheme = theme(
axis.title.x = element_text(size = 16),
axis.text.x = element_text(size = 14),
axis.title.y = element_text(size = 16),
axis.text.y = element_text(size = 14))
ASt <- ggplot(data=results, aes(x=PublDate, y=log10(AltmScore), size=CRcites)) +
geom_smooth(show.legend = F) +
geom_smooth(method=lm, se=F, linetype="dashed", color="dark red", show.legend = F) +
geom_point(alpha=0.6, colour="green") +
scale_size(range = c(0.1, 10), name="citations") +
labs(x=NULL, y="log Altmetric score") +
geom_label_repel(aes(label = doi),
size=3,
box.padding = 0.35,
point.padding = 0.5,
segment.color = 'grey50',
segment.alpha = 0.7,
show.legend = F,
alpha=0.7) +
Ctheme
ASt
CPt <- ggplot(data=results, aes(x=PublDate, y=rnkCxtPc, size=CRcites)) +
geom_smooth(show.legend = F) +
geom_smooth(method=lm, se=F, linetype="dashed", color="dark red", show.legend = F) +
geom_point(alpha=0.6, colour="green", show.legend = T) +
scale_size(range = c(0.1, 10), name="citations") +
labs(x=NULL, y="rank % (by age)") +
geom_label_repel(aes(label = doi),
size=3,
box.padding = 0.35,
point.padding = 0.5,
segment.color = 'grey50',
segment.alpha = 0.7,
show.legend = F,
alpha=0.7) +
Ctheme
APt <- ggplot(data=results, aes(x=PublDate, y=rnkAllPc, size=CRcites)) +
geom_smooth(show.legend = F) +
geom_smooth(method=lm, se=F, linetype="dashed", color="dark red", show.legend = F) +
geom_point(alpha=0.6, colour="green", show.legend = T) +
scale_size(range = c(0.1, 10), name="citations") +
labs(x=NULL, y="rank % (all time)") +
geom_label_repel(aes(label = doi),
size=3,
box.padding = 0.35,
point.padding = 0.5,
segment.color = 'grey50',
segment.alpha = 0.7,
show.legend = F,
alpha=0.7) +
Ctheme
polDat <- results[which(results$polCit > 0),]
Polt <- ggplot(data=polDat, aes(x=PublDate, y=polCit, size=CRcites)) +
geom_point(alpha=0.6, colour="green", show.legend = T) +
scale_size(range = c(0.1, 10), name="citations") +
geom_smooth(show.legend = F) +
labs(x=NULL, y="policy citations") +
geom_label_repel(aes(label = doi),
size=3,
box.padding = 0.35,
point.padding = 0.5,
segment.color = 'grey50',
segment.alpha = 0.7,
show.legend = F,
alpha=0.7) +
Ctheme
ggarrange(ASt, CPt, APt, Polt,
labels=c("A", "B", "C", "D"),
ncol=1, nrow=4
)
})
} # end citations yes if
if (input$CRcitations == "no") {
output$timeplots <- renderPlot({
input$timeplots
Ctheme = theme(
axis.title.x = element_text(size = 16),
axis.text.x = element_text(size = 14),
axis.title.y = element_text(size = 16),
axis.text.y = element_text(size = 14))
ASt <- ggplot(data=results, aes(x=PublDate, y=log10(AltmScore))) +
geom_smooth(show.legend = F) +
geom_smooth(method=lm, se=F, linetype="dashed", color="dark red", show.legend = F) +
geom_point(show.legend = T) +
labs(x=NULL, y="log Altmetric score") +
geom_label_repel(aes(label = doi),
box.padding = 0.35,
point.padding = 0.5,
segment.color = 'grey50',
segment.alpha = 0.7,
show.legend = F,
alpha=0.7) +
Ctheme
CPt <- ggplot(data=results, aes(x=PublDate, y=rnkCxtPc)) +
geom_smooth(show.legend = F) +
geom_smooth(method=lm, se=F, linetype="dashed", color="dark red", show.legend = F) +
geom_point(show.legend = T) +
labs(x=NULL, y="rank % (by age)") +
geom_label_repel(aes(label = doi),
box.padding = 0.35,
point.padding = 0.5,
segment.color = 'grey50',
segment.alpha = 0.7,
show.legend = F,
alpha=0.7) +
Ctheme
APt <- ggplot(data=results, aes(x=PublDate, y=rnkAllPc)) +
geom_smooth(show.legend = F) +
geom_smooth(method=lm, se=F, linetype="dashed", color="dark red", show.legend = F) +
geom_point(show.legend = F) +
labs(x=NULL, y="rank % (all time)") +
geom_label_repel(aes(label = doi),
box.padding = 0.35,
point.padding = 0.5,
segment.color = 'grey50',
segment.alpha = 0.7,
show.legend = F,
alpha=0.7) +
Ctheme
polDat <- results[which(results$polCit > 0),]
Polt <- ggplot(data=polDat, aes(x=PublDate, y=polCit)) +
geom_point(show.legend = F) +
geom_smooth(show.legend = F) +
labs(x=NULL, y="policy citations") +
geom_label_repel(aes(label = doi),
box.padding = 0.35,
point.padding = 0.5,
segment.color = 'grey50',
segment.alpha = 0.7,
show.legend = F,
alpha=0.7) +
Ctheme
ggarrange(ASt, CPt, APt, Polt,
labels=c("A", "B", "C", "D"),
ncol=1, nrow=4
)
})
} # end citations no if
} # end doi labels if
if (input$doilabs == "no") {
if (input$CRcitations == "yes") {
output$timeplots <- renderPlot({
input$timeplots
Ctheme = theme(
axis.title.x = element_text(size = 16),
axis.text.x = element_text(size = 14),
axis.title.y = element_text(size = 16),
axis.text.y = element_text(size = 14))
ASt <- ggplot(data=results, aes(x=PublDate, y=log10(AltmScore), size=CRcites)) +
geom_smooth(show.legend = F) +
geom_smooth(method=lm, se=F, linetype="dashed", color="dark red", show.legend = F) +
geom_point(alpha=0.6, colour="green") +
scale_size(range = c(0.1, 10), name="citations") +
labs(x=NULL, y="log Altmetric score") +
Ctheme
CPt <- ggplot(data=results, aes(x=PublDate, y=rnkCxtPc, size=CRcites)) +
geom_smooth(show.legend = F) +
geom_smooth(method=lm, se=F, linetype="dashed", color="dark red", show.legend = F) +
geom_point(alpha=0.6, colour="green", show.legend = T) +
scale_size(range = c(0.1, 10), name="citations") +
labs(x=NULL, y="rank % (by age)") +
Ctheme
APt <- ggplot(data=results, aes(x=PublDate, y=rnkAllPc, size=CRcites)) +
geom_smooth(show.legend = F) +
geom_smooth(method=lm, se=F, linetype="dashed", color="dark red", show.legend = F) +
geom_point(alpha=0.6, colour="green", show.legend = T) +
scale_size(range = c(0.1, 10), name="citations") +
labs(x=NULL, y="rank % (all time)") +
Ctheme
polDat <- results[which(results$polCit > 0),]
Polt <- ggplot(data=polDat, aes(x=PublDate, y=polCit, size=CRcites)) +
geom_point(alpha=0.6, colour="green", show.legend = T) +
scale_size(range = c(0.1, 10), name="citations") +
geom_smooth(show.legend = F) +
labs(x=NULL, y="policy citations") +
Ctheme
ggarrange(ASt, CPt, APt, Polt,
labels=c("A", "B", "C", "D"),
ncol=1, nrow=4
)
})
} # end citations yes if
if (input$CRcitations == "no") {
output$timeplots <- renderPlot({
input$timeplots
Ctheme = theme(
axis.title.x = element_text(size = 16),
axis.text.x = element_text(size = 14),
axis.title.y = element_text(size = 16),
axis.text.y = element_text(size = 14))
ASt <- ggplot(data=results, aes(x=PublDate, y=log10(AltmScore))) +
geom_smooth(show.legend = F) +
geom_smooth(method=lm, se=F, linetype="dashed", color="dark red", show.legend = F) +
geom_point(show.legend = T) +
labs(x=NULL, y="log Altmetric score") +
Ctheme
CPt <- ggplot(data=results, aes(x=PublDate, y=rnkCxtPc)) +
geom_smooth(show.legend = F) +
geom_smooth(method=lm, se=F, linetype="dashed", color="dark red", show.legend = F) +
geom_point(show.legend = T) +
labs(x=NULL, y="rank % (by age)") +
Ctheme
APt <- ggplot(data=results, aes(x=PublDate, y=rnkAllPc)) +
geom_smooth(show.legend = F) +
geom_smooth(method=lm, se=F, linetype="dashed", color="dark red", show.legend = F) +
geom_point(show.legend = F) +
labs(x=NULL, y="rank % (all time)") +
Ctheme
polDat <- results[which(results$polCit > 0),]
Polt <- ggplot(data=polDat, aes(x=PublDate, y=polCit)) +
geom_point(show.legend = F) +
geom_smooth(show.legend = F) +
labs(x=NULL, y="policy citations") +
Ctheme
ggarrange(ASt, CPt, APt, Polt,
labels=c("A", "B", "C", "D"),
ncol=1, nrow=4
)
})
} # end citations no if
} # end doi labels if
} # end if for tab5
if(input$tabs == "tab6"){
if (input$CRcitations == "yes") {
if (input$doilabs == "no") {
date_start <- as.Date(input$timerange[1], origin = "1970-01-01")
date_end <- as.Date(input$timerange[2], origin = "1970-01-01")
results <<- results[(results$PublDate >= date_start) & (results$PublDate <= date_end), ]
output$ERASc <- renderText({
dataERAScNA <- data.frame(log10(results$CRcitesYr), log10(results$AltmScore))
dataERAScREL <- na.omit(do.call(data.frame,lapply(dataERAScNA,function(x) replace(x, is.infinite(x), NA))))
ER <- linregER(dataERAScREL[,1], dataERAScREL[,2])[1]
ERf <- ifelse(ER > 100, format(ER, format="e", digits=3), round(ER, 3))
paste("A. evidence ratio = ", ERf,";",
" R<sup>2</sup>", " = ",round(linregER(dataERAScREL[,1], dataERAScREL[,2])[2], 3),sep="")
})
output$ERCPc <- renderText({
dataERCPcNA <- data.frame(log10(results$CRcitesYr), logit(results$rnkCxtPc/100))
dataERCPcREL <- na.omit(do.call(data.frame,lapply(dataERCPcNA,function(x) replace(x, is.infinite(x), NA))))
ER <- linregER(dataERCPcREL[,1], dataERCPcREL[,2])[1]
ERf <- ifelse(ER > 100, format(ER, format="e", digits=3), round(ER, 3))
paste("B. evidence ratio = ", ERf,";",
" R<sup>2</sup>", " = ", round(linregER(dataERCPcREL[,1], dataERCPcREL[,2])[2], 3),sep="")
})
output$ERAPc <- renderText({
dataERAPcNA <- data.frame(log10(results$CRcitesYr), logit(results$rnkAllPc/100))
dataERAPcREL <- na.omit(do.call(data.frame,lapply(dataERAPcNA,function(x) replace(x, is.infinite(x), NA))))
ER <- linregER(dataERAPcREL[,1], dataERAPcREL[,2])[1]
ERf <- ifelse(ER > 100, format(ER, format="e", digits=3), round(ER, 3))
paste("C. evidence ratio = ", ERf,";",
" R<sup>2</sup>", " = ", round(linregER(dataERAPcREL[,1], dataERAPcREL[,2])[2], 3),sep="")
})
output$citationplots <- renderPlot({
input$citationplots
Ctheme = theme(
axis.title.x = element_text(size = 16),
axis.text.x = element_text(size = 14),
axis.title.y = element_text(size = 16),
axis.text.y = element_text(size = 14))
ASc <- ggplot(data=results, aes(x=log10(CRcitesYr), y=log10(AltmScore))) +
geom_point() +
geom_smooth(method=lm, se=F, linetype="dashed", color="dark red") +
labs(x=NULL, y="log Altmetric score") +
Ctheme
CPc <- ggplot(data=results, aes(x=log10(CRcitesYr), y=logit(rnkCxtPc/100))) +
geom_point() +
geom_smooth(method=lm, se=F, linetype="dashed", color="dark red") +
labs(x=NULL, y="logit rank proportion (by age)") +
Ctheme
APc <- ggplot(data=results, aes(x=log10(CRcitesYr), y=logit(rnkAllPc/100))) +
geom_point() +
geom_smooth(method=lm, se=F, linetype="dashed", color="dark red") +
labs(x="log Crossref citations/year", y="logit rank proportion (all time)") +
Ctheme
ggarrange(ASc, CPc, APc,
labels=c("A", "B", "C"),
ncol=1, nrow=3
)
})
} # end no doi labels if
if (input$doilabs == "yes") {
date_start <- as.Date(input$timerange[1], origin = "1970-01-01")
date_end <- as.Date(input$timerange[2], origin = "1970-01-01")
results <<- results[(results$PublDate >= date_start) & (results$PublDate <= date_end), ]