-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathColandrScopusParser.R
More file actions
56 lines (45 loc) · 2.46 KB
/
ColandrScopusParser.R
File metadata and controls
56 lines (45 loc) · 2.46 KB
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
#############################################################################
# This script reads a CSV file exported by Colandr (https://www.colandrcommunity.com/)
# and outputs an ASCII text file with search strings using that can be pasted into the
# Scopus “Advanced” search interface.
# The script first extracts citations that are flagged as "citation_screening_status" = "included".
# Next, the titles of all included citations are extracted and formatted as a Scopus
# search string. Due to a constraint in Scopus that limits the length of a search string
# the script subsets the full search string into sets with a user-defined number of titles.
# For example, if you had 95 citations and wanted ten titles in a single search string you
# would set “numPapers” to ten. The output ASCII text file would have nine search strings
# with 10 titles and a tenth with five titles.
#
# Set the variables below in the "SET VARIABLES HERE" section of the script.
#
# This script was written by Ned Horning [horning@amnh.org]
# Support for writing and maintaining this script comes from the CANA Foundation
# (https://canafoundation.org/)
#
# This script is free software; you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software Foundation
# either version 2 of the License, or (at your option ) any later version.
#
############################# SET VARIABLES HERE ###################################
# Path and file name for the CSV file exported from Colandr
fileName <- "/media/ned/Data1/AMNH/Horses/Protocol/GrasslandsPast.csv"
# Output path and filename for the ASCII text file containing Scopus search strings
outFileName <- "/media/ned/Data1/AMNH/Horses/Protocol/ScopusSearchString.txt"
# Number of papers to include in a single search string
numPapers <- 10
#######################################################################################
df <- read.csv(fileName, as.is=TRUE)
# Select only included papers
df <- df[which(df[,"citation_screening_status"]=="included"),]
outLine <- paste("TITLE(\"", df[1,"citation_title"], "\"", sep="")
for (i in 2:nrow(df)) {
if ((i %% numPapers) == 0) {
outLine <- paste(outLine, ")", "\n\n", "TITLE(\"", df[i,"citation_title"], "\"", sep="")
} else {
outLine <- paste(outLine, " OR ", "\"", df[i,"citation_title"], "\"", sep="")
}
}
outLine <- paste(outLine, ")", sep="")
fileConn<-file(outFileName)
writeLines(outLine, fileConn)
close(fileConn)