Skip to content

Commit

Permalink
Mention spreadsheet munging strategies in README
Browse files Browse the repository at this point in the history
  • Loading branch information
nacnudus committed Apr 22, 2018
1 parent a23916f commit 02653bc
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 55 deletions.
10 changes: 10 additions & 0 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,16 @@ The previous version can be installed as follows.
devtools::install_version("tidyxl", version = "0.2.3", repos = "http://cran.us.r-project.org")
```

## Getting started

[Spreadsheet Munging
Strategies](https://nacnudus.github.io/spreadsheet-munging-strategies)
is a free, online cookbook using
[tidyxl](https://github.com/nacnudus/tidyxl) and
[unpivotr](https://github.com/nacnudus/unpivotr) (in progress).

Otherwise see examples below.

## Installation

```{r, echo = TRUE, eval = FALSE}
Expand Down
122 changes: 67 additions & 55 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,16 @@ follows.
devtools::install_version("tidyxl", version = "0.2.3", repos = "http://cran.us.r-project.org")
```

## Getting started

[Spreadsheet Munging
Strategies](https://nacnudus.github.io/spreadsheet-munging-strategies)
is a free, online cookbook using
[tidyxl](https://github.com/nacnudus/tidyxl) and
[unpivotr](https://github.com/nacnudus/unpivotr) (in progress).

Otherwise see examples below.

## Installation

``` r
Expand Down Expand Up @@ -108,7 +118,7 @@ dplyr::glimpse(x)
#> $ numeric <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA...
#> $ date <dttm> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N...
#> $ character <chr> "Age", "Child", NA, "Adult", NA, "Survived...
#> $ character_formatted <list> [<# A tibble: 1 x 14, chara… bold ital...
#> $ character_formatted <list> [<# A tibble: 1 x 14, character bold i...
#> $ formula <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA...
#> $ is_array <lgl> FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, ...
#> $ formula_ref <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA...
Expand Down Expand Up @@ -142,12 +152,12 @@ x[x$row == 4, c("address", "character", "numeric")]
#> # A tibble: 6 x 3
#> address character numeric
#> <chr> <chr> <dbl>
#> 1 A4 1st NA
#> 2 B4 Male NA
#> 3 D4 <NA> 0
#> 4 E4 <NA> 5.00
#> 5 F4 <NA> 118
#> 6 G4 <NA> 57.0
#> 1 A4 1st NA
#> 2 B4 Male NA
#> 3 D4 <NA> 0.
#> 4 E4 <NA> 5.
#> 5 F4 <NA> 118.
#> 6 G4 <NA> 57.
```

Specific sheets can be requested using `xlsx_cells(file, sheet)`, and
Expand Down Expand Up @@ -196,8 +206,8 @@ x[x$local_format_id %in%
#> # A tibble: 2 x 2
#> address numeric
#> <chr> <dbl>
#> 1 F11 3.00
#> 2 G11 20.0
#> 1 F11 3.
#> 2 G11 20.

# Styles by name
formats$style$font$name["Normal"]
Expand All @@ -220,25 +230,26 @@ examples <- system.file("/extdata/examples.xlsx", package = "tidyxl")
xlsx_cells(examples)$character_formatted[77]
#> [[1]]
#> # A tibble: 16 x 14
#> charact… bold italic under… stri… vert… size colo… colo… colo… color…
#> <chr> <lgl> <lgl> <chr> <lgl> <chr> <dbl> <chr> <int> <int> <dbl>
#> 1 in-cell F F <NA> F <NA> 0 <NA> NA NA NA
#> 2 bold T F <NA> F <NA> 0 FF00… 2 NA NA
#> 3 italic F T <NA> F <NA> 0 FF00… 2 NA NA
#> 4 underli… F F single F <NA> 0 FF00… 2 NA NA
#> 5 underli… F F double F <NA> 0 FF00… 2 NA NA
#> 6 singlea… F F singl… F <NA> 0 FF00… 2 NA NA
#> 7 doublea… F F doubl… F <NA> 0 FF00… 2 NA NA
#> 8 striket… F F <NA> T <NA> 0 FF00… 2 NA NA
#> 9 subscri… F F <NA> F subs… 0 FF00… 2 NA NA
#> 10 supersc… F F <NA> F supe… 0 FF00… 2 NA NA
#> 11 red F F <NA> F <NA> 0 FFFF… NA NA NA
#> 12 theme F F <NA> F <NA> 0 FFC0… 6 NA NA
#> 13 tint F F <NA> F <NA> 0 FFC0… 6 NA 0.800
#> 14 size F F <NA> F <NA> 0 FFFF… NA NA NA
#> 15 arial F F <NA> F <NA> 0 FFFF… NA NA NA
#> 16 "UTF8St… F F <NA> F <NA> 0 FFFF… NA NA NA
#> # ... with 3 more variables: font <chr>, family <int>, scheme <chr>
#> character bold italic underline strike vertAlign size color_rgb
#> <chr> <lgl> <lgl> <chr> <lgl> <chr> <dbl> <chr>
#> 1 in-cell FALSE FALSE <NA> FALSE <NA> 0. <NA>
#> 2 bold TRUE FALSE <NA> FALSE <NA> 0. FF000000
#> 3 italic FALSE TRUE <NA> FALSE <NA> 0. FF000000
#> 4 underline FALSE FALSE single FALSE <NA> 0. FF000000
#> 5 underlinedoub… FALSE FALSE double FALSE <NA> 0. FF000000
#> 6 singleaccount… FALSE FALSE singleAcc… FALSE <NA> 0. FF000000
#> 7 doubleaccount… FALSE FALSE doubleAcc… FALSE <NA> 0. FF000000
#> 8 strikethrough FALSE FALSE <NA> TRUE <NA> 0. FF000000
#> 9 subscript FALSE FALSE <NA> FALSE subscript 0. FF000000
#> 10 superscript FALSE FALSE <NA> FALSE superscr… 0. FF000000
#> 11 red FALSE FALSE <NA> FALSE <NA> 0. FFFF0000
#> 12 theme FALSE FALSE <NA> FALSE <NA> 0. FFC0504D
#> 13 tint FALSE FALSE <NA> FALSE <NA> 0. FFC0504D
#> 14 size FALSE FALSE <NA> FALSE <NA> 0. FFFF0000
#> 15 arial FALSE FALSE <NA> FALSE <NA> 0. FFFF0000
#> 16 "UTF8Stéphane… FALSE FALSE <NA> FALSE <NA> 0. FFFF0000
#> # ... with 6 more variables: color_theme <int>, color_indexed <int>,
#> # color_tint <dbl>, font <chr>, family <int>, scheme <chr>
```

