Skip to content
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
8 changes: 8 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,11 @@ writeLines(pak::pkg_system_requirements("devtools", "ubuntu", "22.04"))

To remove the local virtual Python environment, delete the `r-acro` folder.
On GNU/Linux this is typically located in `~/.virtualenvs`

## CRAN Submission

A useful command to run before submitting:

```shell
R CMD build . && R CMD check --as-cran $(ls -t . | head -n1)
```
100 changes: 100 additions & 0 deletions acro_demo_2026.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
## -----------------------------------------------------------------------------
# Check if acro is installed
if (!requireNamespace("acro", quietly = TRUE)) {
# If not installed, install it
install.packages("acro")
}


## -----------------------------------------------------------------------------
library("acro")


## -----------------------------------------------------------------------------
acro_init()


## -----------------------------------------------------------------------------
data <- farff::readARFF("data/nursery.arff")
data <- as.data.frame(data)

names(data)[names(data) == "class"] <- "recommendation"


## -----------------------------------------------------------------------------
data$children <- as.numeric(as.character(data$children))
data[is.na(data)] <- round(runif(sum(is.na(data)), min = 4, max = 10), 0)
unique(data$children)


## -----------------------------------------------------------------------------
head(data)


## -----------------------------------------------------------------------------
rows <- data[, c("recommendation")]
columns <- data[, c("parents")]

table <- acro_table(index = rows, columns = columns, deparse.level = 1)
table


## -----------------------------------------------------------------------------

acro_enable_suppression()
table <- acro_table(index = rows, columns = columns, deparse.level = 1)
table


## -----------------------------------------------------------------------------
myrows <- list(data[, c("parents")], data[, c("finance")])
mycolumns <- data[, c("recommendation")]
myvalues <- data[, c("children")]
# convert the values to an array
myvalues <- matrix(myvalues, ncol = 1)


table4 <- acro_crosstab(
index = myrows,
columns = mycolumns,
values = myvalues,
aggfunc <- list("mean")
)
table4


## -----------------------------------------------------------------------------

help(package = "acro")


## -----------------------------------------------------------------------------
details <- acro_print_outputs()


## -----------------------------------------------------------------------------
acro_remove_output("output_0")


## -----------------------------------------------------------------------------
acro_rename_output("output_1", " crosstab_recommendation_vs_parents")
acro_rename_output("output_2", "mean_children_by_parents_finance_vs_recommendation")


## -----------------------------------------------------------------------------

acro_add_comments(
"mean_children_by_parents_finance_vs_recommendation",
"too few cases of recommend to report"
)


## -----------------------------------------------------------------------------
acro_custom_output("acro_demo_2026.R", "This is the code that produced this session")


## -----------------------------------------------------------------------------
myfolder <- "Routputs"
suffix <- format(Sys.time(), "%e_%m_%Y_%H_%M")
foldername <- paste(myfolder, suffix, sep = "_")
acro_finalise(foldername, ext = "json")
Loading
Loading