Skip to content

Commit 697ad64

Browse files
committed
Update comments and improve output formatting for clarity
1 parent 13f2a92 commit 697ad64

File tree

7 files changed

+17
-39
lines changed

7 files changed

+17
-39
lines changed

R/01_S7_Hyperparameters.R

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ TUNED_STATUS_TUNED <- 1L
2323

2424
# `resampled` values ----
2525
# 0: Running on single training set.
26-
# 1: Running on cross-validated training sets.
26+
# 1: Running on resampled training sets.
2727

2828
#' @title Hyperparameters
2929
#'
@@ -32,10 +32,11 @@ TUNED_STATUS_TUNED <- 1L
3232
#'
3333
#' @field algorithm Character: Algorithm name.
3434
#' @field hyperparameters Named list of algorithm hyperparameter values.
35-
#' @field tuned Integer: Tuning status.
36-
#' @field resampled Integer: Cross-validation status.
3735
#' @field tunable_hyperparameters Character: Names of tunable hyperparameters.
3836
#' @field fixed_hyperparameters Character: Names of fixed hyperparameters.
37+
#' @field tuned Integer: Tuning status.
38+
#' @field resampled Integer: Outer resampling status.
39+
#' @field n_workers Integer: Number of workers to use for tuning.
3940
#'
4041
#' @author EDG
4142
#' @noRd

R/14_S7_utils.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ print.CheckData <- function(
401401
} else {
402402
out <- paste(
403403
out,
404-
bold(green(" * Everything looks good")),
404+
bold(highlight(" * Everything looks good")),
405405
sep = "\n"
406406
)
407407
}

R/read.R

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ read <- function(
102102
check_dependencies("arrow")
103103
if (verbosity > 0L) {
104104
msg0(
105-
bold(green("\u25B6")),
105+
bold(highlight("\u25B6")),
106106
" Reading ",
107107
highlight(basename(path)),
108108
" using arrow::read_parquet()..."
@@ -113,7 +113,7 @@ read <- function(
113113
} else if (ext == "rds") {
114114
if (verbosity > 0L) {
115115
msg0(
116-
bold(green("\u25B6")),
116+
bold(highlight("\u25B6")),
117117
" Reading ",
118118
highlight(basename(path)),
119119
"..."
@@ -124,7 +124,7 @@ read <- function(
124124
check_dependencies("openxlsx")
125125
if (verbosity > 0L) {
126126
msg0(
127-
bold(green("\u25B6")),
127+
bold(highlight("\u25B6")),
128128
" Reading ",
129129
highlight(basename(path)),
130130
" using readxl::read_excel()..."
@@ -141,7 +141,7 @@ read <- function(
141141
check_dependencies("haven")
142142
if (verbosity > 0L) {
143143
msg0(
144-
bold(green("\u25B6")),
144+
bold(highlight("\u25B6")),
145145
" Reading ",
146146
highlight(basename(path)),
147147
" using haven::read_dta()..."
@@ -153,7 +153,7 @@ read <- function(
153153
check_dependencies("seqinr")
154154
if (verbosity > 0L) {
155155
msg0(
156-
bold(green("\u25B6")),
156+
bold(highlight("\u25B6")),
157157
" Reading ",
158158
highlight(basename(path)),
159159
" using seqinr::read.fasta()..."
@@ -169,7 +169,7 @@ read <- function(
169169
check_dependencies("farff")
170170
if (verbosity > 0L) {
171171
msg0(
172-
bold(green("\u25B6")),
172+
bold(highlight("\u25B6")),
173173
" Reading ",
174174
highlight(basename(path)),
175175
" using farff::readARFF()..."
@@ -180,7 +180,7 @@ read <- function(
180180
} else {
181181
if (verbosity > 0L) {
182182
msg0(
183-
bold(green("\u25B6")),
183+
bold(highlight("\u25B6")),
184184
" Reading ",
185185
highlight(basename(path)),
186186
" using ",
@@ -332,7 +332,7 @@ msgread <- function(x, caller = "", use_basename = TRUE) {
332332
x <- basename(x)
333333
}
334334
msg0(
335-
bold(green("\u25B6")),
335+
bold(highlight("\u25B6")),
336336
" Reading ",
337337
highlight(x),
338338
"...",

R/utils_data.table.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ dt_merge <- function(
163163
)
164164
if (left_on == right_on) {
165165
msg0(
166-
bold(green(icon)),
166+
bold(highlight(icon)),
167167
" Merging ",
168168
highlight(left_name),
169169
" & ",
@@ -174,7 +174,7 @@ dt_merge <- function(
174174
)
175175
} else {
176176
msg0(
177-
bold(green(icon)),
177+
bold(highlight(icon)),
178178
" Merging ",
179179
highlight(left_name),
180180
" & ",

R/utils_duckdb.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,14 +81,14 @@ ddb_data <- function(
8181
fileext <- tools::file_ext(path)
8282

8383
out <- paste(
84-
bold(green("\u25B6")),
84+
bold(highlight("\u25B6")),
8585
ifelse(collect, "Reading", "Lazy-reading"),
8686
highlight(basename(path))
8787
)
8888
if (!is.null(filter_column)) {
8989
out <- paste(
9090
out,
91-
bold(green("\u29e8")),
91+
bold(highlight("\u29e8")),
9292
"filtering on",
9393
bold(filter_column)
9494
)

R/utils_print.R

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -867,20 +867,6 @@ list2html <- function(
867867
} # /rtemis::list2html
868868

869869

870-
#' @author EDG
871-
#' @keywords internal
872-
#' @noRd
873-
printchar <- function(x, left_pad = 2) {
874-
target_length <- left_pad + max(nchar(x))
875-
for (i in x) {
876-
cat(
877-
highlight(leftpad(i, target_length)),
878-
"\n"
879-
)
880-
}
881-
} # /rtemis::printchar
882-
883-
884870
# Helper function to build padded string equivalent of padcat
885871
show_padded <- function(
886872
text,

R/utils_strings.R

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -230,15 +230,6 @@ clean_colnames <- function(x) {
230230
}
231231

232232

233-
leftpad <- function(x, target_length, pad_char = " ") {
234-
lpad <- target_length - nchar(x)
235-
if (lpad > 0) {
236-
paste0(paste0(rep(pad_char, lpad), collapse = ""), x)
237-
} else {
238-
x
239-
}
240-
}
241-
242233
#' Force plain text when using `message()`
243234
#'
244235
#' @param x Character: Text to be output to console.

0 commit comments

Comments
 (0)