subsetSimulations: Subsetting Simulations

Description Usage Arguments Details Value Author(s) Examples

Description

Return subsets of Simulations, subsetting by plumes, locations, the kinds of values or by the columns of data associated with plumes or locations – possibly combined.

Usage

1
2
3
## S3 method for class 'Simulations'
subset(x, ..., locations, plumes, kinds, dataLocations, dataPlumes, 
  nameSave = NA, overwrite = FALSE, valuesOnly = FALSE)

Arguments

x

Simulations

...

parameters to be forwarded

locations

indices of locations to keep

plumes

indices of plumes to keep

kinds

indices of kinds of values to keep

dataLocations

indices of the data associated with the locations to keep

dataPlumes

indices of the data associated with the plumes to keep

nameSave

name for saving the new raster files for the values if they cannot be kept in memory (without suffix)

overwrite

logical if files may be overwritten by the raster files

valuesOnly

logical if only the subset of values is returned (if FALSE the result is the full new Simulations)

Details

Multiple or invalid values in locations and plumes are ignored, only the order is taken into account. (Because in SpatialIndexDataFrame and SpatialPolygridDataFrame no locations can be selected multiply.)

However, if valuesOnly = TRUE, multiplity is taken into account and invalid indices result in NA values. In this case only the values are returned.

Value

A Simulations object, subsetted by the given indices: subsetting locations or plumes results in subsetting of the values. If the resulting raster is too big to keep in memory, it is saved.

If valuesOnly = TRUE, only the new values are returned, i.e. a raster object.

Author(s)

Kristina B. Helle, kristina.helle@uni-muenster.de

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
## Not run: 
## may create files
data(SimulationsSmall)

SimulationsSmall_a = subset(SimulationsSmall, locations = c(2,4,6,8))
SimulationsSmall_b = subset(SimulationsSmall, 
                            locations = 1:5, plumes = c(2,4), kinds = 1, 
                            dataPlumes = 1:2)
                            
# effect of 'valuesOnly'
data(radioactivePlumes)
locations1 = sample(nLocations(radioactivePlumes), 15)
plumes1 = sample(nPlumes(radioactivePlumes), 15)
subset_fm_RNA = subset(radioactivePlumes, 
                       plumes = c(plumes1, NA, 10000, NA, 0, plumes1), 
                       locations = c(locations1, NA, 10000, NA, 0,locations1))
                        
subset_mf_RNA_vO = subset(radioactivePlumes, 
                          plumes = c(plumes1, NA, 0, 10000, NA, plumes1), 
                          locations = c(locations1, NA, NA, 10000, 0, 0, locations1),
                          valuesOnly = TRUE)  
image(subset_fm_RNA@values) 
image(subset_mf_RNA_vO)   # with repetitions

## End(Not run)

sensors4plumes documentation built on May 1, 2019, 10:27 p.m.