Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't assume we are on the search list. #31

Merged
merged 1 commit into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: tables
Title: Formula-Driven Table Generation
Version: 0.9.29
Version: 0.9.30
Author: Duncan Murdoch
Description: Computes and displays complex tables of summary statistics.
Output may be in LaTeX, HTML, plain text, or an R
Expand Down
4 changes: 3 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# tables 0.9.29
# tables 0.9.30

- In a few places `len` was used instead of `length.out` in calls to
`rep()`, leading to warnings. Similarly, `rep` was used instead of
`replace` in `sample()` (issue #28).
- `tabular` assumed it was on the search list, and didn't work when
called as `tables::tabular` (issue #30).

# tables 0.9.28

Expand Down
10 changes: 8 additions & 2 deletions R/tabular.R
Original file line number Diff line number Diff line change
Expand Up @@ -628,10 +628,16 @@ tabular.formula <- function(table, data=NULL, n, suppressLabels=0, ...) {
domain = NA)
if (missing(n) && inherits(data, "data.frame"))
n <- nrow(data)

# We need access to labelSubset() (and perhaps other functions)
# when evaluating a table expression. (Issue #30)

withTableFns <- new.env(parent = if (is.environment(data)) data else environment(table))
withTableFns$labelSubset <- labelSubset
if (is.null(data))
data <- environment(table)
data <- withTableFns
else if (is.list(data))
data <- list2env(data, parent=environment(table))
data <- list2env(data, parent=withTableFns)
else if (!is.environment(data))
stop("'data' must be a dataframe, list or environment")

Expand Down
Loading