Deleting Octave Variables

Description

Deletes variables from Octave global context.

The function o_rm is an alias to o_clear.

Usage

o_clear(..., all = FALSE, options)

o_rm(..., all = FALSE, options)

Arguments

...
names or pattern of the variables to delete, as character strings.
all
a logical indicating whether all user-defined objects should be deleted. See section Octave Documentation for details.
options
options passed to Octave function clear. See section Octave Documentation.

Value

None

Octave Documentation for <em>clear</em>

 -- Command: clear [options] pattern ...
     Delete the names matching the given patterns from the symbol table.
     The pattern may contain the following special characters:

     '?'
          Match any single character.

     '*'
          Match zero or more characters.

     '[ LIST ]'
          Match the list of characters specified by LIST.  If the first
          character is '!' or '^', match all characters except those
          specified by LIST.  For example, the pattern '[a-zA-Z]' will
          match all lowercase and uppercase alphabetic characters.

     For example, the command

          clear foo b*r

     clears the name 'foo' and all names that begin with the letter 'b'
     and end with the letter 'r'.

     If 'clear' is called without any arguments, all user-defined
     variables (local and global) are cleared from the symbol table.  If
     'clear' is called with at least one argument, only the visible
     names matching the arguments are cleared.  For example, suppose you
     have defined a function 'foo', and then hidden it by performing the
     assignment 'foo = 2'.  Executing the command 'clear foo' once will
     clear the variable definition and restore the definition of 'foo'
     as a function.  Executing 'clear foo' a second time will clear the
     function definition.

     The following options are available in both long and short form
     '-all, -a'
          Clears all local and global user-defined variables and all
          functions from the symbol table.

     '-exclusive, -x'
          Clears the variables that don't match the following pattern.

     '-functions, -f'
          Clears the function names and the built-in symbols names.

     '-global, -g'
          Clears the global symbol names.

     '-variables, -v'
          Clears the local variable names.

     '-classes, -c'
          Clears the class structure table and clears all objects.

     '-regexp, -r'
          The arguments are treated as regular expressions as any
          variables that match will be cleared.
     With the exception of 'exclusive', all long options can be used
     without the dash as well.

[Generated from Octave-3.6.4 on 2014-05-21 11:08:11 ]

Examples


## Don't show: 
# roxygen generated flag
options(R_CHECK_RUNNING_EXAMPLES_=TRUE)
## End Don't show

## Don't show: 
 o_clear() 
## End Don't show
# Assign a variable in Octave
o_assign('a', 10)
o_who()
## [1] "a"
## Don't show: 
 identical(o_who(), 'a') 
## [1] TRUE
## End Don't show
# Clear
o_clear()
o_who()
## character(0)
## Don't show: 
 identical(o_who(), character()) 
## [1] TRUE
## End Don't show

# Assign other variables in Octave
.O$a <- 10
.O$b <- 100
.O$ba <- 1000
o_who()
## [1] "a"  "b"  "ba"
o_get()
## $a
## [1] 10
## 
## $b
## [1] 100
## 
## $ba
## [1] 1000
## Don't show: 
 identical(o_who(), c('a', 'b', 'ba')) 
## [1] TRUE
## End Don't show

# Clear variable starting with 'b'
o_clear('b*')
o_who()
## [1] "a"
## Don't show: 
 identical(o_who(), 'a') 
## [1] TRUE
## End Don't show