Skip to content

Commit 2409e32

Browse files
committed
Shorten doc. examples for CRAN
1 parent 8ee0e38 commit 2409e32

File tree

6 files changed

+140
-98
lines changed

6 files changed

+140
-98
lines changed

R/BibEntryExtractOp.R

Lines changed: 43 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -96,68 +96,64 @@ MatchName <- function(nom, pattern, match.author=.BibOptions$match.author,
9696
#' @family operators
9797
#' @rdname SearchBib
9898
#' @examples
99-
#' if (requireNamespace("bibtex")) {
100-
#' file.name <- system.file("Bib", "biblatexExamples.bib", package="RefManageR")
101-
#' bib <- suppressMessages(ReadBib(file.name))
99+
#' file.name <- system.file("Bib", "biblatexExamples.bib", package="RefManageR")
100+
#' bib <- suppressMessages(ReadBib(file.name))
102101
#'
103-
#' ## author search, default is to use family names only for matching
104-
#' bib[author = "aristotle"]
102+
#' ## author search, default is to use family names only for matching
103+
#' bib[author = "aristotle"]
105104
#'
106-
#' ## Aristotle references before 1925
107-
#' bib[author="aristotle", date = "/1925"]
105+
#' ## Aristotle references before 1925
106+
#' bib[author="aristotle", date = "/1925"]
108107
#'
109-
#' ## Aristotle references before 1925 *OR* references with editor Westfahl
110-
#' bib[list(author="aristotle", date = "/1925"),list(editor = "westfahl")]
108+
#' ## Aristotle references before 1925 *OR* references with editor Westfahl
109+
#' bib[list(author="aristotle", date = "/1925"),list(editor = "westfahl")]
111110
#'
112-
#' ## Change some searching and printing options and search for author
113-
#' old.opts <- BibOptions(bib.style = "authoryear", match.author = "exact",
114-
#' max.names = 99, first.inits = FALSE)
115-
#' bib[author="Mart\u00edn, Jacinto and S\u00e1nchez, Alberto"]
116-
#' BibOptions(old.opts) ## reset options
111+
#' ## Change some searching and printing options and search for author
112+
#' old.opts <- BibOptions(bib.style = "authoryear", match.author = "exact",
113+
#' max.names = 99, first.inits = FALSE)
114+
#' bib[author="Mart\u00edn, Jacinto and S\u00e1nchez, Alberto"]
115+
#' BibOptions(old.opts) ## reset options
117116
#'
118-
#' ## Some works of Raymond J. Carroll's
119-
#' file.name <- system.file("Bib", "RJC.bib", package="RefManageR")
120-
#' bib <- ReadBib(file.name)
121-
#' length(bib)
117+
#' \dontrun{
118+
#' ## Some works of Raymond J. Carroll's
119+
#' file.name <- system.file("Bib", "RJC.bib", package="RefManageR")
120+
#' bib <- ReadBib(file.name)
121+
#' length(bib)
122122
#'
123-
#' ## index by key
124-
#' bib[c("chen2013using", "carroll1978distributions")]
123+
#' ## index by key
124+
#' bib[c("chen2013using", "carroll1978distributions")]
125125
#'
126-
#' ## Papers with someone with family name Wang
127-
#' length(SearchBib(bib, author='Wang', .opts = list(match.author = "family")))
126+
#' ## Papers with someone with family name Wang
127+
#' length(SearchBib(bib, author='Wang', .opts = list(match.author = "family")))
128128
#'
129-
#' ## Papers with Wang, N.
130-
#' length(SearchBib(bib, author='Wang, N.', .opts = list(match.author = "family.with.initials")))
129+
#' ## Papers with Wang, N.
130+
#' length(SearchBib(bib, author='Wang, N.', .opts = list(match.author = "family.with.initials")))
131131
#'
132-
#' ## tech reports with Ruppert
133-
#' length(bib[author='ruppert',bibtype="report"])
132+
#' ## tech reports with Ruppert
133+
#' length(bib[author='ruppert',bibtype="report"])
134134
#'
135-
#' ##Carroll and Ruppert tech reports at UNC
136-
#' length(bib[author='ruppert',bibtype="report",institution="north carolina"])
135+
#' ##Carroll and Ruppert tech reports at UNC
136+
#' length(bib[author='ruppert',bibtype="report",institution="north carolina"])
137137
#'
138-
#' ## Carroll and Ruppert papers since leaving UNC
139-
#' length(SearchBib(bib, author='ruppert', date="1987-07/",
140-
#' .opts = list(match.date = "exact")))
141-
#' }
138+
#' ## Carroll and Ruppert papers since leaving UNC
139+
#' length(SearchBib(bib, author='ruppert', date="1987-07/",
140+
#' .opts = list(match.date = "exact")))
142141
#'
143-
#' ## Carroll and Ruppert papers NOT in the 1990's
144-
#' \dontrun{
145-
#' if (requireNamespace("bibtex")) {
146-
#' length(SearchBib(bib, author='ruppert', date = "!1990/1999"))
147-
#' identical(SearchBib(bib, author='ruppert', date = "!1990/1999"),
148-
#' SearchBib(bib, author='ruppert', year = "!1990/1999"))
149-
#' table(unlist(SearchBib(bib, author='ruppert', date="!1990/1999")$year))
142+
#' ## Carroll and Ruppert papers NOT in the 1990's
143+
#' length(SearchBib(bib, author='ruppert', date = "!1990/1999"))
144+
#' identical(SearchBib(bib, author='ruppert', date = "!1990/1999"),
145+
#' SearchBib(bib, author='ruppert', year = "!1990/1999"))
146+
#' table(unlist(SearchBib(bib, author='ruppert', date="!1990/1999")$year))
150147
#'
151-
#' ## Carroll + Ruppert + Simpson
152-
#' length(bib[author="Carroll, R. J. and Simpson, D. G. and Ruppert, D."])
148+
#' ## Carroll + Ruppert + Simpson
149+
#' length(bib[author="Carroll, R. J. and Simpson, D. G. and Ruppert, D."])
153150
#'
154-
#' ## Carroll + Ruppert OR Carroll + Simpson
155-
#' length(bib[author=c("Carroll, R. J. and Ruppert, D.", "Carroll, R. J. and Simpson, D. G.")])
151+
#' ## Carroll + Ruppert OR Carroll + Simpson
152+
#' length(bib[author=c("Carroll, R. J. and Ruppert, D.", "Carroll, R. J. and Simpson, D. G.")])
156153
#'
157-
#' ## Carroll + Ruppert tech reports at UNC "OR" Carroll and Ruppert JASA papers
158-
#' length(bib[list(author='ruppert',bibtype="report",institution="north carolina"),
159-
#' list(author="ruppert",journal="journal of the american statistical association")])
160-
#' }
154+
#' ## Carroll + Ruppert tech reports at UNC "OR" Carroll and Ruppert JASA papers
155+
#' length(bib[list(author='ruppert',bibtype="report",institution="north carolina"),
156+
#' list(author="ruppert",journal="journal of the american statistical association")])
161157
#' }
162158
`[.BibEntry` <- function(x, i, j, ..., drop = FALSE){
163159

R/BibEntryReplaceOp.R

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,21 @@
2020
#' @keywords methods manip
2121
#' @family operators
2222
#' @examples
23-
#' if (requireNamespace("bibtex")) {
23+
#' bib.text <- "@Manual{mclean2014,
24+
#' author = {Mathew William McLean},
25+
#' title = {Straightforward Bibliography Management in R Using the RefManager Package},
26+
#' note = {arXiv: 1403.2036 [cs.DL]},
27+
#' year = {2014},
28+
#' url = {https://arxiv.org/abs/1403.2036},
29+
#' }"
30+
#' tfile <- tempfile(fileext = ".bib")
31+
#' writeLines(bib.text, tfile)
32+
#' bib <- ReadBib(tfile)
33+
#' bib[1] <- list(c(date = "2014-03", key = "mwm2014"))
34+
#' bib
35+
#' unlink(tfile)
36+
#'
37+
#' \dontrun{
2438
#' file.name <- system.file("Bib", "RJC.bib", package="RefManageR")
2539
#' bib <- ReadBib(file.name)
2640
#' print(bib[seq_len(3L)], .opts = list(sorting = "none", bib.style = "alphabetic"))

R/ReadBib.R

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,18 @@
2424
#' @seealso \code{\link[bibtex]{read.bib}} in package \code{bibtex}
2525
#' @export
2626
#' @examples
27-
#' if (requireNamespace("bibtex")) {
27+
#' bib.text <- "@Manual{mclean2014,
28+
#' author = {Mathew William McLean},
29+
#' title = {Straightforward Bibliography Management in R Using the RefManager Package},
30+
#' note = {arXiv: 1403.2036 [cs.DL]},
31+
#' year = {2014},
32+
#' url = {https://arxiv.org/abs/1403.2036},
33+
#' }"
34+
#' tfile <- tempfile(fileext = ".bib")
35+
#' writeLines(bib.text, tfile)
36+
#' ReadBib(tfile)
37+
#' unlink(tfile)
38+
#' \dontrun{
2839
#' file.name <- system.file("Bib", "RJC.bib", package="RefManageR")
2940
#' bib <- ReadBib(file.name)
3041
#' }

man/ReadBib.Rd

Lines changed: 12 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/SearchBib.Rd

Lines changed: 43 additions & 47 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/subset-.BibEntry.Rd

Lines changed: 15 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)