Skip to content

Commit

Permalink
Move motivation out of readme into news.
Browse files Browse the repository at this point in the history
  • Loading branch information
maurolepore committed Jan 9, 2019
1 parent 690b1e6 commit e4fb70c
Show file tree
Hide file tree
Showing 13 changed files with 102 additions and 172 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
^vignettes/siteonly$
^cran-comments\.md$
^CRAN-RELEASE$
^docs$
Expand Down
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
5 changes: 4 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -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
20 changes: 19 additions & 1 deletion _pkgdown.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,25 @@
url: https://maurolepore.github.io/tor/

navbar:
structure:
left: [home, reference, news]
right: [github]
components:
news:
text: News
menu:
- text: "Release notes"
- text: "Version 1.0.0"
href: FIXME
- text: "------------------"
- text: "Change log"
href: news/index.html



reference:

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

4 changes: 2 additions & 2 deletions docs/index.html

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

6 changes: 3 additions & 3 deletions 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 man/tor-package.Rd

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

2 changes: 2 additions & 0 deletions vignettes/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.html
*.R
3 changes: 3 additions & 0 deletions vignettes/siteonly/csv1.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
x
1
2
3 changes: 3 additions & 0 deletions vignettes/siteonly/csv2.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
y
a
b
Loading

0 comments on commit e4fb70c

Please sign in to comment.