Skip to content

Commit

Permalink
3.2
Browse files Browse the repository at this point in the history
  • Loading branch information
haghish committed Jul 16, 2024
1 parent 85cbcfe commit c3d0630
Showing 1 changed file with 25 additions and 22 deletions.
47 changes: 25 additions & 22 deletions stata.output.r
Original file line number Diff line number Diff line change
Expand Up @@ -435,30 +435,33 @@ if (!is.null(warnings())) {
if (!exists("WARNINGS")) {
WARNINGS = NULL
summaryWarnings <- unlist(summary(warnings()))
for (loopItem in 1:length(summaryWarnings)) {
WARNINGS[loopItem] <- paste("In", toString(summaryWarnings[loopItem]), ":", names(summaryWarnings[loopItem]))
}
if (length(WARNINGS) > 0) {
if (length(WARNINGS) == 1) {
cat(paste("Warning message:\n", WARNINGS[1], "\n"))
} else {
cat(paste("\nThere were", length(WARNINGS), "unique warnings (type 'rcall warnings' to see them)\n"))
if (length(summaryWarnings) > 0) {
for (loopItem in 1:length(summaryWarnings)) {
WARNINGS[loopItem] <- paste("In", toString(summaryWarnings[loopItem]), ":", names(summaryWarnings[loopItem]))
}
}

# clean up
suppressWarnings(rm(summaryWarnings))
WARNINGS = as.matrix(WARNINGS)
}

# generate the warnings, but first make sure WARNINGS has a single column!
if (exists("WARNINGS")) {
if (ncol(WARNINGS) == 1) {
for (loopItem in 1:length(WARNINGS)) {
assign(paste0("warning",loopItem), value = WARNINGS[loopItem])

if (length(WARNINGS) > 0) {
if (length(WARNINGS) == 1) {
cat(paste("Warning message:\n", WARNINGS[1], "\n"))
} else {
cat(paste("\nThere were", length(WARNINGS), "unique warnings (type 'rcall warnings' to see them)\n"))
}
}

# clean up
suppressWarnings(rm(summaryWarnings))
WARNINGS = as.matrix(WARNINGS)

# generate the warnings, but first make sure WARNINGS has a single column!
if (exists("WARNINGS")) {
if (ncol(WARNINGS) == 1) {
for (loopItem in 1:length(WARNINGS)) {
assign(paste0("warning",loopItem), value = WARNINGS[loopItem])
}
rm(loopItem)
rm(WARNINGS)
}
}
rm(loopItem)
rm(WARNINGS)
}
}
}
Expand Down

0 comments on commit c3d0630

Please sign in to comment.