Skip to content

Commit 339365b

Browse files
committed
* Solved the issue related to exclusion of the ggnetwork package from CRAN by removing the dependence from the package
1 parent bcaf40d commit 339365b

File tree

9 files changed

+384
-80
lines changed

9 files changed

+384
-80
lines changed

DESCRIPTION

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ Imports: stats,
2525
factoextra,
2626
FactoMineR,
2727
forcats,
28-
ggnetwork,
2928
ggplot2,
3029
ggrepel,
3130
igraph,

NAMESPACE

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ export(trimES)
4949
import(bibliometrixData)
5050
import(dimensionsR)
5151
import(forcats)
52-
import(ggnetwork)
5352
import(ggplot2)
5453
import(ggrepel)
5554
import(pubmedR)
@@ -181,16 +180,19 @@ importFrom(dplyr,as_tibble)
181180
importFrom(dplyr,between)
182181
importFrom(dplyr,cummean)
183182
importFrom(dplyr,desc)
183+
importFrom(dplyr,do)
184184
importFrom(dplyr,group_by)
185185
importFrom(dplyr,if_all)
186186
importFrom(dplyr,inner_join)
187187
importFrom(dplyr,left_join)
188188
importFrom(dplyr,mutate)
189+
importFrom(dplyr,n)
189190
importFrom(dplyr,relocate)
190191
importFrom(dplyr,rename)
191192
importFrom(dplyr,right_join)
192193
importFrom(dplyr,rowwise)
193194
importFrom(dplyr,select)
195+
importFrom(dplyr,slice)
194196
importFrom(dplyr,slice_head)
195197
importFrom(dplyr,slice_tail)
196198
importFrom(dplyr,summarise)
@@ -296,6 +298,7 @@ importFrom(tidyr,separate)
296298
importFrom(tidyr,spread)
297299
importFrom(tidyr,starts_with)
298300
importFrom(tidyr,unite)
301+
importFrom(tidyr,unnest)
299302
importFrom(utils,adist)
300303
importFrom(utils,capture.output)
301304
importFrom(utils,data)

NEWS

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
bibliometrix v3.1.4 (Release date: ????-??-??)
1+
bibliometrix v3.1.4 (Release date: 2021-07-05)
22

33
Changes:
44
* Added the possibily to calculate all vertex centrality measures setting the argument type="all"
5-
* Solved the issue with extracting cited sources from scopus collections (function metaTagExtraction)
5+
* Solved the issue with extracting cited sources from Scopus collections (function metaTagExtraction)
6+
* Solved the issue related to exclusion of the ggnetwork package from CRAN by removing the dependence from the package
7+
68

79
bibliometrix v3.1.3 (Release date: 2021-05-25)
810

R/couplingMap.R

Lines changed: 38 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -306,15 +306,43 @@ labeling <- function(M, df_lab, term, n, n.labels, analysis, ngrams){
306306
df <- left_join(df_lab,M, by=c("sources" = "SO" ))
307307
})
308308

309-
clusters <- unique(df$Cluster)
310-
w <- character(length(clusters))
311-
312-
313-
for (i in 1:length(clusters)){
314-
ind <- which(df$Cluster == clusters[i])
315-
tab <- round((tableTag(df[ind,], term)[1:n.labels])/length(ind)*100,1)
316-
w[i]=tolower(paste(names(tab)," ",as.numeric(tab),"%",sep="", collapse="\n"))
317-
}
318-
return(w)
309+
#clusters <- unique(df$Cluster)
310+
#w <- character(length(clusters))
311+
312+
tab_global <- tableTag(df, term)
313+
tab_global <- data.frame(label=names(tab_global),tot=as.numeric(tab_global), n=nrow(M),stringsAsFactors = FALSE)
314+
315+
df <- df %>%
316+
group_by(.data$Cluster) %>%
317+
do(w = best_lab(.data,tab_global, n.labels, term)) %>%
318+
unnest(.data$w) %>%
319+
as.data.frame()
320+
321+
# for (i in 1:length(clusters)){
322+
# ind <- which(df$Cluster == clusters[i])
323+
# tab <- round((tableTag(df[ind,], term)[1:n.labels])/length(ind),1)
324+
# tab <- data.frame(label=names(tab), value=as.numeric(tab),stringsAsFactors = FALSE)
325+
# tab <- tab %>%
326+
# left_join(tab_global, by = "label") %>%
327+
# mutate(freq = .data$value/.data$tot*100)
328+
#
329+
# w[i]=tolower(paste(tab$label," ",round(tab$freq,1),"%",sep="", collapse="\n"))
330+
# }
331+
return(df$w)
319332

