Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Announce #16

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
^\.buildignore$
^vignettes/siteonly$
^cran-comments\.md$
^CRAN-RELEASE$
^docs$
Expand Down
Binary file added .buildignore/tor_1.0.0.zip
Binary file not shown.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
inst/doc
.Rhistory
.RData
.Rproj.user
Expand Down
7 changes: 5 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Package: tor
Title: Read Multiple Files With Of Any Format From a Directory
Title: Read Multiple Files Of Any Format From a Directory
Into a List
Version: 1.0.0.9000
Authors@R:
Expand All @@ -22,9 +22,12 @@ Imports:
Suggests:
covr,
spelling,
testthat
testthat,
knitr,
rmarkdown
Encoding: UTF-8
Language: en-US
LazyData: true
Roxygen: list(markdown = TRUE)
RoxygenNote: 6.1.1
VignetteBuilder: knitr
23 changes: 0 additions & 23 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -31,29 +31,6 @@ The goal of __tor__ (_to-R_) is to make importing data into R ridiculously easy.
devtools::install_github("maurolepore/tor")
```

## Motivation

Your nickname is R-guru. Your colleague enjoys analyzing data and she head that R is great.

> I have a couple of minutes before the next meeting. Can you please show me how to start playing with some data in R?

TWO MINUTES?!

Don't panic. __tor__ is here to help you.

```{r}
# Here I have a bunch of files, including some .csv files with data.
dir()

# I "open" the programs I need to read the .csv files.
library(tor)

# And I list the data in all those .csv files
list_csv()

