The 'sparcl' package uses the 'kmeans' function in the standard 'stat' package. I want to make it use my own implementation of kmeans++ instead.
One way to do this would be to edit the code in the sparcl package itself. I'd prefer to avoid this, both because it would be messy and because I'm not sure how I would then install that edited code in R.
Unfortunately, the superassignment operator "<<-" doesn't work:
> kmeans <<- function(x) print("hi!")
Error: cannot change value of locked binding for 'kmeans'
neither does "assign":
assign("kmeans",function(x) {print("HI THERE!"); return(FALSE)},pos="package:sparcl")
Error in assign("is.null", function(x) { :
cannot add bindings to a locked environment
So is editing the package code the only way?
Thanks!