tests/testthat/test_format_R.R

context("R dump imports/exports")
require("datasets")

test_that("Export to .R dump file", {
    expect_true(export(iris, "iris.R") %in% dir())
    expect_true(export(iris, "iris.dump") %in% dir())
})

test_that("Import from .R dump file", {
    expect_true(is.data.frame(import("iris.R")))
    expect_true(is.data.frame(import("iris.dump")))
})

unlink("iris.R")
unlink("iris.dump")

Try the rio package in your browser

Any scripts or data that you put into this service are public.

rio documentation built on Nov. 22, 2021, 9:07 a.m.