Listing Objects from the Current Octave Session

Description

The function o_ls is an enhanced listing function, which also lists user-defined functions, as opposed to o_who or o_whos, which only list variables. Note that this function works properly on Octave >= 3.6.1, but is known not to list user-defined functions on Octave 3.4.1 (for some unknown reason the Octave function completion_matches does not return the names of user-defined functions).

Usage

o_ls(long = FALSE, rm.ans = TRUE)

Arguments

rm.ans
a logical that indicates if the automatic Octave variable ans should be included in the result. Default (TRUE) is not to include it.
long
logical that indicates the desired type of output: if FALSE (default) then only the names of the variables are returned (like dispatched o_who), otherwise a list with more detailed information about each variable is returned (like o_whos.

Value

a character vector or a list depending on the value of argument long.

Examples


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

## Don't show: 
 o_clear(all=TRUE) 
## End Don't show

# only variables
o_assign(list(a=1, b=2, c=5))
o_ls()
## Warning: function name 'fun1' does not agree with function file name
## '/tmp/Rtmpf8pqLM/file344cc6a2bd2/RcppOctave/scripts/ex_functions.m'
## [1] "a" "b" "c"
# compare with the output of standard Octave functions
o_who() # should be the same output
## [1] "a" "b" "c"
o_whos()
##  <Octave session: 3 object(s)>
##  name size bytes  class global sparse complex nesting persistent
##     a  1x1     8 double  FALSE  FALSE   FALSE       1      FALSE
##     b  1x1     8 double  FALSE  FALSE   FALSE       1      FALSE
##     c  1x1     8 double  FALSE  FALSE   FALSE       1      FALSE

# variables and user-defined functions
o_clear(all=TRUE) # first clear Octave session
o_source(system.file('scripts/ex_source.m', package='RcppOctave'))
o_ls()
## Warning: function name 'fun1' does not agree with function file name
## '/tmp/Rtmpf8pqLM/file344cc6a2bd2/RcppOctave/scripts/ex_functions.m'
## [1] "a"   "b"   "c"   "abc"
o_ls(long=TRUE)
##  <Octave session: 4 object(s)>
##  name size bytes    class global sparse complex nesting persistent
##     a  1x1     8   double  FALSE  FALSE   FALSE       1      FALSE
##     b  1x1     8   double  FALSE  FALSE   FALSE       1      FALSE
##     c  1x1     8   double  FALSE  FALSE   FALSE       1      FALSE
##   abc   NA    NA function   TRUE     NA      NA       1         NA
# compare with the output of standard Octave functions
o_who()
## [1] "a" "b" "c"
o_whos()
##  <Octave session: 3 object(s)>
##  name size bytes  class global sparse complex nesting persistent
##     a  1x1     8 double  FALSE  FALSE   FALSE       1      FALSE
##     b  1x1     8 double  FALSE  FALSE   FALSE       1      FALSE
##     c  1x1     8 double  FALSE  FALSE   FALSE       1      FALSE

See also

Other listoct: o_who, o_whos