# NOT RUN {
input <- brick(system.file("external/rlogo.grd", package="raster"))
## Create filename
file <- paste0(tempdir(), "/test", runif(1))
## Run PCA
rpc <- rasterPCA(input, filename = file, nSample = 100)
## Save object
saveRSTBX(rpc, filename=file)
## Which files were written?
list.files(tempdir(), pattern = basename(file))
## Re-read files
re_rpc <- readRSTBX(file)
## Compare
all.equal(re_rpc, rpc)
file.remove(file)
# }
Run the code above in your browser using DataLab