-
Notifications
You must be signed in to change notification settings - Fork 10
/
detect_.Rd
64 lines (56 loc) · 2.02 KB
/
detect_.Rd
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
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/detect_.R, R/detect_functions.R
\name{detect_}
\alias{detect_}
\alias{detect_parser}
\alias{detect_delimiter}
\alias{detect_lookup}
\alias{detect_year}
\title{Detect file formatting information}
\usage{
detect_parser(x)
detect_delimiter(x)
detect_lookup(tags)
detect_year(df)
}
\arguments{
\item{x}{A character vector containing bibliographic data}
\item{tags}{A character vector containing RIS tags.}
\item{df}{a data.frame containing bibliographic data}
}
\value{
\code{detect_parser} and \code{detect_delimiter} return a length-1 character; \code{detect_year} returns a character vector listing estimated publication years; and \code{detect_lookup} returns a \code{data.frame}.
}
\description{
Bibliographic data can be stored in a number of different file types, meaning that detecting consistent attributes of those files is necessary if they are to be parsed accurately. These functions attempt to identify some of those key file attributes. Specifically, \code{detect_parser} determines which \code{\link{parse_}} function to use; \code{detect_delimiter} and \code{detect_lookup} identify different attributes of RIS files; and \code{detect_year} attempts to fill gaps in publication years from other information stored in a \code{data.frame}.
}
\examples{
revtools <- c(
"",
"PMID- 31355546",
"VI - 10",
"IP - 4",
"DP - 2019 Dec",
"TI - revtools: An R package to support article
screening for evidence synthesis.",
"PG - 606-614",
"LID - 10.1002/jrsm.1374 [doi]",
"AU - Westgate MJ",
"LA - eng",
"PT - Journal Article",
"JT - Research Synthesis Methods",
""
)
# detect basic attributes of ris files
detect_parser(revtools)
detect_delimiter(revtools)
# determine which tag format to use
tags <- trimws(unlist(lapply(
strsplit(revtools, "- "),
function(a){a[1]}
)))
pubmed_tag_list <- detect_lookup(tags[!is.na(tags)])
# find year data in other columns
df <- as.data.frame(parse_pubmed(revtools))
df$year <- detect_year(df)
}