-
Notifications
You must be signed in to change notification settings - Fork 1
/
count_suit_of_freq_foreach_bccommunity.R
69 lines (69 loc) · 3.63 KB
/
count_suit_of_freq_foreach_bccommunity.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
#------------------------------------------------------------------------------
# list of community with df of most Cited references
#------------------------------------------------------------------------------
count_suit_of_freq_foreach_bccommunity <- function(WOS_table) {
library(plyr)
community_quantity <- max(WOS_table$record_community,na.rm =T)
X_per_X_community <- list("AU" = as.list(1:(community_quantity+1)),
"CR" = as.list(1:(community_quantity+1)),
"SO" = as.list(1:(community_quantity+1)),
"JI" = as.list(1:(community_quantity+1)),
"PY" = as.list(1:(community_quantity+1)),
"WC" = as.list(1:(community_quantity+1)),
"SC" = as.list(1:(community_quantity+1)))
for(j in names(X_per_X_community)){
for (i in 1:community_quantity) {
sub_WOS_table <- subset(WOS_table, record_community == i)
column_picker <- names(sub_WOS_table) == j
keyword_current_bccom <- tolower(unlist(strsplit(unlist(as.vector(as.character(sub_WOS_table[,which(column_picker)]))), "[;][ ]")))
keyword_current_bccom <- as.factor(keyword_current_bccom)
freq_table_keyword <- count(keyword_current_bccom)
ordering_command <- with(freq_table_keyword, order(-freq))
freq_table <- freq_table_keyword[ordering_command, ]
list_picker <- names(X_per_X_community) == j
if (j == "AU") {
names(freq_table) <- c("Most Prolific Author", "Frequency")
} else if (j == "CR"){
names(freq_table) <- c("Most Cited Article", "Frequency")
} else if (j == "SO"){
names(freq_table) <- c("Most Published in", "Frequency")
} else if (j == "JI"){
names(freq_table) <- c("Most Published in", "Frequency")
} else if (j == "PY"){
names(freq_table) <- c("Year Published", "Frequency")
} else if (j == "WC"){
names(freq_table) <- c("Most said Category", "Frequency")
} else if (j == "SC"){
names(freq_table) <- c("Reasearch Area", "Frequency")
}
X_per_X_community[[which(list_picker)]][[i]] <- freq_table
}
sub_WOS_table <- WOS_table
column_picker <- names(sub_WOS_table) == j
keyword_current_bccom <- tolower(unlist(strsplit(unlist(as.vector(as.character(sub_WOS_table[,which(column_picker)]))), "[;][ ]")))
keyword_current_bccom <- as.factor(keyword_current_bccom)
freq_table_keyword <- count(keyword_current_bccom)
ordering_command <- with(freq_table_keyword, order(-freq))
freq_table <- freq_table_keyword[ordering_command, ]
list_picker <- names(X_per_X_community) == j
if (j == "AU") {
names(freq_table) <- c("Most Prolific Author", "Frequency")
} else if (j == "CR"){
names(freq_table) <- c("Most Cited Article", "Frequency")
} else if (j == "SO"){
names(freq_table) <- c("Most Published in", "Frequency")
} else if (j == "JI"){
names(freq_table) <- c("Most Published in", "Frequency")
} else if (j == "PY"){
names(freq_table) <- c("Year Published", "Frequency")
} else if (j == "WC"){
names(freq_table) <- c("Most said Category", "Frequency")
} else if (j == "SC"){
names(freq_table) <- c("Reasearch Area", "Frequency")
}
X_per_X_community[[which(list_picker)]][[(community_quantity+1)]] <- freq_table
}
return(X_per_X_community)
}
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------