-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.Rmd
59 lines (42 loc) · 1.39 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r setup, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
library(smartread)
```
# smartread <img src="man/figures/logo.png" width="160px" align="right" />
[![lifecycle](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://www.tidyverse.org/lifecycle/#experimental)
The goal of smartread is to provide a single function API for reading in data from common file types.
## Installation
You can install the development version of **{smartread}** from [Github](https://github.com/mkearney/smartread) with:
```{r, eval=FALSE}
## install from github
devtools::install_github("mkearney/smartread")
```
## Example
This is a basic example which shows you how to use `read_smart()`
```{r example}
## 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"))
```
```{r, include=FALSE}
## cleanup (delete) data files
unlink(c("exdat.rds", "exdat.rda", "exdat.csv"))
```