tab.rename {RGeostats} | R Documentation |
Naming convention for naming convention in Db
tab.rename(x, nvar = 1, rank = 1, db = NA, radix = NA, midtype = NA, midname = NA, midloc = "z", midvar0 = 1, midsep="", fintype = NA, finname = NA, finloc = "z", finvar0 = 1, finsep="")
x |
This argument can be either:
This container has several variables whose names must be modified here. |
nvar |
Number of variables to be added |
rank |
Rank of the first variable to be named |
db |
A |
radix |
Radix string |
midtype |
Type of the middle part of the encoded name |
midname |
Name for the middle part of the encoded name |
midloc |
Locator for the middle part of the encoded name |
midvar0 |
Starting index for the middle part of the encoded name |
midsep |
Separator added between 'midname' and 'ivar' (only used when abs(midtype) = 1) |
fintype |
Type of the ending part of the encoded name |
finname |
Name of the ending part of the encoded name |
finloc |
Locator for the ending part of the encoded name |
finvar0 |
Starting index for the ending part of the encoded name |
finsep |
Separator added between 'finname' and 'ivar' (only used when abs(fintype) = 1) |
This procedure renames the 'nvar' columns of a data.frame, starting from the column 'rank'. The name is composed according to the following rule.
The encoded name is of the form: 'radix'.'mid'.'end'. The two parts ('mid' and 'end') are constructed in the same manner: the description is given for a generic part called 'part'.
The 'radix' is simply duplicated from the argument 'radix'. If not defined, the following separator is skipped.
For the construction of each 'part, we use the relevant parameter 'part'type, 'part'name, 'part'loc, 'part'var0 and 'part'sep. The algorithm needs the definition of the index 'ivar' which varies 'var0' to 'var0 + nvar'. The algorithm is as follows, according to the value of 'part'type:
NA The part name (and the following delimitor "." are skipped). This is the default option.
0 'part' is set to 'name'
-1 'part' is set to 'name”var0'
+1 'part' is set to 'name”ivar'
-2 'part' is set to the name of the variable in 'db' which has the locator 'loc' with a rank equal to 'var0'
+2 'part' is set to the name of the variable in 'db' which has the locator 'loc' with a rank equal to 'ivar'
For the two last cases, note that if 'loc' is left to NA, the absolute rank of the variable is used (instead of the rank of the locator).
The output has the same structure as the input (i.e. a
db-class
or a data frame) where the variables have been
renamed.