Skip to content

Commit

Permalink
add export() examples
Browse files Browse the repository at this point in the history
with #6 since all examples explicitly tested
  • Loading branch information
achubaty committed Apr 19, 2023
1 parent 68e2f56 commit 071b7b5
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 12 deletions.
17 changes: 11 additions & 6 deletions inst/examples/example_export.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
## Export raster and vectors of a grain to a specified directory
tmpdir <- tempdir()
export(grain(tinyPatchGOC, 2), dirname = "tiny_goc_thresh2", path = tmpdir)
unlink(file.path(tmpdir, "tiny_goc_thresh2"), recursive = TRUE)

## Export rasters and vectors of the MPG and place in an R object
## Export rasters and vectors and place in an R object
sp_tinyPatchGOC <- export(grain(tinyPatchGOC, 2), R = TRUE) # nolint
sp_tinyPatchMPG <- export(tinyPatchMPG, R = TRUE) # nolint

## Export raster and vectors to a specified directory
exportPath <- tempdir()
export(grain(tinyPatchGOC, 2), dirname = "tiny_goc_thresh2", path = exportPath)
export(tinyPatchMPG, dirname = "tiny_mpg", path = exportPath, vorBound = TRUE)

## clean up
unlink(file.path(exportPath, "tiny_goc_thresh2"), recursive = TRUE)
unlink(file.path(exportPath, "tiny_mpg"), recursive = TRUE)
17 changes: 11 additions & 6 deletions man/export.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 071b7b5

Please sign in to comment.