diff --git a/articles/data-validation-rules.html b/articles/data-validation-rules.html index 33783a0..f344cd9 100644 --- a/articles/data-validation-rules.html +++ b/articles/data-validation-rules.html @@ -79,7 +79,7 @@

Duncan Garmonsway

-

2023-03-08

+

2023-04-12

Source: vignettes/data-validation-rules.Rmd
data-validation-rules.Rmd
@@ -203,68 +203,67 @@

Joining rules to cells rules #> # A tibble: 15 × 14 -#> sheet ref type opera…¹ formu…² formu…³ allow…⁴ show_…⁵ promp…⁶ promp…⁷ -#> <chr> <chr> <chr> <chr> <chr> <chr> <lgl> <lgl> <chr> <chr> -#> 1 Sheet1 A106 whole between 0 9 TRUE TRUE messag… messag… -#> 2 Sheet1 A108 list NA $B$108 NA TRUE TRUE NA NA -#> 3 Sheet1 A110 date between 2017-0… 2017-0… TRUE TRUE NA NA -#> 4 Sheet1 A111 time between 00:00:… 09:00:… TRUE TRUE NA NA -#> 5 Sheet1 A112 text… between 0 9 TRUE TRUE NA NA -#> 6 Sheet1 A114 whole notBet… 0 9 TRUE TRUE NA NA -#> 7 Sheet1 A115,A1… whole equal 0 NA TRUE TRUE NA NA -#> 8 Sheet1 A116 whole notEqu… 0 NA TRUE TRUE NA NA -#> 9 Sheet1 A117 whole greate… 0 NA TRUE TRUE NA NA -#> 10 Sheet1 A119 whole greate… 0 NA TRUE TRUE NA NA -#> 11 Sheet1 A120 whole lessTh… 0 NA TRUE TRUE NA NA -#> 12 Sheet1 A118 whole lessTh… 0 NA TRUE TRUE NA NA -#> 13 Sheet1 A107 deci… notBet… 0 9 FALSE FALSE NA NA -#> 14 Sheet1 A113 cust… NA A113<=… NA TRUE TRUE NA NA -#> 15 Sheet1 A109 list NA $B$108 NA TRUE TRUE NA NA -#> # … with 4 more variables: show_error_message <lgl>, error_title <chr>, -#> # error_body <chr>, error_symbol <chr>, and abbreviated variable names -#> # ¹​operator, ²​formula1, ³​formula2, ⁴​allow_blank, ⁵​show_input_message, -#> # ⁶​prompt_title, ⁷​prompt_body +#> sheet ref type operator formula1 formula2 allow_blank show_input_message +#> <chr> <chr> <chr> <chr> <chr> <chr> <lgl> <lgl> +#> 1 Sheet1 A106 whole between 0 9 TRUE TRUE +#> 2 Sheet1 A108 list NA $B$108 NA TRUE TRUE +#> 3 Sheet1 A110 date between 2017-01… 2017-01… TRUE TRUE +#> 4 Sheet1 A111 time between 00:00:00 09:00:00 TRUE TRUE +#> 5 Sheet1 A112 text… between 0 9 TRUE TRUE +#> 6 Sheet1 A114 whole notBetw… 0 9 TRUE TRUE +#> 7 Sheet1 A115,… whole equal 0 NA TRUE TRUE +#> 8 Sheet1 A116 whole notEqual 0 NA TRUE TRUE +#> 9 Sheet1 A117 whole greater… 0 NA TRUE TRUE +#> 10 Sheet1 A119 whole greater… 0 NA TRUE TRUE +#> 11 Sheet1 A120 whole lessTha… 0 NA TRUE TRUE +#> 12 Sheet1 A118 whole lessThan 0 NA TRUE TRUE +#> 13 Sheet1 A107 deci… notBetw… 0 9 FALSE FALSE +#> 14 Sheet1 A113 cust… NA A113<=L… NA TRUE TRUE +#> 15 Sheet1 A109 list NA $B$108 NA TRUE TRUE +#> # ℹ 6 more variables: prompt_title <chr>, prompt_body <chr>, +#> # show_error_message <lgl>, error_title <chr>, error_body <chr>, +#> # error_symbol <chr> cells #> # A tibble: 93 × 24 -#> sheet address row col is_blank content data_…¹ error logical numeric -#> <chr> <chr> <int> <int> <lgl> <chr> <chr> <chr> <lgl> <dbl> -#> 1 Sheet1 A106 106 1 FALSE 0 numeric NA NA 0 -#> 2 Sheet1 A107 107 1 FALSE 0.1 numeric NA NA 0.1 -#> 3 Sheet1 A108 108 1 FALSE 137 charac… NA NA NA -#> 4 Sheet1 A109 109 1 FALSE 137 charac… NA NA NA -#> 5 Sheet1 A110 110 1 FALSE 42736 date NA NA NA -#> 6 Sheet1 A111 111 1 FALSE 0.35416666… date NA NA NA -#> 7 Sheet1 A112 112 1 FALSE 149 charac… NA NA NA -#> 8 Sheet1 A113 113 1 FALSE 10 numeric NA NA 10 -#> 9 Sheet1 A114 114 1 FALSE -1 numeric NA NA -1 -#> 10 Sheet1 A115 115 1 FALSE 0 numeric NA NA 0 -#> # … with 83 more rows, 14 more variables: date <dttm>, character <chr>, +#> sheet address row col is_blank content data_type error logical numeric +#> <chr> <chr> <int> <int> <lgl> <chr> <chr> <chr> <lgl> <dbl> +#> 1 Sheet1 A106 106 1 FALSE 0 numeric NA NA 0 +#> 2 Sheet1 A107 107 1 FALSE 0.1 numeric NA NA 0.1 +#> 3 Sheet1 A108 108 1 FALSE 137 character NA NA NA +#> 4 Sheet1 A109 109 1 FALSE 137 character NA NA NA +#> 5 Sheet1 A110 110 1 FALSE 42736 date NA NA NA +#> 6 Sheet1 A111 111 1 FALSE 0.354166… date NA NA NA +#> 7 Sheet1 A112 112 1 FALSE 149 character NA NA NA +#> 8 Sheet1 A113 113 1 FALSE 10 numeric NA NA 10 +#> 9 Sheet1 A114 114 1 FALSE -1 numeric NA NA -1 +#> 10 Sheet1 A115 115 1 FALSE 0 numeric NA NA 0 +#> # ℹ 83 more rows +#> # ℹ 14 more variables: date <dttm>, character <chr>, #> # character_formatted <list>, formula <chr>, is_array <lgl>, #> # formula_ref <chr>, formula_group <int>, comment <chr>, height <dbl>, #> # width <dbl>, row_outline_level <dbl>, col_outline_level <dbl>, -#> # style_format <chr>, local_format_id <int>, and abbreviated variable name -#> # ¹​data_type +#> # style_format <chr>, local_format_id <int> inner_join(rules, cells, by = c("sheet" = "sheet", "ref" = "address")) #> # A tibble: 9 × 36 -#> sheet ref type opera…¹ formu…² formu…³ allow…⁴ show_…⁵ promp…⁶ promp…⁷ -#> <chr> <chr> <chr> <chr> <chr> <chr> <lgl> <lgl> <chr> <chr> -#> 1 Sheet1 A106 whole between 0 9 TRUE TRUE messag… messag… -#> 2 Sheet1 A108 list NA $B$108 NA TRUE TRUE NA NA -#> 3 Sheet1 A110 date between 2017-0… 2017-0… TRUE TRUE NA NA -#> 4 Sheet1 A111 time between 00:00:… 09:00:… TRUE TRUE NA NA -#> 5 Sheet1 A112 textLeng… between 0 9 TRUE TRUE NA NA -#> 6 Sheet1 A114 whole notBet… 0 9 TRUE TRUE NA NA -#> 7 Sheet1 A107 decimal notBet… 0 9 FALSE FALSE NA NA -#> 8 Sheet1 A113 custom NA A113<=… NA TRUE TRUE NA NA -#> 9 Sheet1 A109 list NA $B$108 NA TRUE TRUE NA NA -#> # … with 26 more variables: show_error_message <lgl>, error_title <chr>, -#> # error_body <chr>, error_symbol <chr>, row <int>, col <int>, is_blank <lgl>, -#> # content <chr>, data_type <chr>, error <chr>, logical <lgl>, numeric <dbl>, -#> # date <dttm>, character <chr>, character_formatted <list>, formula <chr>, -#> # is_array <lgl>, formula_ref <chr>, formula_group <int>, comment <chr>, -#> # height <dbl>, width <dbl>, row_outline_level <dbl>, -#> # col_outline_level <dbl>, style_format <chr>, local_format_id <int>, and … +#> sheet ref type operator formula1 formula2 allow_blank show_input_message +#> <chr> <chr> <chr> <chr> <chr> <chr> <lgl> <lgl> +#> 1 Sheet1 A106 whole between 0 9 TRUE TRUE +#> 2 Sheet1 A108 list NA $B$108 NA TRUE TRUE +#> 3 Sheet1 A110 date between 2017-01… 2017-01… TRUE TRUE +#> 4 Sheet1 A111 time between 00:00:00 09:00:00 TRUE TRUE +#> 5 Sheet1 A112 textLe… between 0 9 TRUE TRUE +#> 6 Sheet1 A114 whole notBetw… 0 9 TRUE TRUE +#> 7 Sheet1 A107 decimal notBetw… 0 9 FALSE FALSE +#> 8 Sheet1 A113 custom NA A113<=L… NA TRUE TRUE +#> 9 Sheet1 A109 list NA $B$108 NA TRUE TRUE +#> # ℹ 28 more variables: prompt_title <chr>, prompt_body <chr>, +#> # show_error_message <lgl>, error_title <chr>, error_body <chr>, +#> # error_symbol <chr>, row <int>, col <int>, is_blank <lgl>, content <chr>, +#> # data_type <chr>, error <chr>, logical <lgl>, numeric <dbl>, date <dttm>, +#> # character <chr>, character_formatted <list>, formula <chr>, is_array <lgl>, +#> # formula_ref <chr>, formula_group <int>, comment <chr>, height <dbl>, +#> # width <dbl>, row_outline_level <dbl>, col_outline_level <dbl>, …

