https://github.com/mkearney/smartread
🔎📘 A smarter and simpler way to read data from common file types
https://github.com/mkearney/smartread
csv dta mkearney-r-package r read read-data rstats save xlsx
Last synced: 6 months ago
JSON representation
🔎📘 A smarter and simpler way to read data from common file types
- Host: GitHub
- URL: https://github.com/mkearney/smartread
- Owner: mkearney
- Created: 2018-04-23T23:28:00.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-08-30T17:13:31.000Z (over 7 years ago)
- Last Synced: 2025-03-04T23:43:30.541Z (about 1 year ago)
- Topics: csv, dta, mkearney-r-package, r, read, read-data, rstats, save, xlsx
- Language: R
- Size: 300 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.Rmd
Awesome Lists containing this project
README
---
output: github_document
---
```{r setup, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
library(smartread)
```
# smartread 
[](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"))
```