Robin Corrià | 26 Dec 13:44 2012
Picon

Change class of elements in list


Dear R users,
I have a list of objects of type "im" 
> mylist$sp1
$sp2
$sp3

and I want to convert them to a list of objects of class "SpatialGridDataFrame"
This works for a single object of class "im":
a <- mylist$sp1
b <- as(a, "SpatialGridDataFrame")

Then I want to write each element in the new list as a TIFF file, with the name of the elements in the list.
This also works for a single object in package "rgdal":
writeGDAL(b, "sp1.TIFF")

Many thanks,

Robin

 		 	   		  
	[[alternative HTML version deleted]]

David Winsemius | 26 Dec 21:16 2012
Picon
Picon

Re: Change class of elements in list


On Dec 26, 2012, at 4:44 AM, Robin Corrià wrote:

>
> Dear R users,
> I have a list of objects of type "im"
>> mylist$sp1
> $sp2
> $sp3
>
> and I want to convert them to a list of objects of class  
> "SpatialGridDataFrame"
> This works for a single object of class "im":
> a <- mylist$sp1
> b <- as(a, "SpatialGridDataFrame")

An an identical question from someone with a user name of "rob" was  
posted to StackOverflow.
>
> Then I want to write each element in the new list as a TIFF file,  
> with the name of the elements in the list.
> This also works for a single object in package "rgdal":
> writeGDAL(b, "sp1.TIFF")
>

The Posting Guide requests that you not crosspost to multiple sites.

--

-- 
David Winsemius, MD
Alameda, CA, USA
(Continue reading)


Gmane