Notice that only 9 cells were joined, even though 15 rules were defined. Surely at least 15 cells ought to be joined? The reason why they are not is that the cells for the other 6 rules don’t exist – rules @@ -317,36 +316,31 @@

Joining rules to cells (nested_rule <- slice(rules, 7)) #> # A tibble: 1 × 14 -#> sheet ref type opera…¹ formu…² formu…³ allow…⁴ show_…⁵ promp…⁶ promp…⁷ -#> <chr> <chr> <chr> <chr> <chr> <chr> <lgl> <lgl> <chr> <chr> -#> 1 Sheet1 A115,A12… whole equal 0 NA TRUE TRUE NA NA -#> # … with 4 more variables: show_error_message <lgl>, error_title <chr>, -#> # error_body <chr>, error_symbol <chr>, and abbreviated variable names -#> # ¹​operator, ²​formula1, ³​formula2, ⁴​allow_blank, ⁵​show_input_message, -#> # ⁶​prompt_title, ⁷​prompt_body +#> sheet ref type operator formula1 formula2 allow_blank show_input_message +#> <chr> <chr> <chr> <chr> <chr> <chr> <lgl> <lgl> +#> 1 Sheet1 A115,A… whole equal 0 NA TRUE TRUE +#> # ℹ 6 more variables: prompt_title <chr>, prompt_body <chr>, +#> # show_error_message <lgl>, error_title <chr>, error_body <chr>, +#> # error_symbol <chr> unnest_ref(nested_rule, ref) #> Warning: Prefixing `UQ()` with the rlang namespace is deprecated as of rlang 0.3.0. #> Please use the non-prefixed form or `!!` instead. #> -#> # Bad: -#> rlang::expr(mean(rlang::UQ(var) * 100)) -#> -#> # Ok: -#> rlang::expr(mean(UQ(var) * 100)) +#> # Bad: rlang::expr(mean(rlang::UQ(var) * 100)) #> -#> # Good: -#> rlang::expr(mean(!!var * 100)) +#> # Ok: rlang::expr(mean(UQ(var) * 100)) #> -#> This warning is displayed once per session. +#> # Good: rlang::expr(mean(!!var * 100)) +#> This warning is displayed once every 8 hours. #> # A tibble: 3 × 14 -#> sheet ref type operator formula1 formula2 allow_…¹ show_…² promp…³ promp…⁴ -#> <chr> <chr> <chr> <chr> <chr> <chr> <lgl> <lgl> <chr> <chr> -#> 1 Sheet1 A115 whole equal 0 NA TRUE TRUE NA NA -#> 2 Sheet1 A121 whole equal 0 NA TRUE TRUE NA NA -#> 3 Sheet1 A122 whole equal 0 NA TRUE TRUE NA NA -#> # … with 4 more variables: show_error_message <lgl>, error_title <chr>, -#> # error_body <chr>, error_symbol <chr>, and abbreviated variable names -#> # ¹​allow_blank, ²​show_input_message, ³​prompt_title, ⁴​prompt_body +#> sheet ref type operator formula1 formula2 allow_blank show_input_message +#> <chr> <chr> <chr> <chr> <chr> <chr> <lgl> <lgl> +#> 1 Sheet1 A115 whole equal 0 NA TRUE TRUE +#> 2 Sheet1 A121 whole equal 0 NA TRUE TRUE +#> 3 Sheet1 A122 whole equal 0 NA TRUE TRUE +#> # ℹ 6 more variables: prompt_title <chr>, prompt_body <chr>, +#> # show_error_message <lgl>, error_title <chr>, error_body <chr>, +#> # error_symbol <chr>

