我正在显示自动关闭一个消息框的解决方案,该解决方案显示了无点击事件几分钟后,就出现了。 我尝试了下面的代码。
# Set up data
data <- data.frame(names = c("A1", "A2", "A3", "B1", "B2", "B3", "C1", "C2"),
x = c(2, 2, 8, 5, 7, 6, 1, 4),
y = c(10, 5, 4, 8, 5, 4, 2, 9))
initial_centers <- matrix(c(2, 5, 1, 10, 8, 2), ncol=2)
# Run k means for 1 iteration
model <- kmeans(data[,-1], initial_centers, iter.max=1)
model$centers
# Actual Output:
# x y
# 1 3.666667 9.000000
# 2 7.000000 4.333333
# 3 1.500000 3.500000
# Expected Output:
# x y
# 1 2.000000 10.00000
# 2 6.000000 6.000000
# 3 1.500000 3.500000
请帮助我提供此代码。我真的在为这个概念而苦苦挣扎。 预先感谢 .. !!
答案 0 :(得分:0)
我认为您不能使用普通的消息框来做到这一点。您是否考虑过要自己做?它不应该太复杂。