https://github.com/py-b/listchr
List Columns to Character Conversion
https://github.com/py-b/listchr
data-manipulation list-column r
Last synced: over 1 year ago
JSON representation
List Columns to Character Conversion
- Host: GitHub
- URL: https://github.com/py-b/listchr
- Owner: py-b
- Created: 2017-12-30T12:05:53.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2020-07-24T12:55:12.000Z (almost 6 years ago)
- Last Synced: 2025-01-21T22:45:32.446Z (over 1 year ago)
- Topics: data-manipulation, list-column, r
- Language: R
- Size: 18.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.Rmd
Awesome Lists containing this project
README
---
output: github_document
---
```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "README-"
)
```
# listchr
The goal of *listchr* is to flatten list-columns of a data frame into strings,
in order to export it to a more simple format (csv, ...).
The reverse transformation (separated string to list) can also be done.
## Installation
You can install *listchr* from github with :
```{r gh-installation, eval = FALSE}
# install.packages("devtools")
devtools::install_github("py-b/listchr")
```
## Example
Convert all list-columns of a data frame into character vectors :
```{r example}
library(listchr)
df <- data.frame(x = 1:2)
df$y <- list(letters[1:3], 1:2)
df$z <- list(list(3:4, 5:7), "d")
str(df)
df2 <- listcol_to_chr(df)
str(df2)
```