# Done.
```

## Example

```{r}
Expand Down
153 changes: 12 additions & 141 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,81 +29,6 @@ well with the [tidyverse](https://www.tidyverse.org/).
devtools::install_github("maurolepore/tor")
```

## Motivation

Your nickname is R-guru. Your colleague enjoys analyzing data and she
head that R is great.

> I have a couple of minutes before the next meeting. Can you please
> show me how to start playing with some data in R?

TWO MINUTES?\!

Don’t panic. **tor** is here to help you.

``` r
# Here I have a bunch of files, including some .csv files with data.
dir()
#> [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" "this-csv1.csv"
#> [19] "this-csv2.csv" "tmp.R" "tor.Rproj"

# I "open" the programs I need to read the .csv files.
library(tor)

# And I list the data in all those .csv files
list_csv()
#> Parsed with column specification:
#> cols(
#> x = col_double()
#> )
#> Parsed with column specification:
#> cols(
#> y = col_character()
#> )
#> Parsed with column specification:
#> cols(
#> x = col_double()
#> )
#> Parsed with column specification:
#> cols(
#> y = col_character()
#> )
#> $csv1
#> # A tibble: 2 x 1
#> x
#> <dbl>
#> 1 1
#> 2 2
#>
#> $csv2
#> # A tibble: 2 x 1
#> y
#> <chr>
#> 1 a
#> 2 b
#>
#> $`this-csv1`
#> # A tibble: 2 x 1
#> x
#> <dbl>
#> 1 1
#> 2 2
#>
#> $`this-csv2`
#> # A tibble: 2 x 1
#> y
#> <chr>
#> 1 a
#> 2 b

# Done.
```

## Example

``` r
Expand All @@ -122,8 +47,8 @@ dir()
#> [7] "DESCRIPTION" "docs" "inst"
#> [10] "LICENSE.md" "man" "NAMESPACE"
#> [13] "NEWS.md" "R" "README.md"
#> [16] "README.Rmd" "tests" "this-csv1.csv"
#> [19] "this-csv2.csv" "tmp.R" "tor.Rproj"
#> [16] "README.Rmd" "tests" "tmp.R"
#> [19] "tor.Rproj" "vignettes"

list_csv()
#> Parsed with column specification:
Expand All @@ -134,14 +59,6 @@ list_csv()
#> cols(
#> y = col_character()
#> )
#> Parsed with column specification:
#> cols(
#> x = col_double()
#> )
#> Parsed with column specification:
#> cols(
#> y = col_character()
#> )
#> $csv1
#> # A tibble: 2 x 1
#> x
Expand All @@ -154,20 +71,6 @@ list_csv()
#> y
#> <chr>
#> 1 a
#> 2 b
#>
#> $`this-csv1`
#> # A tibble: 2 x 1
#> x
#> <dbl>
#> 1 1
#> 2 2
#>
#> $`this-csv2`
#> # A tibble: 2 x 1
#> y
#> <chr>
#> 1 a
#> 2 b
```

Expand Down Expand Up @@ -417,8 +320,8 @@ dir()
#> [7] "DESCRIPTION" "docs" "inst"
#> [10] "LICENSE.md" "man" "NAMESPACE"
#> [13] "NEWS.md" "R" "README.md"
#> [16] "README.Rmd" "tests" "this-csv1.csv"
#> [19] "this-csv2.csv" "tmp.R" "tor.Rproj"
#> [16] "README.Rmd" "tests" "tmp.R"
#> [19] "tor.Rproj" "vignettes"

load_csv()

Expand Down Expand Up @@ -469,7 +372,7 @@ output files.

``` r
dir(pattern = "[.]csv$")
#> [1] "csv1.csv" "csv2.csv" "this-csv1.csv" "this-csv2.csv"
#> [1] "csv1.csv" "csv2.csv"

dfms <- list_csv()
#> Parsed with column specification:
Expand All @@ -480,21 +383,12 @@ dfms <- list_csv()
#> cols(
#> y = col_character()
#> )
#> Parsed with column specification:
#> cols(
#> x = col_double()
#> )
#> Parsed with column specification:
#> cols(
#> y = col_character()
#> )

format_path(names(dfms), "csv")
#> [1] "./csv1.csv" "./csv2.csv" "./this-csv1.csv" "./this-csv2.csv"
#> [1] "./csv1.csv" "./csv2.csv"

format_path(names(dfms), "csv", base = "home", prefix = "this-")
#> [1] "home/this-csv1.csv" "home/this-csv2.csv"
#> [3] "home/this-this-csv1.csv" "home/this-this-csv2.csv"
#> [1] "home/this-csv1.csv" "home/this-csv2.csv"
```

Combine it with [**purrr**](https://purrr.tidyverse.org/).
Expand All @@ -509,13 +403,13 @@ library(purrr)
library(fs)

imap_chr(dfms, ~ format_path(.y, "csv"))
#> csv1 csv2 this-csv1 this-csv2
#> "./csv1.csv" "./csv2.csv" "./this-csv1.csv" "./this-csv2.csv"
#> csv1 csv2
#> "./csv1.csv" "./csv2.csv"

# Same
map_chr(dfms, ~ format_path(names(.), "csv", ".", "this-"))
#> csv1 csv2 this-csv1 this-csv2
#> "./this-x.csv" "./this-y.csv" "./this-x.csv" "./this-y.csv"
#> csv1 csv2
#> "./this-x.csv" "./this-y.csv"

(dfs <- list_csv())
#> Parsed with column specification:
Expand All @@ -526,14 +420,6 @@ map_chr(dfms, ~ format_path(names(.), "csv", ".", "this-"))
#> cols(
#> y = col_character()
#> )
#> Parsed with column specification:
#> cols(
#> x = col_double()
#> )
#> Parsed with column specification:
#> cols(
#> y = col_character()
#> )
#> $csv1
#> # A tibble: 2 x 1
#> x
Expand All @@ -546,20 +432,6 @@ map_chr(dfms, ~ format_path(names(.), "csv", ".", "this-"))
#> y
#> <chr>
#> 1 a
#> 2 b
#>
#> $`this-csv1`
#> # A tibble: 2 x 1
#> x
#> <dbl>
#> 1 1
#> 2 2
#>
#> $`this-csv2`
#> # A tibble: 2 x 1
#> y
#> <chr>
#> 1 a
#> 2 b

paths <- dfs %>%
Expand All @@ -568,8 +440,7 @@ paths <- dfs %>%
walk2(dfs, paths, readr::write_csv)

dir_ls(".", regexp = "this-")
#> this-csv1.csv this-csv2.csv this-this-csv1.csv
#> this-this-csv2.csv
#> this-csv1.csv this-csv2.csv
```

# Related projects
Expand Down
28 changes: 26 additions & 2 deletions _pkgdown.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,31 @@
reference:
url: https://maurolepore.github.io/tor/

authors:
Mauro Lepore:
href: https://forestgeo.si.edu/mauro-lepore

toc:
depth: 3

navbar:
type: default
left:
- text: "Reference"
href: reference/index.html
- text: News
menu:
- text: "Release notes"
- text: "Version 1.0.0"
href: articles/siteonly/tor-1-0-0.html
- text: "------------------"
- text: "Change log"
href: news/index.html
right:
- icon: fa-github
href: https://github.com/maurolepore

reference:
- title: All functions
contents:
- has_concept("general functions to import data")
- has_concept("helpers")

30 changes: 19 additions & 11 deletions docs/LICENSE.html

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

Loading