Finally the new data frame of rules can be joined to a data frame of cells in any of the usual ways, via the sheet and ref columns.

diff --git a/articles/smells.html b/articles/smells.html index 2db8e5c..bcf80dc 100644 --- a/articles/smells.html +++ b/articles/smells.html @@ -79,7 +79,7 @@

Duncan Garmonsway

-

2023-03-08

+

2023-04-12

Source: vignettes/smells.Rmd
smells.Rmd
@@ -217,7 +217,7 @@

Many formulas## 8 14 5 <xlex [4 × 3]> ## 9 14 6 <xlex [4 × 3]> ## 10 17 4 <xlex [7 × 3]> -## # … with 144 more rows +## # ℹ 144 more rows

Then we can unnest the data frames and filter for tokens that are constants, to find out which cells have constants in their formulas.

@@ -239,7 +239,7 @@ 

Many formulas## 8 12 4 1 number 7 ## 9 12 4 0 number 12 ## 10 13 4 1 number 7 -## # … with 191 more rows

+## # ℹ 191 more rows

Which constants are most common? Unsurprisingly, 12 and 7 are almost equally abundant, but there are also lots of 6s and 9s – two- and three-quarterly figures? Then there are some 150000s and the familiar @@ -309,7 +309,7 @@

Visualising constants## 8 18 4 TRUE ## 9 19 4 TRUE ## 10 20 4 TRUE -## # … with 402 more rows +## # ℹ 402 more rows
 has_constants %>%
   # filter(row <= 28) %>%
