Browse Source

Add doc

master
Maxime Wack 3 years ago
parent
commit
e82815cc72
1 changed files with 34 additions and 7 deletions
  1. +34
    -7
      functions.Rmd

+ 34
- 7
functions.Rmd View File

@@ -2,7 +2,7 @@
title: R object browser functions
---

# Description
# Helpers

## Get object

@@ -71,7 +71,7 @@ get_fullname <- function(identifier, parent)

## Get type

Get the type / class / mode of an object from its fullname.
Get the type / class / mode of an object given its fullname.

```{r get type}
##' Get type of an object
@@ -89,6 +89,10 @@ get_type <- function(fullname)
## Get size

Get the size of an object given its fullname.
- environments, pkg, list : length
- dataframe, matrix : ncol × nrow
- function : args
- default : length

```{r get size}
##' Get an object size
@@ -114,9 +118,15 @@ get_size <- function(fullname, type)
length(object))
}
```
## Print

### Package
# Printers

These functions return the line to print in the emacs buffer for different objects.

## Package

Print a package:
**package name**|pkg| **package name**

```{r print package}
##' Print a package
@@ -134,7 +144,10 @@ print_package <- function(pkg)
}
```

### Environment
## searchlist

Print a searchlist:
**environment name**|env| **environment name** (*number of objects in the environment*)

```{r print environment}
##' Print an environment
@@ -155,7 +168,10 @@ print_environment <- function(env)
}
```

### Objects
## Objects

Print other objects:
**object full qualifying nume**|*type*| **object name** (*number of objects in the container, dimensions for df and matrices, number of args in a function*)

```{r print object}
##' Print an object
@@ -187,10 +203,14 @@ print_object <- function(identifier, parent = "")
```
# List objects

List different objects and their contents.

## Packages

### List packages

List all installed packages.

```{r list packages}
##' List packages
##'
@@ -206,6 +226,13 @@ list_packages <- function()

### List package contents

Print all the objects in a package.
Parent is *package::*
The names are quoted.
The generic print_object function is used.

Pourrait être remplacé par list_container_contents du même trait que pour list_searchlist_contents

```{r list package contents}
##' List package contents
##'
@@ -278,7 +305,7 @@ list_searchlist_contents <- function(env)

### Fix names

Fix the names given by `ls`.
Fix the names given by `ls` and create identifiers.
If a name exists, surround it with quotes.
If a name doesn't exist, replace it by its index.



Loading…
Cancel
Save