Learn R Programming

sits (version 1.12.0)

sits_to_xlsx: Saves the results of accuracy assessments as Excel files

Description

Saves confusion matrices as Excel spreadsheets. This function takes the a list of confusion matrices generated by the sits_conf_matrix function and save them in an Excel spreadsheet.

Usage

sits_to_xlsx(acc.lst, file = NULL)

Arguments

acc.lst

A list of confusion matrices.

file

The file where the XLSX data is to be saved.

Examples

Run this code
# NOT RUN {
# read a tibble with 400 samples of Cerrado and 346 samples of Pasture
data(cerrado_2classes)
# perform a 2 fold validation of this sample file
pred_ref.tb <-  sits_kfold_validate(cerrado_2classes, folds = 2)
# calculate and print the confusion matrix
conf.mx <- sits_conf_matrix(pred_ref.tb)
# create a list to store the results
results <- list()
# give a name to the confusion matrix
conf.mx$name <- "confusion_matrix"
# add the confusion matrix to the results
results[[length(results) + 1]] <- conf.mx
# save the results to an XLSX file
sits_to_xlsx(results, file = "confusion_matrix.xlsx")
# }

Run the code above in your browser using DataLab