320333
}
334+
335+
best_lab <- function(d, tab_global, n.labels, term){
336+
tab <- tableTag(d, term)
337+
tab <- data.frame(label=names(tab), value=as.numeric(tab), stringsAsFactors = FALSE)
338+
tab <- tab %>%
339+
left_join(tab_global, by = "label") %>%
340+
mutate(conf = round(.data$value/.data$tot*100,1),
341+
supp = round(.data$tot/n*100,1),
342+
relevance = round(.data$conf*.data$supp/100,1)) %>%
343+
arrange(desc(.data$relevance)) %>%
344+
slice(1:n.labels)
345+
346+
#tolower(paste(tab$label," Supp ",tab$supp,"% - Conf ", tab$conf,"%", sep="", collapse="\n"))
347+
tolower(paste(tab$label," - Conf ", tab$conf,"%", sep="", collapse="\n"))
348+
}

R/histPlot.R

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ histPlot<-function(histResults, n=20, size = 5, labelsize = 5, title_as_label =
109109
layout_m$y <- (diff(range(layout_m$x))/diff(range(layout_m$y)))*layout_m$y
110110

111111
################
112-
df_net <- ggnetwork::ggnetwork(bsk.network, layout=as.matrix(layout_m[c("x","y")]), niter=50000, arrow.gap=0)
112+
df_net <- dataFromIgraph(bsk.network, layout=as.matrix(layout_m[c("x","y")]), niter=50000, arrow.gap=0)
113113
df_net$color <- "slategray1"
114114
df_net <- left_join(df_net,layout_m[c("name","color")], by = "name")
115115
names(df_net)[10:11] <- c("color", "color_v")
@@ -133,22 +133,22 @@ histPlot<-function(histResults, n=20, size = 5, labelsize = 5, title_as_label =
133133
.data$GCS, sep=""))
134134

135135
g <- ggplot(df_net, aes(x = .data$x, y = .data$y, xend = .data$xend, yend = .data$yend, text=.data$text)) +
136-
geom_edges(color = "grey", size=0.4, alpha=0.4) +
137-
geom_nodes(aes(color = .data$color_v), size = size, alpha=0.5) +
136+
geom_network_edges(color = "grey", size=0.4, alpha=0.4) +
137+
geom_network_nodes(aes(color = .data$color_v), size = size, alpha=0.5) +
138138
geom_text(aes(label=.data$id, color=.data$color_v), size=labelsize,
139139
nudge_x = 0,
140140
nudge_y = 0.02,
141141
check_overlap = FALSE,alpha=0.7)+
142142
scale_x_continuous(labels=Ylabel,breaks=Breaks)+
143-
guides(size=FALSE, color=FALSE) +
143+
guides(size="none", color="none") +
144144
theme_minimal()+
145145
theme(legend.position='none', panel.background = element_rect(fill='white', color='white'),
146146
axis.line.y = element_blank(), axis.text.y = element_blank(),axis.ticks.y=element_blank(),
147147
axis.title.y = element_blank(), axis.title.x = element_blank(),
148148
panel.grid.minor.y = element_blank(), panel.grid.major.y = element_blank(),
149149
panel.grid.major.x = element_line(adjustcolor(col="grey", alpha.f = 0.2), linetype = 2, size = 0.5),
150150
panel.grid.minor.x = element_blank(),
151-
axis.text.x=element_text(face="bold", angle = 90, size=labelsize+3)) +
151+
axis.text.x=element_text(face="bold", angle = 90, size=labelsize+4)) +
152152
labs(title = "Historical Direct Citation Network")
153153

154154
### logo coordinates
@@ -226,3 +226,5 @@ delete.isolates <- function(graph, mode = 'all') {
226226
isolates <- which(degree(graph, mode = mode) == 0) - 1
227227
delete.vertices(graph, names(isolates))
228228
}
229+
230+

0 commit comments

Comments
 (0)