https://github.com/bgreenwell/cprint
Print common R data structures in a format which can be used as input to the interpreter
https://github.com/bgreenwell/cprint
Last synced: about 2 months ago
JSON representation
Print common R data structures in a format which can be used as input to the interpreter
- Host: GitHub
- URL: https://github.com/bgreenwell/cprint
- Owner: bgreenwell
- Created: 2018-03-18T04:23:07.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2019-02-17T16:46:14.000Z (about 6 years ago)
- Last Synced: 2025-02-02T00:48:39.030Z (4 months ago)
- Language: R
- Size: 8.79 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.Rmd
Awesome Lists containing this project
README
---
output: github_document
---# cprint: Copy Print
[](https://travis-ci.org/bgreenwell/cprint)
[](https://codecov.io/github/bgreenwell/cprint?branch=master)This is a simple package to solve an issue I run into quite often: convert a simple data structure I am working with (i.e., a vector or data frame) into code that can be copy and pasted into an R script or the R interpreter that will reproduce the original object.
## Installation
Install from GitHub:
```{r installation, eval=FALSE}
if (!requireNamespace("devtools")) {
install.packages("devtools")
}
devtools::install_github("bgreenwell/cprint")
```## Basic usage
Output can be copied and pasted directly into an R script or the R interpreter:
```{r example}
library(cprint)cprint(iris[1:5, ])
cprint(iris$Petal.Width[1:5])
cprint(iris$Species[1:5])
```## TODO
* Preserve numeric precision
* Support matrices