Skip to content

Commit

Permalink
Fixes for CRAN
Browse files Browse the repository at this point in the history
  • Loading branch information
coolbutuseless committed May 27, 2024
1 parent f9e4ed8 commit 004f540
Show file tree
Hide file tree
Showing 18 changed files with 68 additions and 88 deletions.
2 changes: 2 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@
^LICENSE\.md$
^.devcontainer$
^man/figures$
^doc$
^Meta$
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ doc
Meta
pkgdown
working
/doc/
/Meta/
15 changes: 7 additions & 8 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
Package: emphatic
Type: Package
Title: Tools for Exploratory Analysis of Tabular Data using Colour Highlighting
Version: 0.1.7
Title: Exploratory Analysis of Tabular Data using Colour Highlighting
Version: 0.1.8
Authors@R: c(
person("Mike", "Cheng", role = c("aut", "cre", 'cph'), email = "[email protected]")
)
Maintainer: Mike Cheng <[email protected]>
Description: Tools for exploratory analysis of tabular data using colour
highlighting. By specifying a palette and row/column positions, data-dependent
colouring can be applied to data.frames in a pipe-friendly
manner. Highlighting is displayed in any console supporting ANSI
colouring. Quarto and Rmarkdown rendering are also supported. It is
also possible to add colour to regular expression matches and
highlight differences between two objects.
highlighting. Highlighting is displayed in any console supporting 'ANSI'
colours, and can be converted to 'HTML', 'typst', 'latex' and 'SVG'.
'quarto' and 'rmarkdown' rendering are directly supported. It is
also possible to add colour to regular expression matches and
highlight differences between two arbitrary R objects.
URL: https://coolbutuseless.github.io/package/emphatic/, https://github.com/coolbutuseless/emphatic
BugReports: https://github.com/coolbutuseless/emphatic/issues
License: MIT + file LICENSE
Expand Down
10 changes: 10 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@

# emphatic 0.1.8 2024-05-28

* Fixes for CRAN
* Shorter 'Title' field. Drop "Tools for" to make it under 65 chars.
* 'rmarkdown' and 'quarto' in 'Description' field are now
quoted, and match the case for the actual package.
* Remove extra spaces at start of continuation lines in 'Description' field.
* Added documentation on return values for `is_emphatic` and `print_emphatic`
* There are no references for this package.

# emphatic 0.1.7 2024-05-26

