Reputation: 101
I'm using the ScottKnott package to perform some analysis on some data using the following code:
Data <- read.csv('hf dataset.csv',header=TRUE)
sk1 <- with(Data,
SK(x=Data$classifier,
y=Data$kappa,
model='y ~ x',
which='x'))
The code was working just fine. This is an example of the output I used to have using the code above:
BUT now I'm getting this
Error in UseMethod("SK") : no applicable method for 'SK' applied to an object of class "character"
using the SAME code and SAME data. This is a snippet of Data:
str(Data)
'data.frame': 1200 obs. of 4 variables:
$ classifier: chr "U-KNNCFS" "U-KNNCFS" "U-KNNCFS" "U-KNNCFS" ...
$ kappa : num 0.524 0.831 0.561 0.4 0.615 ...
$ acc : num 80 93.3 83.3 73.3 83.3 ...
$ auc : num 0.762 0.889 0.754 0.7 0.8 ...
I converted the Data$classifier column from "chr" to "Factor" but I still had the same error with "Factor" instead of "character". Can someone help? I've been trying to figure out the problem for 3 days but I'm stuck here.
Here is a small sample of Data:
structure(list(classifier = c("U-KNNCFS", "U-KNNCFS", "U-KNNCFS",
"U-KNNCFS", "U-KNNCFS", "U-KNNCFS", "U-KNNCFS", "U-KNNCFS", "U-KNNCFS",
"U-KNNCFS", "U-KNNCON", "U-KNNCON", "U-KNNCON", "U-KNNCON", "U-KNNCON",
"U-KNNCON", "U-KNNCON", "U-KNNCON", "U-KNNCON", "U-KNNCON", "U-KNNIG4",
"U-KNNIG4", "U-KNNIG4", "U-KNNIG4", "U-KNNIG4", "U-KNNIG4", "U-KNNIG4",
"U-KNNIG4", "U-KNNIG4", "U-KNNIG4"), kappa = c(0.523809524, 0.830508475,
0.561403509, 0.4, 0.615384615, -0.216216216, 0.7, 0.368421053,
0.7, 0.449367089, 0.307692308, 0.150943396, 0.206349206, 0.052631579,
0.210526316, -0.054054054, 0.368421053, 0.108108108, 0.307692308,
-0.080229226, 0.523809524, 0.830508475, 0.561403509, 0.4, 0.615384615,
-0.216216216, 0.7, 0.368421053, 0.7, 0.449367089), acc= c(80,
93.33333333, 83.33333333, 73.33333333, 83.33333333, 50, 86.66666667,
73.33333333, 86.66666667, 79.31034483, 70, 70, 66.66666667, 60,
66.66666667, 56.66666667, 73.33333333, 63.33333333, 70, 55.17241379,
80, 93.33333333, 83.33333333, 73.33333333, 83.33333333, 50, 86.66666667,
73.33333333, 86.66666667, 79.31034483), auc = c(0.761904762,
0.888888889, 0.753968254, 0.7, 0.8, 0.4, 0.85, 0.675, 0.85, 0.697222222,
0.658730159, 0.563492063, 0.603174603, 0.525, 0.6, 0.475, 0.675,
0.55, 0.65, 0.461111111, 0.761904762, 0.888888889, 0.753968254,
0.7, 0.8, 0.4, 0.85, 0.675, 0.85, 0.697222222)), row.names = c(NA,
30L), class = "data.frame")
Upvotes: 1
Views: 461
Reputation: 16988
I looked into the ScottKnott
package and the SK
help. The model
argument is not described. Your code should run with
library(ScottKnott)
sk1 <- with(Data,
SK(kappa ~ classifier,
which='classifier')
)
returning
#> Results
#> Means G1 G2
#> U-KNNIG4 0.49 a
#> U-KNNCFS 0.49 a
#> U-KNNCON 0.16 b
#>
#> Sig.level
#> 0.05
#>
#> Statistics
#> lambda chisq dfchisq pvalue evmean dferror
#> Clus 1 13 7.2 2.6 0.0038 0.0063 27
#> Clus 2 0 5.5 1.8 1.0000 0.0063 27
#>
#>
#> Clusters
#> ################# Cluster 1 ################
#> {G1}: U-KNNIG4 U-KNNCFS
#> {G2}: U-KNNCON
#> ################# Cluster 2 ################
#> {G1}: 0
#> {G2}: NA
Upvotes: 1