Learn R Programming

sparkTable (version 1.3.0)

optimal_grid_allocation: Optimal Allocation of Coordinates to a grid

Description

optimal_grid_allocation() ... newGeoTable.

Usage

optimal_grid_allocation(data, grid.cols=NULL, grid.rows=NULL, addGrid=0, plot=FALSE)

Arguments

data
data frame with first column X-coordinate and second column Y-coordinate
grid.cols
number of columns in the grid
grid.rows
number of rows in the grid
addGrid
additional columns and rows in the grid
plot
TRUE/FALSE for plotting the allocation

See Also

export

Examples

Run this code
  data <- data.frame(x=c(0,2,1.24,2,1.98,1.62,1.24,1.91,0.48),
    y=c(2.93,2.45,1.94,1.46,0.98,3,0.70,0.56,0))
rownames(data) <- c("IS","FI","NO","EE","LV","SE","DK","LT","IE")
index <-  optimal_grid_allocation(data,plot=TRUE)
index2 <- optimal_grid_allocation(data,grid.cols=3,grid.rows=4,plot=TRUE)

Run the code above in your browser using DataLab