Skip to content

Cell Mapping and Importnat Documentation Improvements #262

@awpsoras

Description

@awpsoras

Describe the bug

  1. Hux appears to coerce all columns to char - this should be stated somewhere up front in the docs, like here or here , or at least in the "getting started" article.
  2. At least one example in the by_function documentation should use basic R operations rather than more opaque, non-base functions whose application is not immediately clear (e.g., grey).
  3. Documentation for by_case recommends setting a default case but does not actually show how to set it in an example. Add an example using a simple dataframe to show how to set the default - currently this is all the reader has is TRUE ~ default, which is not very clear.

Minimal Reproducible Example

# does not highlight a where a < 7
data.frame(a = 1:10) |> 
    as_hux() |> 
    map_background_color(
        row = everywhere,
        col = "a",
        by_function(\(x) ifelse(x < 7, "red", NA))
    )

# need to add as.numeric for actual number comparison
# so hux is coercing all to char? 
data.frame(a = 1:10) |> 
    as_hux() |> 
    map_background_color(
        row = everywhere,
        col = "a",
        by_function(\(x) ifelse(as.numeric(x) < 7, "red", NA))
    )


# by_function uses a matrix as the arg from the docs
# matrix does not coerce to char by default, so hux is doing it
matrix(1:10) |> lapply(typeof) |> unique()

Expected behavior
Clear documentation with good examples - in above a < 7 should be red in the output - is not red until as.numeric was used.

I am happy to edit the documentation to improve it in these areas if requested.
Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions