R/print.R

Defines functions print.StataID str.StataMatrix str.Stata_b_se print.StataErrorNumber print.StataResults print.StataLog

#' @export
print.StataLog <- function(log) {
	cat(log, sep='\n')
	invisible(log)
}

#' @export
print.StataResults <- function(res) {
	str(res)
	invisible(res)
}

#' @export
print.StataErrorNumber <- function(res) {
	str(res)
	invisible(res)
}

#' @export
str.Stata_b_se <- function(res, ...) {
	print(res)
	cat('\n')
}

#' @export
str.StataMatrix <- function(res, ...) {
	cat('\n')
	print(res)
	cat('\n')
}

#' @export
print.StataID <- function(id) {
	cat('StataID object:\n')
	cat('\n Stata "server" id:\n', names(id), '\n (you can see it in the top of the Stata window)\n')
	cat('\n Full path to the Stata "server" <--> R\n data exchange directory (folder):\n', unclass(id), '\n')
	cat('\n Should Stata close if this directory disappears:\n',
		ifelse(attr(id, 'exit_on_error601'), 'yes', 'no'), '\n\n')
	invisible(id)
}
alekrutkowski/RStataLink documentation built on March 22, 2023, 2:18 a.m.