Skip to content

Commit

Permalink
Show list2env()
Browse files Browse the repository at this point in the history
  • Loading branch information
maurolepore committed Jan 7, 2019
1 parent fd26564 commit 6724f20
Show file tree
Hide file tree
Showing 12 changed files with 136 additions and 78 deletions.
17 changes: 16 additions & 1 deletion README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,22 @@ path_mixed %>%
list_any(~get(load(.)), regexp = "[.]csv$", invert = TRUE)
```

### Writing data
### From the list

#### Map each list element to an object in an environment

Add each element to an environment with `list2env()`

```{r}
rm(list = ls())
ls()
list2env(list_csv(), envir = .GlobalEnv)
ls()
```

#### Map each list element to a file in a directory

__tor__ does not write data but includes a helper to create the paths to output files.

Expand Down
39 changes: 29 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ devtools::install_github("maurolepore/tor")

``` r
library(tidyverse)
#> -- Attaching packages ------------------------------------------------------------ tidyverse 1.2.1 --
#> -- Attaching packages --------------------------------------------- tidyverse 1.2.1 --
#> v ggplot2 3.1.0 v purrr 0.2.5
#> v tibble 1.4.2 v dplyr 0.7.8
#> v tibble 2.0.0 v dplyr 0.7.8
#> v tidyr 0.8.2 v stringr 1.3.1
#> v readr 1.3.1 v forcats 0.3.0
#> -- Conflicts --------------------------------------------------------------- tidyverse_conflicts() --
#> -- Conflicts ------------------------------------------------ tidyverse_conflicts() --
#> x dplyr::filter() masks stats::filter()
#> x dplyr::lag() masks stats::lag()
library(fs)
Expand All @@ -45,12 +45,13 @@ working directory.

``` r
dir()
#> [1] "_pkgdown.yml" "cran-comments.md" "csv1.csv"
#> [4] "csv2.csv" "datasets" "DESCRIPTION"
#> [7] "docs" "inst" "LICENSE.md"
#> [10] "man" "NAMESPACE" "NEWS.md"
#> [13] "R" "README.md" "README.Rmd"
#> [16] "tests" "tmp.R" "tor.Rproj"
#> [1] "_pkgdown.yml" "cran-comments.md" "CRAN-RELEASE"
#> [4] "csv1.csv" "csv2.csv" "datasets"
#> [7] "DESCRIPTION" "docs" "inst"
#> [10] "LICENSE.md" "man" "NAMESPACE"
#> [13] "NEWS.md" "R" "README.md"
#> [16] "README.Rmd" "tests" "tmp.R"
#> [19] "tor.Rproj"

list_csv()
#> $csv1
Expand Down Expand Up @@ -292,7 +293,25 @@ path_mixed %>%
#> 2 b
```

### Writing data
### From the list

#### Map each list element to an object in an environment

Add each element to an environment with `list2env()`

``` r
rm(list = ls())
ls()
#> character(0)

list2env(list_csv(), envir = .GlobalEnv)
#> <environment: R_GlobalEnv>

ls()
#> [1] "csv1" "csv2"
```

#### Map each list element to a file in a directory

**tor** does not write data but includes a helper to create the paths to
output files.
Expand Down
2 changes: 1 addition & 1 deletion docs/LICENSE.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/authors.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

135 changes: 77 additions & 58 deletions docs/index.html

Large diffs are not rendered by default.

7 changes: 6 additions & 1 deletion docs/news/index.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/reference/format_path.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/reference/index.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/reference/list_any.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/reference/list_rds.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/reference/tor-package.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/reference/tor_example.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 6724f20

Please sign in to comment.