Skip to content

Commit

Permalink
Style
Browse files Browse the repository at this point in the history
  • Loading branch information
maurolepore committed Jan 8, 2019
1 parent b4d9522 commit 26d8cfe
Show file tree
Hide file tree
Showing 12 changed files with 164 additions and 210 deletions.
6 changes: 3 additions & 3 deletions R/format_path.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
#'
#' @examples
#' format_path(c("file1", "file2"), "csv")
#'
#'
#' (dfs <- list_csv(tor_example("csv")))
#'
#'
#' format_path(names(dfs), "csv")
#'
#'
#' format_path(names(dfs), "csv", base = "home", prefix = "this-")
#' @family helpers
#' @export
Expand Down
12 changes: 6 additions & 6 deletions R/list_any.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,23 @@
#'
#' @examples
#' tor_example()
#'
#'
#' path <- tor_example("csv")
#' dir(path)
#'
#'
#' list_any(path, read.csv)
#'
#'
#' list_any(path, ~ read.csv(.x, stringsAsFactors = FALSE))
#'
#'
#' (path_mixed <- tor_example("mixed"))
#' dir(path_mixed)
#'
#'
#' list_any(
#' path_mixed, ~ get(load(.x)),
#' regexp = "[.]csv$",
#' invert = TRUE
#' )
#'
#'
#' list_any(
#' path_mixed, ~ get(load(.x)),
#' "[.]Rdata$",
Expand Down
14 changes: 7 additions & 7 deletions R/list_csv.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,21 @@
#' @examples
#' (rds <- tor_example("rds"))
#' dir(rds)
#'
#'
#' list_rds(rds)
#'
#'
#' (tsv <- tor_example("tsv"))
#' dir(tsv)
#'
#'
#' list_tsv(tsv)
#'
#'
#' (mixed <- tor_example("mixed"))
#' dir(mixed)
#'
#'
#' list_rdata(mixed)
#'
#'
#' list_csv(mixed)
#'
#'
#' list_rdata(mixed, regexp = "[.]RData", ignore.case = FALSE)
#' @family general functions to import data
#' @export
Expand Down
6 changes: 3 additions & 3 deletions R/load_csv.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
#' @examples
#' (path_csv <- tor_example("csv"))
#' dir(path_csv)
#'
#'
#' load_csv(path_csv)
#' # Each dataframe is now available in the global environment
#' csv1
#' csv2
#'
#'
#' (path_mixed <- tor_example("mixed"))
#' dir(path_mixed)
#'
#'
#' load_rdata(path_mixed)
#' # Each dataframe is now available in the global environment
#' lower_rdata
Expand Down
4 changes: 2 additions & 2 deletions R/tor_example.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
#'
#' @examples
#' tor_example()
#'
#'
#' tor_example("csv")
#'
#'
#' dir(tor_example("csv"))
#' @family helpers
#' @export
Expand Down
32 changes: 28 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,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 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 @@ -61,10 +61,18 @@ dir()
#> [19] "tor.Rproj"

list_csv()
#> Parsed with column specification:
#> cols(
#> x = col_double()
#> )
#> Parsed with column specification:
#> cols(
#> y = col_character()
#> )
#> $csv1
#> # A tibble: 2 x 1
#> x
#> <int>
#> <dbl>
#> 1 1
#> 2 2
#>
Expand Down Expand Up @@ -375,6 +383,14 @@ dir(pattern = "[.]csv$")
#> [1] "csv1.csv" "csv2.csv"

dfms <- list_csv()
#> 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"
Expand All @@ -396,10 +412,18 @@ map_chr(dfms, ~ format_path(names(.), "csv", ".", "this-"))
#> "./this-x.csv" "./this-y.csv"

(dfs <- list_csv())
#> Parsed with column specification:
#> cols(
#> x = col_double()
#> )
#> Parsed with column specification:
#> cols(
#> y = col_character()
#> )
#> $csv1
#> # A tibble: 2 x 1
#> x
#> <int>
#> <dbl>
#> 1 1
#> 2 2
#>
Expand Down
108 changes: 66 additions & 42 deletions docs/index.html

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions docs/news/index.html

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

12 changes: 9 additions & 3 deletions docs/reference/format_path.html

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

82 changes: 18 additions & 64 deletions docs/reference/list_csv.html

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

Loading

0 comments on commit 26d8cfe

Please sign in to comment.