@@ -379,7 +379,7 @@ 

Detecting deeply nested formulas## 8 171 9 7 ## 9 171 10 7 ## 10 171 11 7 -## # … with 38 more rows

+## # ℹ 38 more rows

Do you wonder what those formulas look like?

 sheet %>%
diff --git a/articles/tidyxl.html b/articles/tidyxl.html
index 516d7c6..2088d1a 100644
--- a/articles/tidyxl.html
+++ b/articles/tidyxl.html
@@ -79,7 +79,7 @@
                         

Duncan Garmonsway

-

2023-03-08

+

2023-04-12

Source: vignettes/tidyxl.Rmd
tidyxl.Rmd
@@ -218,7 +218,7 @@

Examples#> 8 G2 Yes #> 9 A3 Class #> 10 B3 Sex -#> # … with 12 more rows +#> # ℹ 12 more rows x[x$row == 4, c("address", "character", "numeric")] #> # A tibble: 6 × 3 #> address character numeric @@ -238,14 +238,14 @@

Formattingtidyxl, with the xlsx_formats() function.

-

+

Screenshot of a spreadsheet with meaningful formatting

Formatting is available by using the columns local_format_id and style_format as indexes into a separate list-of-lists structure. ‘Local’ formatting is the most common kind, applied to individual cells. ‘Style’ formatting is usually applied to blocks of cells, and defines several formats at once. Here is a screenshot of the styles buttons in Excel.

-

+

Screenshot of a formatting options available in Excel

Formatting can be looked up as follows.

 # Bold
@@ -295,27 +295,26 @@ 

Formattingxlsx_cells(examples)$character_formatted[77] #> [[1]] #> # A tibble: 16 × 14 -#> character bold italic under…¹ strike vertA…² size color…³ color…⁴ color…⁵ -#> <chr> <lgl> <lgl> <chr> <lgl> <chr> <dbl> <chr> <int> <int> -#> 1 "in-cell" FALSE FALSE NA FALSE NA 0 NA NA NA -#> 2 "bold" TRUE FALSE NA FALSE NA 0 FF0000… 2 NA -#> 3 "italic" FALSE TRUE NA FALSE NA 0 FF0000… 2 NA -#> 4 "underline" FALSE FALSE single FALSE NA 0 FF0000… 2 NA -#> 5 "underline… FALSE FALSE double FALSE NA 0 FF0000… 2 NA -#> 6 "singleacc… FALSE FALSE single… FALSE NA 0 FF0000… 2 NA -#> 7 "doubleacc… FALSE FALSE double… FALSE NA 0 FF0000… 2 NA -#> 8 "strikethr… FALSE FALSE NA TRUE NA 0 FF0000… 2 NA -#> 9 "subscript" FALSE FALSE NA FALSE subscr… 0 FF0000… 2 NA -#> 10 "superscri… FALSE FALSE NA FALSE supers… 0 FF0000… 2 NA -#> 11 "red" FALSE FALSE NA FALSE NA 0 FFFF00… NA NA -#> 12 "theme" FALSE FALSE NA FALSE NA 0 FFC050… 6 NA -#> 13 "tint" FALSE FALSE NA FALSE NA 0 FFC050… 6 NA -#> 14 "size" FALSE FALSE NA FALSE NA 0 FFFF00… NA NA -#> 15 "arial" FALSE FALSE NA FALSE NA 0 FFFF00… NA NA -#> 16 "UTF8Stéph… FALSE FALSE NA FALSE NA 0 FFFF00… NA NA -#> # … with 4 more variables: color_tint <dbl>, font <chr>, family <int>, -#> # scheme <chr>, and abbreviated variable names ¹​underline, ²​vertAlign, -#> # ³​color_rgb, ⁴​color_theme, ⁵​color_indexed

+#> character bold italic underline strike vertAlign size color_rgb color_theme +#> <chr> <lgl> <lgl> <chr> <lgl> <chr> <dbl> <chr> <int> +#> 1 "in-cell" FALSE FALSE NA FALSE NA 0 NA NA +#> 2 "bold" TRUE FALSE NA FALSE NA 0 FF000000 2 +#> 3 "italic" FALSE TRUE NA FALSE NA 0 FF000000 2 +#> 4 "underli… FALSE FALSE single FALSE NA 0 FF000000 2 +#> 5 "underli… FALSE FALSE double FALSE NA 0 FF000000 2 +#> 6 "singlea… FALSE FALSE singleAc… FALSE NA 0 FF000000 2 +#> 7 "doublea… FALSE FALSE doubleAc… FALSE NA 0 FF000000 2 +#> 8 "striket… FALSE FALSE NA TRUE NA 0 FF000000 2 +#> 9 "subscri… FALSE FALSE NA FALSE subscript 0 FF000000 2 +#> 10 "supersc… FALSE FALSE NA FALSE superscr… 0 FF000000 2 +#> 11 "red" FALSE FALSE NA FALSE NA 0 FFFF0000 NA +#> 12 "theme" FALSE FALSE NA FALSE NA 0 FFC0504D 6 +#> 13 "tint" FALSE FALSE NA FALSE NA 0 FFC0504D 6 +#> 14 "size" FALSE FALSE NA FALSE NA 0 FFFF0000 NA +#> 15 "arial" FALSE FALSE NA FALSE NA 0 FFFF0000 NA +#> 16 "UTF8Sté… FALSE FALSE NA FALSE NA 0 FFFF0000 NA +#> # ℹ 5 more variables: color_indexed <int>, color_tint <dbl>, font <chr>, +#> # family <int>, scheme <chr>

