Skip to content

Commit

Permalink
Fix last bugs before release
Browse files Browse the repository at this point in the history
  • Loading branch information
gdemin committed Nov 27, 2019
1 parent e66d54d commit ac94486
Show file tree
Hide file tree
Showing 3 changed files with 138 additions and 137 deletions.
97 changes: 49 additions & 48 deletions DESCRIPTION
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
2 changes: 1 addition & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -735,7 +735,7 @@ export(xl_write)
if(getRversion() >= "3.6.0") {
S3method(huxtable::"caption<-", etable)
} else {
export("caption.etable<-")
export("caption<-.etable")
}
if(getRversion() >= "3.6.0") {
S3method(huxtable::as_huxtable, etable)
Expand Down
176 changes: 88 additions & 88 deletions R/caption.R
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")
}

0 comments on commit ac94486

Please sign in to comment.