|
CHARACTER CODEName:
command. This command stores the character fields in the file "dpchzf.dat". The two primary uses of character data are:
In the context of Dataplot, we can use groups in two contexts.
The CHARACTER CODE command identifies the unique rows in the character variable (Dataplot checks for exact matches, it does not try to guess if a typo has occurred, etc.). If there are K unique rows, Dataplot will generate coded values as the integer values from 1 to K. The CHARACTER CODE performs the coding in the order that the unique rows are encoutered in the file. The ALPHABETIC CHARACTER CODE is a variant of the CHARACTER CODE command that sorts the unique character rows and assigns the code based on the alphabetic order of the character rows. There may be some cases where we want to control the mapping from the character variable to the coded numeric variable. The REFERENCE CHARACTER CODE can be used in this case. We define a group label variable that defines the desired ordering. The numeric coding is then based on the ordering given with the group label variable. This is demonstrated in the Program 2 example below.
where <ix> specifies the name of the character variable in the file dpzchf.dat; and <y> specifies the name for the coded numberic variable to be saved. The character variable is originally created with a READ command where the SET CONVERT CHARACTER ON was entered prior to the READ.
where <ix> specifies the name of the character variable in the file dpzchf.dat; and <y> specifies the name for the coded numberic variable to be saved. The character variable is originally created with a READ command where the SET CONVERT CHARACTER ON was entered prior to the READ. This syntax assigns the codes based on the alphabetic order of the character variable.
where <ix> specifies the name of the character variable in the file dpzchf.dat; <ig> specifies the name of a previously created group label variable; and <y> specifies the name for the coded numberic variable to be saved. The character variable is originally created with a READ command where the SET CONVERT CHARACTER ON was entered prior to the READ. This syntax assigns the codes based on the ordering in the group label variable.
READ TEST.DAT Y X IX LET Y = CHARACTER CODE IX
2018/06: Support for the REFERENCE CHARACTER CODE case
set convert character on
skip 25
read draft69c.dat rank day month
.
let ig = group label month
x1tic mark label format group label
x1tic mark label content ig
x1tic mark label font simplex
x1tic mark label angle 45
x1tic mark label displacement 10
let xcode = character code month
.
major xtic mark number 12
minor xtic mark number 0
xlimits 1 12
xtic offset 0.5 0.5
.
char box plot
line box plot
fences on
.
box plot rank xcode
Program 2:
skip 1
set convert character on
read refcode.dat comp method lab ymean ysd ni
set convert character off
skip 0
.
. Step 2: Create coded values
.
let string l1 = NIST
let string l2 = CTL
let il = group label l1 l2
.
let string m1 = XRF
let string m2 = TGA
let string m3 = ISE
let string m4 = GRAV
let string m5 = ICP
let im = group label m1 to m5
.
let string c1 = ZnO
let string c2 = Cl
let string c3 = LOI220
let string c4 = LOI550
let string c5 = LOI950
let string c6 = Na2O
let string c7 = MgO
let string c8 = Al2O3
let string c9 = K2O
let string c10 = TiO2
let string c11 = Cr2O3
let string c12 = Mn2O3
let string c13 = Fe2O3
let string c14 = SO3
let string c15 = SiO2
let string c16 = P2O5
let string c17 = CaO
let string c18 = SrO
let string c19 = BaO
let ic = group label c1 to c19
.
let ycomp = reference character code comp ic
let ymeth = reference character code method im
let ylab = reference character code lab il
status f
print il im ic
.
set write decimals 0
print ycomp ymeth ylab
The following output is returned
---------------------------------------------
YCOMP YMETH YLAB
---------------------------------------------
1 1 1
1 1 2
2 1 1
2 3 2
5 2 1
5 2 2
4 2 1
4 2 2
3 2 1
3 2 2
6 1 1
6 1 2
6 5 2
7 1 1
7 1 2
7 5 2
8 1 1
8 1 2
8 5 2
9 1 1
9 1 2
9 5 2
10 1 1
10 1 2
10 5 2
11 1 1
11 1 2
11 5 2
12 1 1
12 1 2
12 5 2
13 1 1
13 1 2
13 5 2
14 1 1
14 1 2
14 5 2
14 4 2
15 1 1
15 1 2
15 4 2
16 1 1
16 1 2
16 4 2
17 1 1
17 1 2
17 5 2
17 4 2
18 1 1
18 1 2
18 5 2
19 1 1
19 1 2
19 5 2
|
Privacy
Policy/Security Notice
NIST is an agency of the U.S.
Commerce Department.
Date created: 02/03/2004 | ||||||||||||||||