To see all the available kinds of formats, use str(formats).

@@ -353,7 +352,7 @@

Formulas#> 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

+#> # ℹ 22 more rows

The top five cells show that the results of formulas are available as usual in the columns error, logical, numeric, date, and character.

@@ -463,25 +462,24 @@

Data validation rules
 xlsx_validation(examples)
 #> # A tibble: 15 × 14
-#>    sheet  ref            type    opera…¹ formu…² formu…³ allow…⁴ show_…⁵ promp…⁶ promp…⁷ show_…⁸ error…⁹ error…˟ error…˟
-#>    <chr>  <chr>          <chr>   <chr>   <chr>   <chr>   <lgl>   <lgl>   <chr>   <chr>   <lgl>   <chr>   <chr>   <chr>  
-#>  1 Sheet1 A106           whole   between 0       9       TRUE    TRUE    messag… messag… TRUE    error … error … stop   
-#>  2 Sheet1 A108           list    NA      $B$108  NA      TRUE    TRUE    NA      NA      TRUE    NA      NA      warning
-#>  3 Sheet1 A110           date    between 2017-0… 2017-0… TRUE    TRUE    NA      NA      TRUE    NA      NA      stop   
-#>  4 Sheet1 A111           time    between 00:00:… 09:00:… TRUE    TRUE    NA      NA      TRUE    NA      NA      stop   
-#>  5 Sheet1 A112           textLe… between 0       9       TRUE    TRUE    NA      NA      TRUE    NA      NA      stop   
-#>  6 Sheet1 A114           whole   notBet… 0       9       TRUE    TRUE    NA      NA      TRUE    NA      NA      stop   
-#>  7 Sheet1 A115,A121:A122 whole   equal   0       NA      TRUE    TRUE    NA      NA      TRUE    NA      NA      stop   
-#>  8 Sheet1 A116           whole   notEqu… 0       NA      TRUE    TRUE    NA      NA      TRUE    NA      NA      stop   
-#>  9 Sheet1 A117           whole   greate… 0       NA      TRUE    TRUE    NA      NA      TRUE    NA      NA      stop   
-#> 10 Sheet1 A119           whole   greate… 0       NA      TRUE    TRUE    NA      NA      TRUE    NA      NA      stop   
-#> 11 Sheet1 A120           whole   lessTh… 0       NA      TRUE    TRUE    NA      NA      TRUE    NA      NA      stop   
-#> 12 Sheet1 A118           whole   lessTh… 0       NA      TRUE    TRUE    NA      NA      TRUE    NA      NA      stop   
-#> 13 Sheet1 A107           decimal notBet… 0       9       FALSE   FALSE   NA      NA      FALSE   NA      NA      stop   
-#> 14 Sheet1 A113           custom  NA      A113<=… NA      TRUE    TRUE    NA      NA      TRUE    NA      NA      stop   
-#> 15 Sheet1 A109           list    NA      $B$108  NA      TRUE    TRUE    NA      NA      TRUE    NA      NA      inform…
-#> # … with abbreviated variable names ¹​operator, ²​formula1, ³​formula2, ⁴​allow_blank, ⁵​show_input_message, ⁶​prompt_title,
-#> #   ⁷​prompt_body, ⁸​show_error_message, ⁹​error_title, ˟​error_body, ˟​error_symbol
+#> sheet ref type operator formula1 formula2 allow_blank show_input_message prompt_title prompt_body +#> <chr> <chr> <chr> <chr> <chr> <chr> <lgl> <lgl> <chr> <chr> +#> 1 Sheet1 A106 whole between 0 9 TRUE TRUE message tit… message bo… +#> 2 Sheet1 A108 list NA $B$108 NA TRUE TRUE NA NA +#> 3 Sheet1 A110 date between 2017-01… 2017-01… TRUE TRUE NA NA +#> 4 Sheet1 A111 time between 00:00:00 09:00:00 TRUE TRUE NA NA +#> 5 Sheet1 A112 textLength between 0 9 TRUE TRUE NA NA +#> 6 Sheet1 A114 whole notBetween 0 9 TRUE TRUE NA NA +#> 7 Sheet1 A115,A121:A122 whole equal 0 NA TRUE TRUE NA NA +#> 8 Sheet1 A116 whole notEqual 0 NA TRUE TRUE NA NA +#> 9 Sheet1 A117 whole greaterTh… 0 NA TRUE TRUE NA NA +#> 10 Sheet1 A119 whole greaterTh… 0 NA TRUE TRUE NA NA +#> 11 Sheet1 A120 whole lessThanO… 0 NA TRUE TRUE NA NA +#> 12 Sheet1 A118 whole lessThan 0 NA TRUE TRUE NA NA +#> 13 Sheet1 A107 decimal notBetween 0 9 FALSE FALSE NA NA +#> 14 Sheet1 A113 custom NA A113<=L… NA TRUE TRUE NA NA +#> 15 Sheet1 A109 list NA $B$108 NA TRUE TRUE NA NA +#> # ℹ 4 more variables: show_error_message <lgl>, error_title <chr>, error_body <chr>, error_symbol <chr>
diff --git a/index.html b/index.html index 497040a..774d124 100644 --- a/index.html +++ b/index.html @@ -89,7 +89,7 @@

