Browse Source

Add function to print an object

master
Maxime Wack 3 years ago
parent
commit
71142e3a4b
1 changed files with 30 additions and 0 deletions
  1. +30
    -0
      functions.Rmd

+ 30
- 0
functions.Rmd View File

@@ -157,6 +157,36 @@ print_environment <- function(env)
}
```

### Objects

```{r print object}
##' Print an object
##'
##' Display the fullname of an object,
##' the type, and the name with the size
##'
##' If the parent is "" then it is a base name,
##' else we construct the fullname by subsetting by name/position
##' Thus the caller needs to build the object name accordingly.
##' @title Print an object
##' @param object The object to print as a quoted string or index position
##' @param parent The parent object
##' @return The line to print to the buffer
print_object <- function(object, parent = "")
{
full_name <- get_fullname(object, parent)
type <- get_type(full_name)

paste0(full_name,
"|",
type,
"| ",
get_name(object),
" (",
get_size(full_name, type),
")")
}
```
# List objects

## Packages


Loading…
Cancel
Save