Learn R Programming

sperich (version 1.4-0)

createImage: Image Creation

Description

This function creates a levelplot of the result-grid of species range estimation and saves it as a PNG-File.

Usage

createImage(grid, landwatermask, image.title, 
			directory, filename, shift, 
			parts=10, resolution=1)

Arguments

grid
The grid that should be plotted. It contains the weighted species richness information.
landwatermask
A grid containing the land-water-information of the observed area. If a grid cell containes no land, the value of the cell in the landwatermask is -1, otherwise it is 0.
image.title
The heading of the created image.
directory
The directory in which the image should be stored.
filename
The filename of the created PNG-File.
shift
The geographic coordinates of the origin of the grid.
parts
An Integer value determining the number of divisions in the colorkey of the created image.
resolution
The resolution of the grid in (geographical) degree.

Value

  • The return type is boolean. The value is TRUE if the image-creation was successful and FALSE if the image-creation has failed.

Details

This routine creates a levelplot of the weighted species richness information and stores it as a PNG-File. The package lattice is required.

Examples

Run this code
##load data
data(dataset.all.species)
data(dataset.landwater)

##create grid parameters
dimension <- getDimension(dataset.all.species, resolution=1)
shift <- getShift(dataset.all.species)

##create landwatermask
landwatermask.nocoast <- createLandwatermask(dataset.landwater, 
						dimension, shift, resolution=1)

##estimate species richness
species.richness.weighted <- species.richness(dataset.all.species, 
						landwatermask.nocoast, distances=1:10, weight=0.5, dimension, 
						shift, resolution=1, upperbound=3000, all.species=1:20)

##create image
image.success <- createImage(species.richness.weighted, landwatermask.nocoast, 
	    image.title="Test", directory=getwd(), filename="species.richness.test01.png", 
	    shift, parts=10, resolution=1)
print(image.success)

Run the code above in your browser using DataLab