@@ -21,16 +21,16 @@ function display_matrix(M, rownames, colnames; nrow=6, ncol=6, return_matrix=fal
21
21
end
22
22
23
23
"""
24
- display_matrix(data, target_col, cue_obj , M, M_type)
24
+ display_matrix(data, target_col, cue_pS_obj , M, M_type)
25
25
26
26
Display matrix with rownames and colnames.
27
27
28
28
# Obligatory Arguments
29
29
- `data::DataFrame`: the dataset
30
30
- `target_col::Union{String, Symbol}`: the target column name
31
- - `cue_obj:: Cue_Matrix_Struct`: the cue matrix structure
31
+ - `cue_pS_obj::Union{ Cue_Matrix_Struct,PS_Matrix_Struct} `: the cue matrix or pS matrix structure
32
32
- `M::Union{SparseMatrixCSC, Matrix}`: the matrix
33
- - `M_type::Union{String, Symbol}`: the type of the matrix, currently support :C, :S, :F, :G, :Chat, :Shat, :A and :R
33
+ - `M_type::Union{String, Symbol}`: the type of the matrix, currently support :C, :S, :F, :G, :Chat, :Shat, :A, :R and :pS
34
34
35
35
# Optional Arguments
36
36
- `nrow::Int64 = 6`: the number of rows to display
@@ -47,12 +47,13 @@ JudiLing.display_matrix(latin, :Word, cue_obj, F, :F)
47
47
JudiLing.display_matrix(latin, :Word, cue_obj, Shat, :Shat)
48
48
JudiLing.display_matrix(latin, :Word, cue_obj, A, :A)
49
49
JudiLing.display_matrix(latin, :Word, cue_obj, R, :R)
50
+ JudiLing.display_matrix(latin, :Word, pS_obj, pS_obj.pS, :pS)
50
51
```
51
52
"""
52
53
function display_matrix (
53
54
data,
54
55
target_col,
55
- cue_obj ,
56
+ cue_pS_obj ,
56
57
M,
57
58
M_type;
58
59
nrow = 6 ,
@@ -62,31 +63,34 @@ function display_matrix(
62
63
63
64
if M_type == :C || M_type == " C"
64
65
rownames = data[:,target_col]
65
- colnames = [cue_obj. i2f[i] for i in 1 : size (M,2 )]
66
+ colnames = [cue_pS_obj. i2f[i] for i in 1 : size (M,2 )]
67
+ elseif M_type == :pS || M_type == " pS"
68
+ rownames = data[:,target_col]
69
+ colnames = [cue_pS_obj. i2f[i] for i in 1 : size (M,2 )]
66
70
elseif M_type == :Chat || M_type == " Chat"
67
71
rownames = data[:,target_col]
68
- colnames = [cue_obj . i2f[i] for i in 1 : size (M,2 )]
72
+ colnames = [cue_pS_obj . i2f[i] for i in 1 : size (M,2 )]
69
73
elseif M_type == :S || M_type == " S"
70
74
rownames = data[:,target_col]
71
75
colnames = [" S$i " for i in 1 : size (M,2 )]
72
76
elseif M_type == :Shat || M_type == " Shat"
73
77
rownames = data[:,target_col]
74
78
colnames = [" S$i " for i in 1 : size (M,2 )]
75
79
elseif M_type == :F || M_type == " F"
76
- rownames = [cue_obj . i2f[i] for i in 1 : size (M,1 )]
80
+ rownames = [cue_pS_obj . i2f[i] for i in 1 : size (M,1 )]
77
81
colnames = [" S$i " for i in 1 : size (M,2 )]
78
82
elseif M_type == :G || M_type == " G"
79
83
rownames = [" S$i " for i in 1 : size (M,1 )]
80
- colnames = [cue_obj . i2f[i] for i in 1 : size (M,2 )]
84
+ colnames = [cue_pS_obj . i2f[i] for i in 1 : size (M,2 )]
81
85
elseif M_type == :A || M_type == " A"
82
- rownames = [cue_obj . i2f[i] for i in 1 : size (M,1 )]
83
- colnames = [cue_obj . i2f[i] for i in 1 : size (M,2 )]
86
+ rownames = [cue_pS_obj . i2f[i] for i in 1 : size (M,1 )]
87
+ colnames = [cue_pS_obj . i2f[i] for i in 1 : size (M,2 )]
84
88
elseif M_type == :R || M_type == " R"
85
89
rownames = data[:,target_col]
86
90
colnames = data[:,target_col]
87
91
else
88
92
throw (ArgumentError (" type is incorrect, using :C," *
89
- " :S, :Chat, :Shat, :F, :G, :A and :R " ))
93
+ " :S, :Chat, :Shat, :F, :G, :A, :R and :pS " ))
90
94
end
91
95
92
96
display_matrix (M, rownames, colnames, nrow= nrow, ncol= ncol, return_matrix= return_matrix)
0 commit comments