There is a function that does this well called psp() in the spatstat
package.

	[[alternative HTML version deleted]]

