Learn R Programming

NMF (version 0.5.06)

options: Package Specific Option Management

Description

Allow the user to get/set/define package NMF specific options in the same way as with base functions options and getOption.

Usage

nmf.options(..., runtime = FALSE)
nmf.getOption(name)
nmf.options.reset()
nmf.options.runtime()

Arguments

...
any options can be defined, using 'name = value' or by passing a list of such tagged values. However, only the ones below are used in package NMF. Further, 'nmf.options('name') == nmf.options()['name']', see the example.
name
a character string holding an option name.
runtime
a boolean used to specify if main interface function nmf should store the option into the initial NMF object before performing the computation.

Value

  • For nmf.getOption, the current value set for option name, or NULL if the option is unset. For nmf.options(), a list of all set options sorted by name. For options(name), a list of length one containing the set value, or NULL if it is unset. For uses setting one or more options, a list with the previous values of the options changed (returned invisibly).

Details

[object Object],[object Object],[object Object]

See Also

options

Examples

Run this code
# save all options value 
	op <- nmf.options(); 
	utils::str(op) # op may contain functions.

    nmf.getOption("track.interval") == nmf.options()$track.interval # the latter needs more memory
    
    x <- matrix(runif(50*10), 50, 10) # create a random target matrix
    # or define a synthetic data with a hidden pattern using function syntheticNMF (see ?syntheticNMF) 
    x <- syntheticNMF(50, 5, 10, noise=TRUE)
    
    # perform default NMF computation
    res <- nmf(x, 3)
    
    # Toogle on verbose mode
    nmf.options(verbose = TRUE)    
    res <- nmf(x, 3)    

	# Toogle on debug mode
    nmf.options(debug = TRUE)    
    res <- nmf(x, 3)

    # set the error track step size, and save previous value
    old.o <- nmf.options(track.interval = 5)
    old.o
    
    # check options
    utils::str(nmf.options())
    # reset to default values
    nmf.options.reset()
    utils::str(nmf.options())

Run the code above in your browser using DataLab