Description Usage Arguments Value Examples
setValues
sets the values of a variable in the input object.
This method creates a variable with the name VarName
with values specified in the input
Value
. If the variable is already present in the input variable, the method overwrites it.
It is also necessary to provide as input parameter an object of class DD named
newDD
with the row corresponding to the variable set with this method to be included in
the slot DD
. This row is specified as a data.table with a single row and
columns Variable, Sort, Class, Qual1-Qualn (as many as so many qualifiers are necessary) and
ValueRegExp.
Input parameters by
and lag
are optional and specify how to compute the values of
the new variable in some circunstamces.
1 2 3 4 5 6 7 | setValues(object, newDD, DDslot = "MicroData", Value, lag = NULL, by = NULL)
## S4 method for signature 'StQ,DD'
setValues(object, newDD, DDslot = "MicroData", Value, lag = NULL, by = NULL)
## S4 method for signature 'StQList,DD'
setValues(object, newDD, DDslot = "MicroData", Value, lag = NULL, by = NULL)
|
object |
Object in which to include the new variable. |
newDD |
DD object with the information of the new variable needed for the slot
|
DDslot |
Character vector of length 1 with the name of the slot of newDD in which the new
variable is defined. Its default value is |
Value |
Vector of length the number of statistical units in the input object with the values
of the new variable for each of these units or alternatively an object of class
|
lag |
Integer vector of length 1 with the lag to use when the input object is of class
StQList. Its default value is |
by |
Character vector with the names of the variables specifying those statistical units
groups under which the mathematical formula will be applied. Its default value is |
Object of the same class as the input object with the new variable included.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | ## Not run:
library(data.table)
data(ExampleStQ)
newVNCVar <- data.table(IDQual = '', NonIDQual = '', IDDD = 'lTurnover',
UnitName = '', InFiles = 'FF')
newVNC <- BuildVNC(list(MicroData = newVNCVar))
newDD <- DD(VNC = newVNC,
MicroData = data.table(Variable = 'lTurnover',
Sort = 'IDDD',
Class = 'numeric',
Length = '10',
Qual1 = 'ID',
ValueRegExp = ''))
NewQ <- setValues(object = ExampleStQ,
newDD = newDD,
DDslot = 'MicroData',
Value = log(1 + as.numeric(Turnover)))
getValues(NewQ, 'lTurnover')
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.