Make cells tidy

Tidyxl represents each cell as one row in a dataframe. Like this.

-

Gif of tidyxl converting cells into a tidy representation of one row per cell

+

Gif of tidyxl converting cells into a tidy representation of one row per cell

What can you do with tidy cells? The best places to start are:

diff --git a/reference/xlsx_formats.html b/reference/xlsx_formats.html index 2bf24ad..3c2b3ce 100644 --- a/reference/xlsx_formats.html +++ b/reference/xlsx_formats.html @@ -699,7 +699,7 @@

Examples#> 1 Sheet1 A28 28 1 FALSE 0 character NA NA NA #> 2 Sheet1 A32 32 1 FALSE 6 character NA NA NA #> 3 Sheet1 A49 49 1 FALSE 12 character NA NA NA -#> # … with 14 more variables: date <dttm>, character <chr>, +#> # ℹ 14 more variables: date <dttm>, character <chr>, #> # character_formatted <list>, formula <chr>, is_array <lgl>, #> # formula_ref <chr>, formula_group <int>, comment <chr>, height <dbl>, #> # width <dbl>, row_outline_level <dbl>, col_outline_level <dbl>, diff --git a/reference/xlsx_validation.html b/reference/xlsx_validation.html index 2a960f9..48b197b 100644 --- a/reference/xlsx_validation.html +++ b/reference/xlsx_validation.html @@ -127,73 +127,70 @@

Examples
examples <- system.file("extdata/examples.xlsx", package = "tidyxl")
 xlsx_validation(examples)
 #> # A tibble: 15 × 14
-#>    sheet  ref      type  opera…¹ formu…² formu…³ allow…⁴ show_…⁵ promp…⁶ promp…⁷
-#>    <chr>  <chr>    <chr> <chr>   <chr>   <chr>   <lgl>   <lgl>   <chr>   <chr>  
-#>  1 Sheet1 A106     whole between 0       9       TRUE    TRUE    messag… messag…
-#>  2 Sheet1 A108     list  NA      $B$108  NA      TRUE    TRUE    NA      NA     
-#>  3 Sheet1 A110     date  between 2017-0… 2017-0… TRUE    TRUE    NA      NA     
-#>  4 Sheet1 A111     time  between 00:00:… 09:00:… TRUE    TRUE    NA      NA     
-#>  5 Sheet1 A112     text… between 0       9       TRUE    TRUE    NA      NA     
-#>  6 Sheet1 A114     whole notBet… 0       9       TRUE    TRUE    NA      NA     
-#>  7 Sheet1 A115,A1… whole equal   0       NA      TRUE    TRUE    NA      NA     
-#>  8 Sheet1 A116     whole notEqu… 0       NA      TRUE    TRUE    NA      NA     
-#>  9 Sheet1 A117     whole greate… 0       NA      TRUE    TRUE    NA      NA     
-#> 10 Sheet1 A119     whole greate… 0       NA      TRUE    TRUE    NA      NA     
-#> 11 Sheet1 A120     whole lessTh… 0       NA      TRUE    TRUE    NA      NA     
-#> 12 Sheet1 A118     whole lessTh… 0       NA      TRUE    TRUE    NA      NA     
-#> 13 Sheet1 A107     deci… notBet… 0       9       FALSE   FALSE   NA      NA     
-#> 14 Sheet1 A113     cust… NA      A113<=… NA      TRUE    TRUE    NA      NA     
-#> 15 Sheet1 A109     list  NA      $B$108  NA      TRUE    TRUE    NA      NA     
-#> # … with 4 more variables: show_error_message <lgl>, error_title <chr>,
-#> #   error_body <chr>, error_symbol <chr>, and abbreviated variable names
-#> #   ¹​operator, ²​formula1, ³​formula2, ⁴​allow_blank, ⁵​show_input_message,
-#> #   ⁶​prompt_title, ⁷​prompt_body
+#>    sheet  ref    type  operator formula1 formula2 allow_blank show_input_message
+#>    <chr>  <chr>  <chr> <chr>    <chr>    <chr>    <lgl>       <lgl>             
+#>  1 Sheet1 A106   whole between  0        9        TRUE        TRUE              
+#>  2 Sheet1 A108   list  NA       $B$108   NA       TRUE        TRUE              
+#>  3 Sheet1 A110   date  between  2017-01… 2017-01… TRUE        TRUE              
+#>  4 Sheet1 A111   time  between  00:00:00 09:00:00 TRUE        TRUE              
+#>  5 Sheet1 A112   text… between  0        9        TRUE        TRUE              
+#>  6 Sheet1 A114   whole notBetw… 0        9        TRUE        TRUE              
+#>  7 Sheet1 A115,… whole equal    0        NA       TRUE        TRUE              
+#>  8 Sheet1 A116   whole notEqual 0        NA       TRUE        TRUE              
+#>  9 Sheet1 A117   whole greater… 0        NA       TRUE        TRUE              
+#> 10 Sheet1 A119   whole greater… 0        NA       TRUE        TRUE              
+#> 11 Sheet1 A120   whole lessTha… 0        NA       TRUE        TRUE              
+#> 12 Sheet1 A118   whole lessThan 0        NA       TRUE        TRUE              
+#> 13 Sheet1 A107   deci… notBetw… 0        9        FALSE       FALSE             
+#> 14 Sheet1 A113   cust… NA       A113<=L… NA       TRUE        TRUE              
+#> 15 Sheet1 A109   list  NA       $B$108   NA       TRUE        TRUE              
+#> # ℹ 6 more variables: prompt_title <chr>, prompt_body <chr>,
+#> #   show_error_message <lgl>, error_title <chr>, error_body <chr>,
+#> #   error_symbol <chr>
 xlsx_validation(examples, 1)
 #> # A tibble: 15 × 14
