Learn R Programming

ModelMap (version 3.4.0.3)

build.rastLUT: Build a raster Look-UP-Table for training dataset

Description

GUI prompts will help the user build a Look-Up-Table to associated predictor variable with their corresponding spatial rasters.

Usage

build.rastLUT(imageList=NULL,predList=NULL,qdata.trainfn=NULL,
rastLUTfn=NULL,folder=NULL)

Value

Returns a data frame containing the raster Look-Up-Table. Also Writes a .csv file containing the raster Look-Up-Table.

Arguments

imageList

Vector. A vector of character strings giving names and full paths to all raster data files used in model.

predList

Vector. A vector of character strings giving the predictor names used as headers in the model training data.

qdata.trainfn

String. The name (full path or base name with path specified by folder) of the training data file used for building the model. The file must be a comma-delimited file *.csv with column headings. qdata.trainfn can also be an R dataframe. The column headers from qdata.trainfn are used to generate a list of possible predictors for the raster Look-UP-Table.

rastLUTfn

String. The name of the file output for the Look-Up-Table. By default, if a file name is provided by the "qdatatrainfn" argument "_rastLUT.csv" appended after "qdatatrainfn". Otherwise, default filename for look-up-table is"rastLUT.csv"

folder

String. The folder used for output. Do not add ending slash to path string. If folder = NULL (default), a GUI interface prompts user to browse to a folder. To use the working directory, specify folder = getwd().

Author

Elizabeth Freeman

Details

This function helps the user create a raster Look-Up-Table to be used later by model.mapmake(). Currently this function only works in a Windows environment.

First, if "folder" is not given, the user selects the output folder for the Look-UP-Table.

Second, if "predList" or "qdatatrainfn" are not given, the user selects the file containing the training data. The header of the file is used to generate a selection list of possible predictor variables.

Third, if "imageList" is not provided, the user selects the rasters.

Finally, the function steps through each band of each raster, and the user selects the appropriate predictor.

Examples

Run this code

if (FALSE) {
folder<-system.file("external", "helpexamples", package = "ModelMap")
qdata.trainfn = paste(folder,"/DATATRAIN.csv",sep="")

#build.rastLUT(	qdata.trainfn=qdata.trainfn,
#		folder=folder)
} # end dontrun

Run the code above in your browser using DataLab