データ分析のプラットフォームである Knime で R コードを使用しています。xls ファイルからテーブルを読み取るブロックからマトリックスを取得します。このマトリックスは「my_matrix」と呼ばれます。次に、アプリオリ アルゴリズムをこの行列の 3 つの列に適用したいのですが、上記のエラーが発生します。何か案は?
「sum(is.na(my_matrix))」の出力は [1] 0 であることに注意してください。
require(arules)
#require(arulesViz)
#some code to retreive the my_matrix
#my_matrix
my_rows= nrow(my_matrix);
my_cols= ncol(my_matrix);
matrix_temp = my_matrix[,4:5];
matrix_temp = array(c(matrix_temp, my_matrix[,20]), dim=c(my_rows,3))
#matrix_temp
my_matrix = matrix_temp
sum(is.na(my_matrix)) #output: [1] 0
my_transactions = as(my_matrix, "transactions");
summary(my_transactions)
my_matrix は、列が次のタイプのテーブルです: (String、Integer、Integer、String、String、Integer、Double、Integer、Double、Double、Integer、Double、Double、Integer、Double、Double、Integer、Double、Integer、弦)。テーブルには 3300 行あります。
> my_matrix = as(knime.in, "matrix")
> dput(head(my_matrix, 5))
structure(c("KS", "OH", "NJ", "OH", "OK", "128", "107", "137",
" 84", " 75", "415", "415", "415", "408", "415", "noIP", "noIP",
"noIP", "IP", "IP", "Vmail", "Vmail", "noVmail", "noVmail", "noVmail",
"25", "26", " 0", " 0", " 0", "265.1", "161.6", "243.4", "299.4",
"166.7", "110", "123", "114", " 71", "113", "45.07", "27.47",
"41.38", "50.90", "28.34", "197.4", "195.5", "121.2", " 61.9",
"148.3", " 99", "103", "110", " 88", "122", "16.78", "16.62",
"10.30", " 5.26", "12.61", "244.7", "254.4", "162.6", "196.9",
"186.9", " 91", "103", "104", " 89", "121", "11.01", "11.45",
" 7.32", " 8.86", " 8.41", "10.0", "13.7", "12.2", " 6.6", "10.1",
" 3", " 3", " 5", " 7", " 3", "2.70", "3.70", "3.29", "1.78",
"2.73", "1", "1", "0", "2", "3", "notChurning", "notChurning",
"notChurning", "notChurning", "notChurning"), .Dim = c(5L, 20L
), .Dimnames = list(c("Row0", "Row1", "Row2", "Row3", "Row4"),
c("State", "Account length", "Area code", "International plan",
"Voice mail plan", "Number vmail messages", "Total day minutes",
"Total day calls", "Total day charge", "Total eve minutes",
"Total eve calls", "Total eve charge", "Total night minutes",
"Total night calls", "Total night charge", "Total intl minutes",
"Total intl calls", "Total intl charge", "Customer service calls",
"Churn")))