-#>    sheet  ref      type  opera…¹ formu…² formu…³ allow…⁴ show_…⁵ promp…⁶ promp…⁷
-#>    <chr>  <chr>    <chr> <chr>   <chr>   <chr>   <lgl>   <lgl>   <chr>   <chr>  
-#>  1 Sheet1 A106     whole between 0       9       TRUE    TRUE    messag… messag…
-#>  2 Sheet1 A108     list  NA      $B$108  NA      TRUE    TRUE    NA      NA     
-#>  3 Sheet1 A110     date  between 2017-0… 2017-0… TRUE    TRUE    NA      NA     
-#>  4 Sheet1 A111     time  between 00:00:… 09:00:… TRUE    TRUE    NA      NA     
-#>  5 Sheet1 A112     text… between 0       9       TRUE    TRUE    NA      NA     
-#>  6 Sheet1 A114     whole notBet… 0       9       TRUE    TRUE    NA      NA     
-#>  7 Sheet1 A115,A1… whole equal   0       NA      TRUE    TRUE    NA      NA     
-#>  8 Sheet1 A116     whole notEqu… 0       NA      TRUE    TRUE    NA      NA     
-#>  9 Sheet1 A117     whole greate… 0       NA      TRUE    TRUE    NA      NA     
-#> 10 Sheet1 A119     whole greate… 0       NA      TRUE    TRUE    NA      NA     
-#> 11 Sheet1 A120     whole lessTh… 0       NA      TRUE    TRUE    NA      NA     
-#> 12 Sheet1 A118     whole lessTh… 0       NA      TRUE    TRUE    NA      NA     
-#> 13 Sheet1 A107     deci… notBet… 0       9       FALSE   FALSE   NA      NA     
-#> 14 Sheet1 A113     cust… NA      A113<=… NA      TRUE    TRUE    NA      NA     
-#> 15 Sheet1 A109     list  NA      $B$108  NA      TRUE    TRUE    NA      NA     
-#> # … with 4 more variables: show_error_message <lgl>, error_title <chr>,
-#> #   error_body <chr>, error_symbol <chr>, and abbreviated variable names
-#> #   ¹​operator, ²​formula1, ³​formula2, ⁴​allow_blank, ⁵​show_input_message,
-#> #   ⁶​prompt_title, ⁷​prompt_body
+#>    sheet  ref    type  operator formula1 formula2 allow_blank show_input_message
+#>    <chr>  <chr>  <chr> <chr>    <chr>    <chr>    <lgl>       <lgl>             
+#>  1 Sheet1 A106   whole between  0        9        TRUE        TRUE              
+#>  2 Sheet1 A108   list  NA       $B$108   NA       TRUE        TRUE              
+#>  3 Sheet1 A110   date  between  2017-01… 2017-01… TRUE        TRUE              
+#>  4 Sheet1 A111   time  between  00:00:00 09:00:00 TRUE        TRUE              
+#>  5 Sheet1 A112   text… between  0        9        TRUE        TRUE              
+#>  6 Sheet1 A114   whole notBetw… 0        9        TRUE        TRUE              
+#>  7 Sheet1 A115,… whole equal    0        NA       TRUE        TRUE              
+#>  8 Sheet1 A116   whole notEqual 0        NA       TRUE        TRUE              
+#>  9 Sheet1 A117   whole greater… 0        NA       TRUE        TRUE              
+#> 10 Sheet1 A119   whole greater… 0        NA       TRUE        TRUE              
+#> 11 Sheet1 A120   whole lessTha… 0        NA       TRUE        TRUE              
+#> 12 Sheet1 A118   whole lessThan 0        NA       TRUE        TRUE              
+#> 13 Sheet1 A107   deci… notBetw… 0        9        FALSE       FALSE             
+#> 14 Sheet1 A113   cust… NA       A113<=L… NA       TRUE        TRUE              
+#> 15 Sheet1 A109   list  NA       $B$108   NA       TRUE        TRUE              
+#> # ℹ 6 more variables: prompt_title <chr>, prompt_body <chr>,
+#> #   show_error_message <lgl>, error_title <chr>, error_body <chr>,
+#> #   error_symbol <chr>
 xlsx_validation(examples, "Sheet1")
 #> # A tibble: 15 × 14
