From ddfe46e2e7b18748eec899637c4a59fbfbed3276 Mon Sep 17 00:00:00 2001 From: AdrienBoukobza Date: Fri, 19 Jul 2019 10:55:00 +0200 Subject: [PATCH] Solving parenthesis problem in vignette and readme --- README.Rmd | 42 +++++++++++++++++++-------------------- vignettes/desctable.Rmd | 44 ++++++++++++++++++++--------------------- 2 files changed, 43 insertions(+), 43 deletions(-) diff --git a/README.Rmd b/README.Rmd index 7ddc9cc..6c30adb 100644 --- a/README.Rmd +++ b/README.Rmd @@ -71,7 +71,7 @@ When used on a data.frame, it returns a descriptive table: ```{r} iris %>% - desctable + desctable() desctable(mtcars) ``` @@ -85,8 +85,8 @@ Methods for reduction to a simple dataframe (`as.data.frame`, automatically used ```{r} iris %>% - desctable %>% - pander + desctable() %>% + pander() ```
You need to load these two packages first (and prior to **desctable** for **DT**) if you want to use them. @@ -128,10 +128,10 @@ You can also provide your own automatic function, which needs to * return a named list of statistical functions to use, as defined in the subsequent paragraphs. ```{r} -# Strictly equivalent to iris %>% desctable %>% pander +# Strictly equivalent to iris %>% desctable() %>% pander() iris %>% desctable(stats = stats_auto) %>% - pander + pander() ``` ### Statistical functions @@ -145,7 +145,7 @@ As mentioned above, they need to be used inside a named list, such as ```{r} mtcars %>% desctable(stats = list("N" = length, "Mean" = mean, "SD" = sd)) %>% - pander + pander() ```
@@ -183,7 +183,7 @@ iris %>% desctable(stats = list("N" = length, "%/Mean" = is.factor ~ percent | (is.normal ~ mean), "Median" = is.normal ~ NA | median)) %>% - pander + pander() ```
@@ -216,7 +216,7 @@ mtlabels <- c(mpg = "Miles/(US) gallon", mtcars %>% dplyr::mutate(am = factor(am, labels = c("Automatic", "Manual"))) %>% desctable(labels = mtlabels) %>% - pander + pander() ```
@@ -233,7 +233,7 @@ It uses the well known `group_by` function from **dplyr**: ```{r} iris %>% group_by(Species) %>% - desctable -> iris_by_Species + desctable() -> iris_by_Species iris_by_Species ``` @@ -254,16 +254,16 @@ You can specify groups based on any variable, not only factors: # With pander output mtcars %>% group_by(cyl) %>% - desctable %>% - pander + desctable() %>% + pander() ``` Also with conditions: ```{r} iris %>% group_by(Petal.Length > 5) %>% - desctable %>% - pander + desctable() %>% + pander() ```
@@ -273,8 +273,8 @@ And even on multiple nested groups: mtcars %>% dplyr::mutate(am = factor(am, labels = c("Automatic", "Manual"))) %>% group_by(vs, am, cyl) %>% - desctable %>% - pander + desctable() %>% + pander() ```
@@ -320,7 +320,7 @@ This function will be used on every variable and every grouping factor to determ iris %>% group_by(Species) %>% desctable(tests = tests_auto) %>% - pander + pander() ```
@@ -341,7 +341,7 @@ iris %>% group_by(Petal.Length > 5) %>% desctable(tests = list(.auto = tests_auto, Species = ~chisq.test)) %>% - pander + pander() ```
@@ -351,7 +351,7 @@ mtcars %>% group_by(am) %>% desctable(tests = list(.default = ~wilcox.test, mpg = ~t.test)) %>% - pander + pander() ```
@@ -376,7 +376,7 @@ mtcars %>% "Sum of squares" = function(x) sum(x^2), "Q1" = . %>% quantile(prob = .25), "Q3" = purrr::partial(quantile, probs = .75))) %>% - pander + pander() ```
@@ -388,7 +388,7 @@ iris %>% Sepal.Width = ~function(f) oneway.test(f, var.equal = F), Petal.Length = ~. %>% oneway.test(var.equal = T), Sepal.Length = ~purrr::partial(oneway.test, var.equal = T))) %>% - pander + pander() ```
@@ -403,5 +403,5 @@ bladder %>% group_by(rx) %>% desctable(tests = list(.default = ~wilcox.test, surv = ~. %>% survdiff %>% .$chisq %>% pchisq(1, lower.tail = F) %>% list(p.value = .))) %>% - pander + pander() ``` diff --git a/vignettes/desctable.Rmd b/vignettes/desctable.Rmd index 126a7d2..25d3d6a 100644 --- a/vignettes/desctable.Rmd +++ b/vignettes/desctable.Rmd @@ -50,7 +50,7 @@ When used on a data.frame, it returns a descriptive table: ```{r} iris %>% - desctable + desctable() desctable(mtcars) ``` @@ -64,12 +64,12 @@ Methods for reduction to a simple dataframe (`as.data.frame`, automatically used ```{r} iris %>% - desctable %>% - pander + desctable() %>% + pander() mtcars %>% - desctable %>% - datatable + desctable() %>% + datatable() ```
You need to load these two packages first (and prior to **desctable** for **DT**) if you want to use them. @@ -114,7 +114,7 @@ You can also provide your own automatic function, which needs to # Strictly equivalent to iris %>% desctable %>% datatable iris %>% desctable(stats = stats_auto) %>% - datatable + datatable() ``` ### Statistical functions @@ -128,7 +128,7 @@ As mentioned above, they need to be used inside a named list, such as ```{r} mtcars %>% desctable(stats = list("N" = length, "Mean" = mean, "SD" = sd)) %>% - datatable + datatable() ```
@@ -166,7 +166,7 @@ iris %>% desctable(stats = list("N" = length, "%/Mean" = is.factor ~ percent | (is.normal ~ mean), "Median" = is.normal ~ NA | median)) %>% - datatable + datatable() ```
@@ -199,7 +199,7 @@ mtlabels <- c(mpg = "Miles/(US) gallon", mtcars %>% dplyr::mutate(am = factor(am, labels = c("Automatic", "Manual"))) %>% desctable(labels = mtlabels) %>% - datatable + datatable() ```
@@ -216,7 +216,7 @@ It uses the well known `group_by` function from **dplyr**: ```{r} iris %>% group_by(Species) %>% - desctable -> iris_by_Species + desctable() -> iris_by_Species iris_by_Species ``` @@ -237,8 +237,8 @@ You can specify groups based on any variable, not only factors: # With pander output mtcars %>% group_by(cyl) %>% - desctable %>% - pander + desctable() %>% + pander() ``` Also with conditions: @@ -246,8 +246,8 @@ Also with conditions: # With datatable output iris %>% group_by(Petal.Length > 5) %>% - desctable %>% - datatable + desctable() %>% + datatable() ```
@@ -257,8 +257,8 @@ And even on multiple nested groups: mtcars %>% dplyr::mutate(am = factor(am, labels = c("Automatic", "Manual"))) %>% group_by(vs, am, cyl) %>% - desctable %>% - datatable + desctable() %>% + datatable() ```
@@ -304,7 +304,7 @@ This function will be used on every variable and every grouping factor to determ iris %>% group_by(Species) %>% desctable(tests = tests_auto) %>% - datatable + datatable() ```
@@ -325,7 +325,7 @@ iris %>% group_by(Petal.Length > 5) %>% desctable(tests = list(.auto = tests_auto, Species = ~chisq.test)) %>% - datatable + datatable() ```
@@ -335,7 +335,7 @@ mtcars %>% group_by(am) %>% desctable(tests = list(.default = ~wilcox.test, mpg = ~t.test)) %>% - datatable + datatable() ```
@@ -360,7 +360,7 @@ mtcars %>% "Sum of squares" = function(x) sum(x^2), "Q1" = . %>% quantile(prob = .25), "Q3" = purrr::partial(quantile, probs = .75))) %>% - datatable + datatable() ```
@@ -372,7 +372,7 @@ iris %>% Sepal.Width = ~function(f) oneway.test(f, var.equal = F), Petal.Length = ~. %>% oneway.test(var.equal = T), Sepal.Length = ~purrr::partial(oneway.test, var.equal = T))) %>% - datatable + datatable() ```
@@ -387,5 +387,5 @@ bladder %>% group_by(rx) %>% desctable(tests = list(.default = ~wilcox.test, surv = ~. %>% survdiff %>% .$chisq %>% pchisq(1, lower.tail = F) %>% list(p.value = .))) %>% - datatable + datatable() ```