-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.Rhistory
512 lines (512 loc) · 18.8 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
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
verbose = TRUE
)
data <- oa_fetch(
#identifier = "V202381698",
entity = "works",
title.search = c("bibliometric analysis"),
#cited_by_count = ">50",
from_publication_date = "2012-01-01",
to_publication_date = "2022-12-31",
sort = "cited_by_count:desc",
verbose = TRUE
)
View(data)
View(data)
View(data[[28]][[1]])
data_picard <- oa_fetch(
identifier = "A687641213",
entity = "works",
title.search = c("bibliometric analysis"),
#cited_by_count = ">50",
from_publication_date = "2012-01-01",
to_publication_date = "2022-12-31",
sort = "cited_by_count:desc",
verbose = TRUE
)
data_picard <- oa_fetch(
identifier = "A687641213",
entity = "works",
title.search = "bibliometric analysis",
#cited_by_count = ">50",
from_publication_date = "2012-01-01",
to_publication_date = "2022-12-31",
sort = "cited_by_count:desc",
verbose = TRUE
)
data_picard <- oa_fetch(
identifier = c("A687641213"),
verbose = TRUE
)
data_picard <- oa_fetch(
identifier = c("A687641213"),
entity = "works",
verbose = TRUE
)
View(data_picard)
View(data_picard)
View(data_picard[[5]][[1]])
View(data)
data_picard <- oa_fetch(
identifier = c("A687641213"),
entity = "works",
abstract = TRUE,
verbose = TRUE
)
data_picard <- oa_fetch(
identifier = c("A687641213"),
entity = "venues",
abstract = TRUE,
verbose = TRUE
)
data_picard <- oa_fetch(
identifier = c("A687641213"),
#entity = "works",
abstract = TRUE,
verbose = TRUE
)
View(data_picard)
View(data_picard)
View(data_picard[[5]][[1]])
View(data_picard[[9]][[1]])
shiny::runApp('~/Documents/GitHubhttps:/github.com/poppy-nicolette/ShinyShiny/ShinyShiny/BibloBox')
runApp('~/Documents/GitHubhttps:/github.com/poppy-nicolette/ShinyShiny/ShinyShiny/BibloBox')
runApp('~/Documents/GitHubhttps:/github.com/poppy-nicolette/ShinyShiny/ShinyShiny/BibloBox')
runApp('~/Documents/GitHubhttps:/github.com/poppy-nicolette/ShinyShiny/ShinyShiny/BibloBox')
runApp('~/Documents/GitHubhttps:/github.com/poppy-nicolette/ShinyShiny/ShinyShiny/BibloBox')
runApp('~/Documents/GitHubhttps:/github.com/poppy-nicolette/ShinyShiny/ShinyShiny/BibloBox')
runApp('~/Documents/GitHubhttps:/github.com/poppy-nicolette/ShinyShiny/ShinyShiny/BibloBox')
runApp('~/Documents/GitHubhttps:/github.com/poppy-nicolette/ShinyShiny/ShinyShiny/BibloBox')
#BiblioBox - upload csv file to retrieve normalized citation measures
#
#authors: PMongeon, PNRiddle - QSS Lab/MISTS/Dalhousie University
#
# sources:
# https://shiny.rstudio.com/articles/upload.html
library(shiny)
library(shinycssloaders)
library(dplyr)
library(stringr)
library(readxl)
library(openalexR)
# Define UI for application that draws a histogram
ui <- fluidPage(
# Application title
titlePanel("BiblioBox"),
h4(" - Normalization is not being normal"),
# Sidebar with a slider input for number of bins
sidebarLayout(
sidebarPanel(width = 6, fluid = TRUE,
# Input: Selector for choosing dataset ------------------------------
h4("Step1: Upload your template file"),
fileInput("file1", "Choose your Excel Template file",
multiple = TRUE,
accept = c(".csv",
".xlsx")),#close fileInput
#enter emai for some APIs that permit it for politeness
h4("Step 2: Enter your email"),
textInput(inputId = "emailInput", label = "Enter email"),
helpText("Your email is used for the politeness pool on the OpenAlex server."),
uiOutput("emailInputok"),
tags$hr(style = "border-top: 1.5px solid #000000;"),
#flluidRow-------------------------------------------------
fluidRow(
column(6,
#output-----------------------------------------------------
h3("Output"),
# Input: Checkbox if file has header ----
checkboxInput("output_p", "P.", FALSE),
# Input: Checkbox if file for indicator 1 ----
checkboxInput("output_p_frac", "P. Frac.", FALSE),
# Input: Checkbox if file for indicator 2 ----
checkboxInput("output_harmonic", "Harmonic", FALSE),
# Input: Checkbox if file for indicator 2 ----
checkboxInput("output_arith", "Arithmatic", FALSE),
tags$hr(style = "border-top: 1.5px solid #000000;"),
#Collaboration ---------------------------------------------
h3("Collaboration"),
# collaboration ----
checkboxInput("collab", "Collaboration", FALSE),
# collaboration_inst ----
checkboxInput("collab_Inst", "Inter-institutional collaboration", FALSE),
# collaboratio_internat ----
checkboxInput("collab_Internat", "International collaboration", FALSE),
# collaboration_Intersect ----
checkboxInput("collab_Intersect", "Intersectional collaboration", FALSE),
# collaboration_NAuth ----
checkboxInput("collab_NAuth", "Collaboration: N of Authors", FALSE),
# collaborationNInst ----
checkboxInput("collab_NInst", "Collaboration: N of Institutions", FALSE),
# collaboratio_NCounttry ----
checkboxInput("collab_NCountry", "Collaboratio: N of Countries", FALSE)
),#end column
column(6,
#Disciplines ---------------------------------------------
h3("Discipine/field classification"),
# disciplines ----
checkboxInput("scimet", "Science Metrix codes", FALSE),
#Citations -----------------------------------------------
h3("Citations"),
#citations ----
checkboxInput("citations_n_cit", "N Citations", FALSE),
#citations_norm_cit ----
checkboxInput("citations_norm_cit", "Normalized Citations", FALSE),
#citations_HCP_1 ----
checkboxInput("citations_HCP_1", "HCP 1%", FALSE),
#citations_HCP_5 ----
checkboxInput("citations_HCP_5", "HCP 5%", FALSE),
#citations_HCP_10 ----
checkboxInput("citations_HCP_10", "HCP 10%", FALSE),
#citations_list_cited ----
checkboxInput("citations_list_cite", "List of cited documents", FALSE)
),#close column
tags$hr(style = "border-top: 1.5px solid #000000;")
),#close fluidRow
# Download Button-------------------------------------------------------------
tags$hr(style = "border-top: 1.5px solid #000000;"),
radioButtons("downloadType", "Download Type",
choices = c("CSV" = ".csv",
"Excel - Not working right now" = ".xlsx")),
downloadButton("downloadData", "Compute and download")
),#close sidebarPanel
# mainPanel--------------------------------------------------------------
mainPanel(width = 4,
h4("There will be some text here explaining everything"),
br(),
br(),
p("Below, you will find the methods for the indicators you have selected."),
br(),
tags$hr(style = "border-top: .5px solid #000000;"),
#output---------------------------
fluidRow(uiOutput("uo_text_p")),
fluidRow(uiOutput("uo_text_p_frac")),
fluidRow(uiOutput("uo_text_harmonic")),
fluidRow(uiOutput("uo_text_arith")),
#collab------------------------------
fluidRow(uiOutput("uo_text_collab")),
fluidRow(uiOutput("uo_text_collab_Inst")),
fluidRow(uiOutput("uo_text_collab_Internat")),
fluidRow(uiOutput("uo_text_collab_Intersect")),
fluidRow(uiOutput("uo_text_collab_NAuth")),
fluidRow(uiOutput("uo_text_collab_NInst")),
fluidRow(uiOutput("uo_text_collab_NCountry")),
#discipline--------------------------
fluidRow(uiOutput("uo_text_scimet")),
#citations---------------------------
fluidRow(uiOutput("uo_text_citations_n_cit")),
fluidRow(uiOutput("uo_text_citations_norm_cit")),
fluidRow(uiOutput("uo_text_citations_HCP_1")),
fluidRow(uiOutput("uo_text_citations_HCP_5")),
fluidRow(uiOutput("uo_text_citations_HCP_10")),
fluidRow(uiOutput("uo_text_citations_list_cite")),
br()
)#closes mainPanel
)#closes sidebarLayout
)#close fluidPage
# Define server logic----------------------------------------------------------
#source files; https://stackoverflow.com/questions/68976268/r-shiny-upload-csv-calculate-values-in-table-and-then-download-results-as-a
server <- function(input, output) {
#checkbox output outputs------------------
#checkbox output_p method
output$uo_text_p <- renderUI({
if(input$output_p == TRUE) {
tags$div(tags$p("This will be information about the P method"))
}})#close output
#checkbox output_p_frac method
output$uo_text_p_frac <- renderUI({
if(input$output_p_frac == TRUE) {
tags$div(tags$p("This will be information about the P Fractional method"))
}})#close output
#checkbox output_harmonic method
output$uo_text_harmonic <- renderUI({
if(input$output_harmonic == TRUE) {
tags$div(tags$p("This will be information about the Harmonic method"))
}})#close output
#checkbox output_arith method
output$uo_text_arith <- renderUI({
if(input$output_arith == TRUE) {
tags$div(tags$p("This will be information about the Arithmatic method"))
}})#close output
#checkbox output_arith method
output$uo_text_arith <- renderUI({
if(input$output_arith == TRUE) {
tags$div(tags$p("This will be information about the Arithmatic method"))
}})#close output
#collab--------------------
output$uo_text_collab <- renderUI({
if(input$collab == TRUE) {
tags$div(tags$p("This will be information about the collaboration indicator"))
}})#close output
output$uo_text_collab_Inst <- renderUI({
if(input$collab_Inst == TRUE) {
tags$div(tags$p("This will be information about the inter-institution collaboration indicator"))
}})#close output
output$uo_text_collab_Internat <- renderUI({
if(input$collab_Internat == TRUE) {
tags$div(tags$p("This will be information about the international collaboration indicator"))
}})#close output
output$uo_text_collab_Intersect <- renderUI({
if(input$collab_Intersect == TRUE) {
tags$div(tags$p("This will be information about the intersectional collaboration indicator"))
}})#close output
output$uo_text_collab_NAuth <- renderUI({
if(input$collab_NAuth == TRUE) {
tags$div(tags$p("This will be information about the number of Authors indicator"))
}})#close output
output$uo_text_collab_NInst <- renderUI({
if(input$collab_NInst == TRUE) {
tags$div(tags$p("This will be information about the number of Institutions indicator"))
}})#close output
output$uo_text_collab_NCountry <- renderUI({
if(input$collab_NCountry == TRUE) {
tags$div(tags$p("This will be information about the number of Countries indicator"))
}})#close output
#discipline output-------------------------
output$uo_text_scimet <- renderUI({
if(input$scimet == TRUE) {
tags$div(tags$p("This will be information about the Science Metrixs field classification indicator"))
}})#close output
#citations output-------------------------
output$uo_text_citations_n_cit <- renderUI({
if(input$citations_n_cit == TRUE) {
tags$div(tags$p("This will be information about the number of citations indicator"))
}})#close output
output$uo_text_citations_norm_cit <- renderUI({
if(input$citations_norm_cit == TRUE) {
tags$div(tags$p("This will be information about the normalized citations indicator"))
}})#close output
output$uo_text_citations_HCP_1 <- renderUI({
if(input$citations_HCP_1 == TRUE) {
tags$div(tags$p("This will be information about the citations HCP 1% indicator"))
}})#close output
output$uo_text_citations_HCP_5 <- renderUI({
if(input$citations_HCP_5 == TRUE) {
tags$div(tags$p("This will be information about the citations HCP 5% indicator"))
}})#close output
output$uo_text_citations_HCP_10 <- renderUI({
if(input$citations_HCP_10 == TRUE) {
tags$div(tags$p("This will be information about the citations HCP 10% indicator"))
}})#close output
output$uo_text_citations_list_cite <- renderUI({
if(input$citations_list_cite == TRUE) {
tags$div(tags$p("This will be information about the list of cited documents"))
}})#close output
#assign email to options for polite pool--------------------
email <- eventReactive(input$emailInput, {
req(input$emailInput)
options(openalexR.mailto = input$emailInput)
})#close eventReactive
#create and modify dataframe-------------------------------------------------------
rawData <- eventReactive(input$file1, {
req(input$file1)
#template <- read.csv(input$file1$datapath)
template <- read_excel(input$file1$datapath, sheet = 2) %>%
mutate(doi = str_sub(doi, str_locate(doi,"10.")[,1])) %>%
mutate(openalex_id = str_sub(openalex_id, str_locate(openalex_id,"W")[,1]))
for (i in 1:nrow(template)) {
doi<-""
id<-""
doi<-template[i,]$doi[!is.na(template[i,]$doi)]
id<-template[i,]$openalex_id[!is.na(template[i,]$openalex_id)]
data <- tibble()
data_doi <- tibble()
data_id <- tibble()
if(length(doi)>0) {
data <- oa_fetch(doi = doi,entity = "works", verbose = TRUE, abstract = TRUE)
} else if (length(id)>0) {
data <- oa_fetch(identifier = id, entity = "works", verbose = TRUE, abstract = TRUE)
}
if(length(data)>0){
template[i,]$doi <- data$doi
template[i,]$openalex_id <- data$id
template[i,]$pub_year <- data$publication_year
template[i,]$title <- data$display_name
template[i,]$authors <- paste(shQuote(data$author[[1]]$au_display_name), collapse=", ")
template[i,]$openalex_author_ids <- paste(shQuote(data$author[[1]]$au_id), collapse=", ")
template[i,]$source <- data$so
template[i,]$volume <- data$volume
template[i,]$number <- data$issue
if(data$first_page == data$last_page) {pages <- data$first_page} else {pages <- paste(data$first_page,"-",data$last_page, sep = "")}
template[i,]$pages <- pages
template[i,]$institutions <- paste(shQuote(unique(data$author[[1]]$institution_display_name)), collapse=", ")
template[i,]$openalex_institution_ids <- paste(shQuote(unique(data$author[[1]]$institution_id)), collapse=", ")
template[i,]$countries <- paste(shQuote(unique(data$author[[1]]$institution_country_code)), collapse=", ")
template[i,]$authors_affiliations <- paste(shQuote(paste(data$author[[1]]$au_id," [",data$author[[1]]$institution_id,"]",sep="")), collapse=", ")
template[i,]$abstract <- data$ab
template[i,]$wikidata_concepts <- paste(shQuote(data$concepts[[1]]$display_name), collapse=", ")
}
}
template # this is critial and easily overlooked!
#-**************************************************
}
)#close eventReactive
rawData
#downloadHandler----------------------------------------------------------
output$downloadData <- downloadHandler(
filename = function() {paste("modified template_", Sys.Date(), input$downloadType)},
content = function(file){
if(input$downloadType == ".csv") {
write.csv(rawData(), file, row.names = FALSE)}
else if(input$downloadType == ".xlsx") {
writexl::write_xlsx(rawData(), file, row.names = FALSE)
}
}#close function
)#close downloadHandler
}#close server
# Run the application ----------------------------------------------------------
shinyApp(ui = ui, server = server)
runApp('~/Documents/GitHubhttps:/github.com/poppy-nicolette/ShinyShiny/ShinyShiny/BibloBox')
runApp('~/Documents/GitHubhttps:/github.com/poppy-nicolette/ShinyShiny/ShinyShiny/BibloBox')
shiny::runApp('~/Desktop/CODING_WORKING/R/PROJECTS/BiblioNet')
runApp('~/Desktop/CODING_WORKING/R/PROJECTS/BiblioNet')
runApp('~/Desktop/CODING_WORKING/R/PROJECTS/BiblioNet')
runApp('~/Desktop/CODING_WORKING/R/PROJECTS/BiblioNet')
runApp('~/Desktop/CODING_WORKING/R/PROJECTS/BiblioNet')
install.packages("shinyBS")
runApp('~/Desktop/CODING_WORKING/R/PROJECTS/BiblioNet')
runApp('~/Desktop/CODING_WORKING/R/PROJECTS/BiblioNet')
runApp('~/Desktop/CODING_WORKING/R/PROJECTS/BiblioNet')
runApp('~/Desktop/CODING_WORKING/R/PROJECTS/BiblioNet')
runApp('~/Desktop/CODING_WORKING/R/PROJECTS/BiblioNet')
runApp('~/Desktop/CODING_WORKING/R/PROJECTS/BiblioNet')
runApp('~/Desktop/CODING_WORKING/R/PROJECTS/BiblioNet')
runApp('~/Desktop/CODING_WORKING/R/PROJECTS/BiblioNet')
shiny::runApp('~/Desktop/CODING_WORKING/R/PROJECTS/BiblioNet')
# Import the necessary libraries
library(readxl)
# Set the path to the Excel file
file_path <- "path/to/file.xlsx"
# Import the Excel file
data <- read_excel(file_path)
# Set the path to the Excel file
file_path <- "/Users/nicolapoppy/Desktop/template_new.xlsx"
# Import the Excel file
data <- read_excel(file_path)
# View the imported data
head(data)
View(data)
View(data)
library(tidyverse)
tidyverse_packages()
shiny::runApp('~/Documents/GitHubhttps/github_com/poppy-nicolette/ShinyShiny/ShinyShiny/tabset_1')
runApp('~/Documents/GitHubhttps/github_com/poppy-nicolette/ShinyShiny/ShinyShiny/tabset_1')
runApp('~/Documents/GitHubhttps/github_com/poppy-nicolette/ShinyShiny/ShinyShiny/tabset_1')
runApp('~/Documents/GitHubhttps/github_com/poppy-nicolette/ShinyShiny/ShinyShiny/tabset_1')
runApp('~/Documents/GitHubhttps/github_com/poppy-nicolette/ShinyShiny/ShinyShiny/tabset_1')
View(data)
View(data)
data()
shiny::runApp('~/Documents/GitHubhttps/github_com/poppy-nicolette/INFO6270_ShinyDash/shinydashboard_sidebar')
?fluidPage
install.packages("ggplot2")
library(shiny); runApp('~/Documents/GitHubhttps/github_com/poppy-nicolette/INFO6270_ShinyDash/plainFluidPage/plainFluidPage.R')
runApp('~/Documents/GitHubhttps/github_com/poppy-nicolette/INFO6270_ShinyDash/sidebarLayout/sidebarLayout.R')
runApp('~/Documents/GitHubhttps/github_com/poppy-nicolette/INFO6270_ShinyDash/plainFluidPage/plainFluidPage.R')
runApp('~/Documents/GitHubhttps/github_com/poppy-nicolette/INFO6270_ShinyDash/plainFluidPage/plainFluidPage.R')
runApp('~/Documents/GitHubhttps/github_com/poppy-nicolette/INFO6270_ShinyDash/shiny_fluidrow')
runApp('~/Documents/GitHubhttps/github_com/poppy-nicolette/INFO6270_ShinyDash/fluidPage_demo/fluidPage_demo.R')
runApp('~/Documents/GitHubhttps/github_com/poppy-nicolette/INFO6270_ShinyDash/plainFluidPage/plainFluidPage.R')
runApp('~/Documents/GitHubhttps/github_com/poppy-nicolette/INFO6270_ShinyDash/plainFluidPage/plainFluidPage.R')
runApp('~/Documents/GitHubhttps/github_com/poppy-nicolette/INFO6270_ShinyDash/plainFluidPage/plainFluidPage.R')
runApp('~/Documents/GitHubhttps/github_com/poppy-nicolette/INFO6270_ShinyDash/sidebarLayout/sidebarLayout.R')
runApp('~/Documents/GitHubhttps/github_com/poppy-nicolette/INFO6270_ShinyDash/plainFluidPage/plainFluidPage.R')
runApp('~/Documents/GitHubhttps/github_com/poppy-nicolette/INFO6270_ShinyDash/tabset_example')
setwd("~/Documents/GitHubhttps/github_com/poppy-nicolette/INFO6270_ShinyDash")
shiny::runApp('Amazing_dashboard')
View(data)
View(data)
runApp('Amazing_dashboard')
View(data)
gc()
data <- mtcars
View(data)
View(data)
runApp('Amazing_dashboard')
runApp('Amazing_dashboard')
data <- mtcars
data%>%
colnames(data)[0] <- 'manufacturer'
library(dplyr)
data <- mtcars
data%>%
colnames(data)[0] <- 'manufacturer'
View(data)
View(data)
runApp('Amazing_dashboard')
View(data)
View(data)
View(data)
View(data)
library(dplyr)
data <- mpg
tibble(
Variable = colnames(mpg),
Type = c("Nominal",
"Nominal",
"Continuous",
"Discrete",
"Discrete",
"Nominal",
"Nominal",
"Continuous",
"Continuous",
"Nominal",
"Nominal"),
Description = c("Manufacturer name",
"Model name",
"Engine displacement, in litres",
"Year of manufacture",
"Number of cylinders",
"Type of transmission",
"Type of drive train",
"City miles per gallon",
"Highway miles per gallon",
"Fuel type",
"Type of car")
)
library(dplyr)
data <- mpg
tibble(
Variable = colnames(data),
Type = c("Nominal",
"Nominal",
"Continuous",
"Discrete",
"Discrete",
"Nominal",
"Nominal",
"Continuous",
"Continuous",
"Nominal",
"Nominal"),
Description = c("Manufacturer name",
"Model name",
"Engine displacement, in litres",
"Year of manufacture",
"Number of cylinders",
"Type of transmission",
"Type of drive train",
"City miles per gallon",
"Highway miles per gallon",
"Fuel type",
"Type of car")
)
View(data)
runApp('Amazing_dashboard')
?kable_classic
runApp('Amazing_dashboard')
runApp('Amazing_dashboard')
runApp('Amazing_dashboard')
runApp('Amazing_dashboard')
runApp('Amazing_dashboard')
runApp('Amazing_dashboard')
?column()
runApp('Amazing_dashboard')
runApp('Amazing_dashboard')
runApp('Amazing_dashboard')
runApp('Amazing_dashboard')
runApp('Amazing_dashboard')
runApp()
runApp('Amazing_dashboard')
runApp()
runApp('Amazing_dashboard')
runApp()