lset: Setting variables

View source: R/luna.R

lsetR Documentation

Setting variables

Description

Sets a (special) variable, similar to lunaC command-line options

Usage

lset(var, val = NULL)

Arguments

var

a required parameter that is either a variable name (if val is non-NULL), or a list of variable/value pairs, or a filename of a parameter file

val

if val is non-NULL, then var is interpreted as the variable name, which is set to the value of val; if val equals "." this erases the variable var

Note

The special variables sig and alias operate slightly differently with lset(), in that new values are appended to the list, rather than over-writing the existing value.

> lset("sig", "C3")
> lset("sig", "C4")

is the same as

> lset("sig", "C3, C4")

To reset any variable (including sig and alias)

> lset("sig", ".")

the lreset() function clears all variables, and resets all special variables to their default values.

Examples

## Not run: 
## these are equivalent
## % luna s.lst stage=N2 excl=arousal_standard sig=C3,C4 < cmd.txt

> lset("stage", "N2")
> lset("excl", "arousal_standard")
> lset("sig", "C3, C4")
> k <- leval(lcmd("cmd.txt"))

> lset(list(stage="N2", excl="arousal_standard", sig="C3, C4"))

## if these variables are specified in a file
> lset("files/param.txt")#'

## End(Not run)


remnrem/luna documentation built on June 1, 2025, 2:14 p.m.