knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" ) library(smartread)
The goal of smartread is to provide a single function API for reading in data from common file types.
You can install the development version of {smartread} from Github with:
## install from github devtools::install_github("mkearney/smartread")
This is a basic example which shows you how to use read_smart()
## basic example dat exdat <- datasets::mtcars ## save as multiple different file types saveRDS(exdat, "exdat.rds") save(exdat, file = "exdat.rda") write.csv(exdat, "exdat.csv") ## now read and view the .rds file head(c1 <- read_smart("exdat.rds")) ## now read and view the .csv file head(c2 <- read_smart("exdat.csv")) ## now read and view the .rda file head(c3 <- read_smart("exdat.rda"))
## cleanup (delete) data files unlink(c("exdat.rds", "exdat.rda", "exdat.csv"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.