-#>    sheet  ref      type  opera…¹ formu…² formu…³ allow…⁴ show_…⁵ promp…⁶ promp…⁷
-#>    <chr>  <chr>    <chr> <chr>   <chr>   <chr>   <lgl>   <lgl>   <chr>   <chr>  
-#>  1 Sheet1 A106     whole between 0       9       TRUE    TRUE    messag… messag…
-#>  2 Sheet1 A108     list  NA      $B$108  NA      TRUE    TRUE    NA      NA     
-#>  3 Sheet1 A110     date  between 2017-0… 2017-0… TRUE    TRUE    NA      NA     
-#>  4 Sheet1 A111     time  between 00:00:… 09:00:… TRUE    TRUE    NA      NA     
-#>  5 Sheet1 A112     text… between 0       9       TRUE    TRUE    NA      NA     
-#>  6 Sheet1 A114     whole notBet… 0       9       TRUE    TRUE    NA      NA     
-#>  7 Sheet1 A115,A1… whole equal   0       NA      TRUE    TRUE    NA      NA     
-#>  8 Sheet1 A116     whole notEqu… 0       NA      TRUE    TRUE    NA      NA     
-#>  9 Sheet1 A117     whole greate… 0       NA      TRUE    TRUE    NA      NA     
-#> 10 Sheet1 A119     whole greate… 0       NA      TRUE    TRUE    NA      NA     
-#> 11 Sheet1 A120     whole lessTh… 0       NA      TRUE    TRUE    NA      NA     
-#> 12 Sheet1 A118     whole lessTh… 0       NA      TRUE    TRUE    NA      NA     
-#> 13 Sheet1 A107     deci… notBet… 0       9       FALSE   FALSE   NA      NA     
-#> 14 Sheet1 A113     cust… NA      A113<=… NA      TRUE    TRUE    NA      NA     
-#> 15 Sheet1 A109     list  NA      $B$108  NA      TRUE    TRUE    NA      NA     
-#> # … with 4 more variables: show_error_message <lgl>, error_title <chr>,
-#> #   error_body <chr>, error_symbol <chr>, and abbreviated variable names
-#> #   ¹​operator, ²​formula1, ³​formula2, ⁴​allow_blank, ⁵​show_input_message,
-#> #   ⁶​prompt_title, ⁷​prompt_body
+#>    sheet  ref    type  operator formula1 formula2 allow_blank show_input_message
+#>    <chr>  <chr>  <chr> <chr>    <chr>    <chr>    <lgl>       <lgl>             
+#>  1 Sheet1 A106   whole between  0        9        TRUE        TRUE              
+#>  2 Sheet1 A108   list  NA       $B$108   NA       TRUE        TRUE              
+#>  3 Sheet1 A110   date  between  2017-01… 2017-01… TRUE        TRUE              
+#>  4 Sheet1 A111   time  between  00:00:00 09:00:00 TRUE        TRUE              
+#>  5 Sheet1 A112   text… between  0        9        TRUE        TRUE              
+#>  6 Sheet1 A114   whole notBetw… 0        9        TRUE        TRUE              
+#>  7 Sheet1 A115,… whole equal    0        NA       TRUE        TRUE              
+#>  8 Sheet1 A116   whole notEqual 0        NA       TRUE        TRUE              
+#>  9 Sheet1 A117   whole greater… 0        NA       TRUE        TRUE              
+#> 10 Sheet1 A119   whole greater… 0        NA       TRUE        TRUE              
+#> 11 Sheet1 A120   whole lessTha… 0        NA       TRUE        TRUE              
+#> 12 Sheet1 A118   whole lessThan 0        NA       TRUE        TRUE              
+#> 13 Sheet1 A107   deci… notBetw… 0        9        FALSE       FALSE             
+#> 14 Sheet1 A113   cust… NA       A113<=L… NA       TRUE        TRUE              
+#> 15 Sheet1 A109   list  NA       $B$108   NA       TRUE        TRUE              
+#> # ℹ 6 more variables: prompt_title <chr>, prompt_body <chr>,
+#> #   show_error_message <lgl>, error_title <chr>, error_body <chr>,
+#> #   error_symbol <chr>