clustering_toolbox's People
clustering_toolbox's Issues
List subscript issue
My modified version to make it work on my computer
KMeans Clustering Toolbox
##Author: Fabio Veronesi
tool_exec <- function(in_params, out_params)
{
if (!requireNamespace("sp", quietly = TRUE))
install.packages("sp")
require(sp)
print("K-Means Clustering of Shapefiles")
print("Author: Fabio Veronesi")
source_dataset <- in_params[[1]]
nclust <- in_params[[2]]
variable <- in_params[[3]]
out_shape <- out_params[[1]]
Read Data
arc.progress_label("Loading Dataset")
d <- arc.open(source_dataset)
print(d)
Create a Data.Frame with the variables to cluster
data <- arc.select(d, variable)
data_clust <- data.frame(data[,variable[[1]]]) # First issue here
if(length(variable)>1){
for(i in 2:length(variable)){
data_clust <- cbind(data_clust,data[,variable[[i]]]) # second here
}
}
names(data_clust) <- variable
for(i in 1:length(variable)){
dev.new()
plot(hist(data_clust[,i]),main=paste0("Histogram of ",variable[[i]]),xlab=variable[[i]]) # this needed to be modified as well
}
clusters <- kmeans(data_clust, nclust)
result <- data.frame(cluster=clusters$cluster)
arc.write(out_shape, result, coords = arc.shape(data))
print("Done")
return(out_params)
}
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.