To see all the available kinds of formats, use `str(formats)`.
Expand Down Expand Up @@ -268,16 +279,16 @@ y[!is.na(y$formula),
#> # A tibble: 32 x 10
#> address formula is_array formula_ref formula_group error logical numeric date character
#> <chr> <chr> <lgl> <chr> <int> <chr> <lgl> <dbl> <dttm> <chr>
#> 1 A1 1/0 F <NA> NA #DIV/0! NA NA NA <NA>
#> 2 A14 1=1 F <NA> NA <NA> T NA NA <NA>
#> 3 A15 A4+1 F <NA> NA <NA> NA 1338 NA <NA>
#> 4 A16 DATE(2017,1,18) F <NA> NA <NA> NA NA 2017-01-18 00:00:00 <NA>
#> 5 A17 "\"Hello, World!\"" F <NA> NA <NA> NA NA NA Hello, W…
#> 6 A19 $A$18+1 F <NA> NA <NA> NA 2.00 NA <NA>
#> 7 B19 A18+2 F <NA> NA <NA> NA 3.00 NA <NA>
#> 8 A20 $A$18+1 F A20:A21 0 <NA> NA 2.00 NA <NA>
#> 9 B20 A19+2 F B20:B21 1 <NA> NA 4.00 NA <NA>
#> 10 A21 $A$18+1 F <NA> 0 <NA> NA 2.00 NA <NA>
#> 1 A1 1/0 FALSE <NA> NA #DIV/0! NA NA NA <NA>
#> 2 A14 1=1 FALSE <NA> NA <NA> TRUE NA NA <NA>
#> 3 A15 A4+1 FALSE <NA> NA <NA> NA 1338. NA <NA>
#> 4 A16 DATE(2017,1,18) FALSE <NA> NA <NA> NA NA 2017-01-18 00:00:00 <NA>
#> 5 A17 "\"Hello, World!\"" FALSE <NA> NA <NA> NA NA NA Hello, W…
#> 6 A19 $A$18+1 FALSE <NA> NA <NA> NA 2. NA <NA>
#> 7 B19 A18+2 FALSE <NA> NA <NA> NA 3. NA <NA>
#> 8 A20 $A$18+1 FALSE A20:A21 0 <NA> NA 2. NA <NA>
#> 9 B20 A19+2 FALSE B20:B21 1 <NA> NA 4. NA <NA>
#> 10 A21 $A$18+1 FALSE <NA> 0 <NA> NA 2. NA <NA>
#> # ... with 22 more rows
```

Expand Down Expand Up @@ -393,23 +404,24 @@ for details.
``` r
xlsx_validation(examples)
#> # A tibble: 15 x 14
#> sheet ref type operator formu… formu… allow… show_… promp… prom… show… erro… erro… erro…
#> <chr> <chr> <chr> <chr> <chr> <chr> <lgl> <lgl> <chr> <chr> <lgl> <chr> <chr> <chr>
#> 1 Sheet1 A106 whole between 0 9 T T messa… mess… T erro… erro… stop
#> 2 Sheet1 A108 list <NA> $B$108 <NA> T T <NA> <NA> T <NA> <NA> warn…
#> 3 Sheet1 A110 date between 2017-… 2017-… T T <NA> <NA> T <NA> <NA> stop
#> 4 Sheet1 A111 time between 00:00… 09:00… T T <NA> <NA> T <NA> <NA> stop
#> 5 Sheet1 A112 textLength between 0 9 T T <NA> <NA> T <NA> <NA> stop
#> 6 Sheet1 A114 whole notBetween 0 9 T T <NA> <NA> T <NA> <NA> stop
#> 7 Sheet1 A115,A121:A122 whole equal 0 <NA> T T <NA> <NA> T <NA> <NA> stop
#> 8 Sheet1 A116 whole notEqual 0 <NA> T T <NA> <NA> T <NA> <NA> stop
#> 9 Sheet1 A117 whole greaterThan 0 <NA> T T <NA> <NA> T <NA> <NA> stop
#> 10 Sheet1 A119 whole greaterThanOrEqual 0 <NA> T T <NA> <NA> T <NA> <NA> stop
#> 11 Sheet1 A120 whole lessThanOrEqual 0 <NA> T T <NA> <NA> T <NA> <NA> stop
#> 12 Sheet1 A118 whole lessThan 0 <NA> T T <NA> <NA> T <NA> <NA> stop
#> 13 Sheet1 A107 decimal notBetween 0 9 F F <NA> <NA> F <NA> <NA> stop
#> 14 Sheet1 A113 custom <NA> A113<… <NA> T T <NA> <NA> T <NA> <NA> stop
#> 15 Sheet1 A109 list <NA> $B$108 <NA> T T <NA> <NA> T <NA> <NA> info…
#> sheet ref type operator formula1 formula2 allow_blank show_input_mess… prompt_title prompt_body show_error_mess…
#> <chr> <chr> <chr> <chr> <chr> <chr> <lgl> <lgl> <chr> <chr> <lgl>
#> 1 Sheet1 A106 whole between 0 9 TRUE TRUE message tit… message bo… TRUE
#> 2 Sheet1 A108 list <NA> $B$108 <NA> TRUE TRUE <NA> <NA> TRUE
#> 3 Sheet1 A110 date between 2017-01… 2017-01… TRUE TRUE <NA> <NA> TRUE
#> 4 Sheet1 A111 time between 00:00:00 09:00:00 TRUE TRUE <NA> <NA> TRUE
#> 5 Sheet1 A112 text… between 0 9 TRUE TRUE <NA> <NA> TRUE
#> 6 Sheet1 A114 whole notBetw… 0 9 TRUE TRUE <NA> <NA> TRUE
#> 7 Sheet1 A115… whole equal 0 <NA> TRUE TRUE <NA> <NA> TRUE
#> 8 Sheet1 A116 whole notEqual 0 <NA> TRUE TRUE <NA> <NA> TRUE
#> 9 Sheet1 A117 whole greater… 0 <NA> TRUE TRUE <NA> <NA> TRUE
#> 10 Sheet1 A119 whole greater… 0 <NA> TRUE TRUE <NA> <NA> TRUE
#> 11 Sheet1 A120 whole lessTha… 0 <NA> TRUE TRUE <NA> <NA> TRUE
#> 12 Sheet1 A118 whole lessThan 0 <NA> TRUE TRUE <NA> <NA> TRUE
#> 13 Sheet1 A107 deci… notBetw… 0 9 FALSE FALSE <NA> <NA> FALSE
#> 14 Sheet1 A113 cust… <NA> A113<=L… <NA> TRUE TRUE <NA> <NA> TRUE
#> 15 Sheet1 A109 list <NA> $B$108 <NA> TRUE TRUE <NA> <NA> TRUE
#> # ... with 3 more variables: error_title <chr>, error_body <chr>, error_symbol <chr>
```

## Philosophy
Expand Down

0 comments on commit 02653bc

Please sign in to comment.