* Support for conversion to `typst`, `latex`, `html`, `svg` and `Excel`
Expand Down
2 changes: 0 additions & 2 deletions R/core-svg.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
#' @inheritParams as_svg_anim
#' @param width,height viewBox dimensions for SVG
#'
#' @return character string containing an SVG snippet.
#'
#' @return Character string containing SVG representation
#'
#' @export
Expand Down
3 changes: 3 additions & 0 deletions R/core.R
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ get_legends <- function(.data) {
#'
#' @param x Object to test
#'
#' @return Logical value
#' @export
#' @examples
#' mtcars |>
Expand Down Expand Up @@ -190,6 +191,7 @@ is_emphatic <- function(x) {
#' @inheritParams hl_opts
#' @inheritParams as.character.emphatic
#'
#' @return None.
#' @export
#' @examples
#' mtcars |>
Expand Down Expand Up @@ -659,6 +661,7 @@ calc_contrasting_text <- function(fill, text_contrast) {
#'
#' @importFrom grDevices col2rgb convertColor rgb
#'
#' @return colour
#' @noRd
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
interp_colour <- function(colour1, colour2, frac) {
Expand Down
4 changes: 4 additions & 0 deletions R/hl-dataframe.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
#' combinations of the specified rows and columns will be highlighted.
#' Otherwise the locations are
#' created using a simpler call to \code{cbind()}.
#'
#' @return emphatic object
#' @noRd
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
hl_loc <- function(.data, palette, row_ids, col_ids, elem = 'fill', major = 'row', expand_grid = TRUE) {

Expand Down Expand Up @@ -94,6 +97,7 @@ hl_loc <- function(.data, palette, row_ids, col_ids, elem = 'fill', major = 'row
#' @param column Single numeric index of the column to colour
#' @param dest_col_ids column ids to apply highlighting to
#'
#' @return emphatic object
#' @noRd
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
hl_inner <- function(.data, palette, row_ids, column, dest_col_ids, elem, show_legend) {
Expand Down
13 changes: 12 additions & 1 deletion R/hl-diff.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,20 @@
#' operations. If \code{NULL}, then colours which contrast with \code{fill} will
#' be chosen automatically
#' @param ... further arguments passed to \code{adist()}
#' @inheritParams coerce_to_string
#' @param sep character string of the line separating the two objects. Default: \code{NULL}
#' for no separation. Use the empty string to insert an empty line.
#' @param coerce How should non-character arguments be coerced to character strings?
#' \describe{
#' \item{default}{ - the given object \code{x} must already be a character string}
#' \item{character}{ - performs the matching after first calling
#' \code{as.character(x)}}
#' \item{print}{ - performs the matching against the default
#' \code{print(x)} output}
#' \item{deparse}{ - performs the matching after first calling
#' \code{deparse1(x)}}
#' \item{str}{ - performs the matching on the output of calling
#' \code{str(x)}}
#' }
#' @inheritParams hl_grep
#'
#' @return list of 'emphatic' objects which could be rendered to ANSI (for example)
Expand Down
14 changes: 12 additions & 2 deletions R/hl-grep.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,18 @@
#' will be seleted which contrasts with the \code{fill} colour.
#' @param ... extra args passed to \code{gsub}
#' @param perl logical. use perl style regex. default: TRUE
#' @inheritParams coerce_to_string
#' @inheritParams hl_diff
#' @param coerce How should non-character arguments be coerced to character strings?
#' \describe{
#' \item{default}{ - the given object \code{x} must already be a character string}
#' \item{character}{ - performs the matching after first calling
#' \code{as.character(x)}}
#' \item{print}{ - performs the matching against the default
#' \code{print(x)} output}
#' \item{deparse}{ - performs the matching after first calling
#' \code{deparse1(x)}}
#' \item{str}{ - performs the matching on the output of calling
#' \code{str(x)}}
#' }
#' @param opts create options list
#'
#' @return An emphatic object suitable to output to console (for example)
Expand Down
1 change: 1 addition & 0 deletions R/hl-mat.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#' @param byrow if replication of the selection is required, how should the data be replicated?
#' @inheritParams hl_grep
#'
#' @return emphatic object
#' @noRd
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
hl_mat <- function(.data, colour, selection = NULL, elem = 'fill',
Expand Down
1 change: 1 addition & 0 deletions R/legend.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#' @param label label name to prefix legend. default NULL
#' @inheritParams as_character_inner
#'
#' @return rendered text for legend
#' @noRd
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
create_legend_string <- function(
Expand Down
2 changes: 1 addition & 1 deletion R/utils-index-lookup.R
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ gen_n_col <- function(.data) {
#' @param .data data.frame
#' @param expr an expression wihch will be interpreted as indices
#' @param axis 'row' or 'column' expression?
#'
#' @return IDs matching the given expression
#' @noRd
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
loc_expr_to_ids <- function(.data, expr, axis) {
Expand Down
9 changes: 7 additions & 2 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#'
#' @param x,y R objects
#'
#' @return x if not null else y
#' @noRd
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'%||%' <- function(x, y) {
Expand All @@ -20,6 +21,7 @@
#'
#' @param x R object
#'
#' @return logical
#' @noRd
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
is_atomic <- function(x) {
Expand All @@ -31,7 +33,7 @@ is_atomic <- function(x) {
# Really is a 2d matrix, not an array
#'
#' @param x R object
#'
#' @return logical
#' @noRd
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
is_matrix <- function(x) {
Expand All @@ -44,7 +46,7 @@ is_matrix <- function(x) {
#'
#' @param total_len the total length of the sequence
#' @param chunk_len the length of each chunk
#'
#' @return list of chunked indices
#' @noRd
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
chunked_indices <- function(total_len, chunk_len) {
Expand All @@ -69,6 +71,9 @@ chunked_indices <- function(total_len, chunk_len) {
#' \item{str}{ - performs the matching on the output of calling
#' \code{str(x)}}
#' }
#'
#' @return single character string representing the object
#' @noRd
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
coerce_to_string <- function(x, coerce) {
switch(
Expand Down
2 changes: 0 additions & 2 deletions man/as_svg.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 0 additions & 27 deletions man/coerce_to_string.Rd

This file was deleted.

43 changes: 0 additions & 43 deletions man/hl_loc.Rd

This file was deleted.

3 changes: 3 additions & 0 deletions man/is_emphatic.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions man/print.emphatic.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 004f540

Please sign in to comment.