Skip to content

Commit 074a6d2

Browse files
Copilotosorensen
andcommitted
Improve formatting with consistent sprintf alignment
Co-authored-by: osorensen <21175639+osorensen@users.noreply.github.com>
1 parent b79b992 commit 074a6d2

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

R/print.R

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,15 +64,15 @@ print.BayesMallowsSMC2 <- function(x, ...) {
6464
cat(strrep("=", nchar("BayesMallowsSMC2 Model")), "\n\n", sep = "")
6565

6666
# Display basic information
67-
cat("Number of particles: ", n_particles, "\n", sep = "")
68-
cat("Number of timepoints: ", n_timepoints, "\n", sep = "")
69-
cat("Number of items: ", n_items, "\n", sep = "")
70-
cat("Number of clusters: ", n_clusters, "\n\n", sep = "")
67+
cat(sprintf("%-25s %s\n", "Number of particles:", n_particles))
68+
cat(sprintf("%-25s %s\n", "Number of timepoints:", n_timepoints))
69+
cat(sprintf("%-25s %s\n", "Number of items:", n_items))
70+
cat(sprintf("%-25s %s\n\n", "Number of clusters:", n_clusters))
7171

7272
# Display model fit information
73-
cat("Log marginal likelihood: ", sprintf("%.2f", x$log_marginal_likelihood), "\n", sep = "")
74-
cat("Final ESS: ", sprintf("%.2f", x$ESS[n_timepoints]), "\n", sep = "")
75-
cat("Resampling events: ", n_resampling_events, "/", n_timepoints, "\n", sep = "")
73+
cat(sprintf("%-25s %.2f\n", "Log marginal likelihood:", x$log_marginal_likelihood))
74+
cat(sprintf("%-25s %.2f\n", "Final ESS:", x$ESS[n_timepoints]))
75+
cat(sprintf("%-25s %d/%d\n", "Resampling events:", n_resampling_events, n_timepoints))
7676

7777
invisible(x)
7878
}

0 commit comments

Comments
 (0)