Skip to content

Commit

Permalink
issue #361: Solved
Browse files Browse the repository at this point in the history
Now convert2df works with the new dimensions csv format
  • Loading branch information
massimoaria committed Jun 16, 2023
1 parent 64d1941 commit 9fbb46a
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 4 deletions.
27 changes: 25 additions & 2 deletions R/dimensions2df.R
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,20 @@ dimensions2df <- function(file, format = "csv") {
}
}
names(DATA) = fields
ind <- which(names(DATA)=="Source title/Anthology title")
if (length(ind)==1){
names(DATA)[ind] <- "SO"
}
ind <- which(names(DATA)=="Authors Affiliations Name of Research organization" )
if (length(ind)==1){
names(DATA)[ind] <- "C1"
DATA$AU_UN <- DATA$C1
}
ind <- which(names(DATA)== "Authors Affiliations Country of Research organization")
if (length(ind)==1){
names(DATA)[ind] <- "AU_CO"
}


DATA <- postprocessingDim(DATA)

Expand All @@ -82,7 +96,7 @@ postprocessingDim <- function(DATA) {

## Converting original references in WOS format (AU, PY, SO, VOL, NUM, DOI)
if ("Cited references" %in% names(DATA)) {
aaa <- strsplit(DATA$Cited.references, ";\\[")
aaa <- strsplit(DATA$`Cited references`, ";\\[")
cr <- (unlist(lapply(aaa, function(l) {
l <- gsub("\\|", "!!!", l)
l <- strsplit(l, "!!!")
Expand Down Expand Up @@ -235,7 +249,16 @@ postprocessingDim <- function(DATA) {

DATA$DB <- "DIMENSIONS"

DATA <- metaTagExtraction(DATA, "AU_CO")
if (!"AU_CO" %in% names(DATA)) DATA <- metaTagExtraction(DATA, "AU_CO")

DATA$AU1_CO <- unlist(lapply(strsplit(DATA$AU_CO,";"), function(l){
if (length(l)>0){
l <- l[1]
} else {
l <- "NA"
}
return(l)
}))

DATA <- metaTagExtraction(DATA, "AU1_CO")
return(DATA)
Expand Down
4 changes: 2 additions & 2 deletions R/missingData.R
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ missingData <- function(M) {
# create a vector with the tags
tag <- unlist(
strsplit(
"AB,AU,C1,CR,DE,DI,DT,ID,LA,NR,PY,RP,SO,TC,TI,WC",","
"AB,AU,C1,CR,DE,DI,DT,ID,LA,PY,RP,SO,TC,TI,WC",","
)
)
# create a vector with the description of the tags
description <- trimws(unlist(
strsplit(
"Abstract, Author,Affiliation,Cited References,Keywords,DOI,Document Type,Keywords Plus,Language,Number of Cited References,
"Abstract, Author,Affiliation,Cited References,Keywords,DOI,Document Type,Keywords Plus,Language,
Publication Year,Corresponding Author, Journal, Total Citation, Title, Science Categories", ","
)
))
Expand Down

0 comments on commit 9fbb46a

Please sign in to comment.