Skip to content

Commit 4e3eae9

Browse files
committed
avoid examples writing to non-tempfiles
1 parent 320024f commit 4e3eae9

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

R/nexml_write.R

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
#' @examples
2121
#' ## Write an ape tree to nexml, analgous to write.nexus:
2222
#' library(ape); data(bird.orders)
23-
#' write.nexml(bird.orders, file="example.xml")
23+
#' ex <- tempfile(fileext=".xml")
24+
#' write.nexml(bird.orders, file=ex)
2425
#'
2526
#' \dontrun{ # takes > 5s
2627
#' ## Assemble a nexml section by section and then write to file:
@@ -31,14 +32,14 @@
3132
#' nexml <- add_basic_meta(title="my title", creator = "Carl Boettiger", nexml = nexml)
3233
#' nexml <- add_meta(meta("prism:modificationDate", format(Sys.Date())), nexml = nexml)
3334
#'
34-
#' write.nexml(nexml, file="example.xml")
35+
#' write.nexml(nexml, file=ex)
3536
#'
3637
#' ## As above, but in one call (except for add_meta() call).
3738
#' write.nexml(trees = geospiza$phy,
3839
#' characters = geospiza$dat,
3940
#' title = "My title",
4041
#' creator = "Carl Boettiger",
41-
#' file = "example.xml")
42+
#' file = ex)
4243
#'
4344
#' ## Mix and match: identical to the section by section:
4445
#' nexml <- add_meta(meta("prism:modificationDate", format(Sys.Date())))
@@ -47,7 +48,7 @@
4748
#' characters = geospiza$dat,
4849
#' title = "My title",
4950
#' creator = "Carl Boettiger",
50-
#' file = "example.xml")
51+
#' file = ex)
5152
#'
5253
#' }
5354
nexml_write <- function(x = nexml(),

cran-comments.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Dear CRAN maintainers,
33
This update addresses several minor issues and feature requests, as detailed in NEWS.md.
44
This package shows two notes, one indicating that I am the maintainer, the other noting that this package
55
has one suggested dependency on a non-mainstream repository, which is used
6-
to illustrate an additional feature in one of vignettes, when available.
6+
to illustrate an additional feature in one of vignettes, when available. (This is not a new suggested dependency, it is already listed in the current CRAN version as well.)
77

88
Cheers,
99

man/nexml_write.Rd

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

0 commit comments

Comments
 (0)