-
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
138 additions
and
137 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,49 @@ | ||
Package: expss | ||
Type: Package | ||
Title: Tables, Labels and Some Useful Functions from Spreadsheets and 'SPSS' Statistics | ||
Version: 0.10.1 | ||
Maintainer: Gregory Demin <[email protected]> | ||
Authors@R: c( | ||
person("Gregory", "Demin", email = "[email protected]", | ||
role = c("aut", "cre")), | ||
person("Sebastian", "Jeworutzki", email="[email protected]", | ||
role = c("ctb"), comment = c(ORCID = "0000-0002-2671-5253")) | ||
) | ||
URL: https://gdemin.github.io/expss/ | ||
BugReports: https://github.com/gdemin/expss/issues | ||
Depends: | ||
R (>= 3.3.0), | ||
Imports: | ||
foreign, | ||
utils, | ||
stats, | ||
magrittr (>= 1.5), | ||
htmlTable (>= 1.11.0), | ||
matrixStats (>= 0.51.0), | ||
data.table (>= 1.10), | ||
Suggests: | ||
DT, | ||
htmltools, | ||
knitr, | ||
repr, | ||
ggplot2, | ||
testthat, | ||
openxlsx, | ||
fst, | ||
huxtable | ||
Description: Package computes and displays tables with support for 'SPSS'-style | ||
labels, multiple and nested banners, weights, multiple-response variables | ||
and significance testing. There are facilities for nice output of tables | ||
in 'knitr', 'Shiny', '*.xlsx' files, R and 'Jupyter' notebooks. Methods | ||
for labelled variables add value labels support to base R functions and to | ||
some functions from other packages. Additionally, the package brings | ||
popular data transformation functions from 'SPSS' Statistics and 'Excel': | ||
'RECODE', 'COUNT', 'COMPUTE', 'DO IF', 'COUNTIF', 'VLOOKUP' and etc. | ||
These functions are very useful for data processing in marketing research | ||
surveys. Package intended to help people to move data | ||
processing from 'Excel' and 'SPSS' to R. | ||
VignetteBuilder: knitr | ||
LazyData: yes | ||
License: GPL (>= 2) | ||
RoxygenNote: 7.0.1 | ||
Package: expss | ||
Type: Package | ||
Title: Tables, Labels and Some Useful Functions from Spreadsheets and 'SPSS' Statistics | ||
Version: 0.10.1 | ||
Maintainer: Gregory Demin <[email protected]> | ||
Authors@R: c( | ||
person("Gregory", "Demin", email = "[email protected]", | ||
role = c("aut", "cre")), | ||
person("Sebastian", "Jeworutzki", email="[email protected]", | ||
role = c("ctb"), comment = c(ORCID = "0000-0002-2671-5253")) | ||
) | ||
URL: https://gdemin.github.io/expss/ | ||
BugReports: https://github.com/gdemin/expss/issues | ||
Depends: | ||
R (>= 3.3.0), | ||
Imports: | ||
foreign, | ||
utils, | ||
stats, | ||
magrittr (>= 1.5), | ||
htmlTable (>= 1.11.0), | ||
matrixStats (>= 0.51.0), | ||
data.table (>= 1.10), | ||
Suggests: | ||
DT, | ||
htmltools, | ||
knitr, | ||
repr, | ||
ggplot2, | ||
testthat, | ||
openxlsx, | ||
fst, | ||
huxtable, | ||
rmarkdown | ||
Description: Package computes and displays tables with support for 'SPSS'-style | ||
labels, multiple and nested banners, weights, multiple-response variables | ||
and significance testing. There are facilities for nice output of tables | ||
in 'knitr', 'Shiny', '*.xlsx' files, R and 'Jupyter' notebooks. Methods | ||
for labelled variables add value labels support to base R functions and to | ||
some functions from other packages. Additionally, the package brings | ||
popular data transformation functions from 'SPSS' Statistics and 'Excel': | ||
'RECODE', 'COUNT', 'COMPUTE', 'DO IF', 'COUNTIF', 'VLOOKUP' and etc. | ||
These functions are very useful for data processing in marketing research | ||
surveys. Package intended to help people to move data | ||
processing from 'Excel' and 'SPSS' to R. | ||
VignetteBuilder: knitr | ||
LazyData: yes | ||
License: GPL (>= 2) | ||
RoxygenNote: 7.0.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,89 +1,89 @@ | ||
#' Add caption to the table | ||
#' | ||
#' To drop caption use \code{set_caption} with \code{caption = NULL}. Captions | ||
#' are supported by \link{htmlTable.etable}, \link{xl_write} and | ||
#' \link{as.datatable_widget} functions. | ||
#' @param obj object of class \code{etable} - result of \code{cro_cpct} and etc. | ||
#' @param caption character caption for the table. | ||
#' | ||
#' @return object of class \code{with_caption}. | ||
#' @examples | ||
#' | ||
#' data(mtcars) | ||
#' mtcars = apply_labels(mtcars, | ||
#' vs = "Engine", | ||
#' vs = num_lab(" | ||
#' 0 V-engine | ||
#' 1 Straight engine | ||
#' "), | ||
#' am = "Transmission", | ||
#' am = num_lab(" | ||
#' 0 Automatic | ||
#' 1 Manual | ||
#' ") | ||
#' ) | ||
#' tbl_with_caption = calc_cro(mtcars, am, vs) %>% | ||
#' set_caption("Table 1. Type of transimission.") | ||
#' | ||
#' tbl_with_caption | ||
#' | ||
#' @export | ||
set_caption <- function (obj, caption) UseMethod("set_caption") | ||
|
||
|
||
#' @export | ||
set_caption.etable = function(obj, caption){ | ||
if(length(caption)==0) { | ||
attr(obj, "caption") = NULL | ||
obj = remove_class(obj, "with_caption") | ||
} else { | ||
attr(obj, "caption") = caption | ||
obj = add_class(obj, "with_caption") | ||
} | ||
obj | ||
} | ||
|
||
#' @export | ||
set_caption.huxtable = function(obj, caption){ | ||
huxtable::set_caption(obj, caption) | ||
} | ||
##################### | ||
|
||
|
||
#' @rawNamespace if(getRversion() >= "3.6.0") { | ||
#' S3method(huxtable::"caption<-", etable) | ||
#' } else { | ||
#' export("caption.etable<-") | ||
#' } | ||
'caption<-.etable' <- function (obj, value) { | ||
expss::set_caption(obj, value) | ||
} | ||
|
||
|
||
|
||
|
||
|
||
####################### | ||
#' @export | ||
#' @rdname set_caption | ||
get_caption <- function (obj) UseMethod("get_caption") | ||
|
||
#' @export | ||
get_caption.etable = function(obj){ | ||
attr(obj, "caption", exact = TRUE) | ||
} | ||
|
||
#' @rawNamespace if(getRversion() >= "3.6.0") { | ||
#' S3method(huxtable::caption, etable) | ||
#' } else { | ||
#' export(caption.etable) | ||
#' } | ||
caption.etable = get_caption | ||
|
||
############ | ||
|
||
#' @export | ||
#' @rdname set_caption | ||
is.with_caption = function(obj){ | ||
inherits(obj, "with_caption") | ||
#' Add caption to the table | ||
#' | ||
#' To drop caption use \code{set_caption} with \code{caption = NULL}. Captions | ||
#' are supported by \link{htmlTable.etable}, \link{xl_write} and | ||
#' \link{as.datatable_widget} functions. | ||
#' @param obj object of class \code{etable} - result of \code{cro_cpct} and etc. | ||
#' @param caption character caption for the table. | ||
#' | ||
#' @return object of class \code{with_caption}. | ||
#' @examples | ||
#' | ||
#' data(mtcars) | ||
#' mtcars = apply_labels(mtcars, | ||
#' vs = "Engine", | ||
#' vs = num_lab(" | ||
#' 0 V-engine | ||
#' 1 Straight engine | ||
#' "), | ||
#' am = "Transmission", | ||
#' am = num_lab(" | ||
#' 0 Automatic | ||
#' 1 Manual | ||
#' ") | ||
#' ) | ||
#' tbl_with_caption = calc_cro(mtcars, am, vs) %>% | ||
#' set_caption("Table 1. Type of transimission.") | ||
#' | ||
#' tbl_with_caption | ||
#' | ||
#' @export | ||
set_caption <- function (obj, caption) UseMethod("set_caption") | ||
|
||
|
||
#' @export | ||
set_caption.etable = function(obj, caption){ | ||
if(length(caption)==0) { | ||
attr(obj, "caption") = NULL | ||
obj = remove_class(obj, "with_caption") | ||
} else { | ||
attr(obj, "caption") = caption | ||
obj = add_class(obj, "with_caption") | ||
} | ||
obj | ||
} | ||
|
||
#' @export | ||
set_caption.huxtable = function(obj, caption){ | ||
huxtable::set_caption(obj, caption) | ||
} | ||
##################### | ||
|
||
|
||
#' @rawNamespace if(getRversion() >= "3.6.0") { | ||
#' S3method(huxtable::"caption<-", etable) | ||
#' } else { | ||
#' export("caption<-.etable") | ||
#' } | ||
'caption<-.etable' <- function (obj, value) { | ||
expss::set_caption(obj, value) | ||
} | ||
|
||
|
||
|
||
|
||
|
||
####################### | ||
#' @export | ||
#' @rdname set_caption | ||
get_caption <- function (obj) UseMethod("get_caption") | ||
|
||
#' @export | ||
get_caption.etable = function(obj){ | ||
attr(obj, "caption", exact = TRUE) | ||
} | ||
|
||
#' @rawNamespace if(getRversion() >= "3.6.0") { | ||
#' S3method(huxtable::caption, etable) | ||
#' } else { | ||
#' export(caption.etable) | ||
#' } | ||
caption.etable = get_caption | ||
|
||
############ | ||
|
||
#' @export | ||
#' @rdname set_caption | ||
is.with_caption = function(obj){ | ||
inherits(obj, "with_caption") | ||
} |