Learn R Programming

rgeoda (version 0.0.6)

save_weights: Save Spatial Weights

Description

Save current spatial weights to a file

Usage

save_weights(gda_w, out_path, layer_name, id_name, id_values)

Arguments

gda_w

A Weight object

out_path

The path of an output weights file

layer_name

The name of the layer of input dataset

id_name

The id name (or field name), which is an associated column contains unique values, that makes sure that the weights are connected to the correct observations in the data table.

id_values

The tuple of values of selected id_name (column or field)

Value

A boolean value indicates if save successfully or failed

Examples

Run this code
# NOT RUN {
guerry_path <- system.file("extdata", "Guerry.shp", package = "rgeoda")
guerry <- geoda_open(guerry_path)
queen_w <- queen_weights(guerry)
save_weights(rook_w, out_path = '/Users/xun/Downloads/Guerry_r.gal',
            layer_name = 'Guerry',
            id_name = 'CODE_DE',
            id_values = as.integer(guerry_df['CODE_DE'][,1]))
# }

Run the code above in your browser using DataLab