Updating the raster package from r-forge seems to fix this error.

writeRaster(single, filename= "idri.rst", format= "IDRISI", overwrite=TRUE)
## class       : RasterLayer
## dimensions  : 10, 10, 100  (nrow, ncol, ncell)
## resolution  : 36, 18  (x, y)
## extent      : -180, 180, -90, 90  (xmin, xmax, ymin, ymax)
## coord. ref. : NA
## data source : /home/ahmadou/idri.rdc
## names       : layer.1
## values      : -6.261, 9.5628  (min, max)

packageVersion("raster")
## [1] ‘2.1.71’



On Sun, Dec 8, 2013 at 7:46 PM, Ahmadou Dicko <dicko.ahmadou@gmail.com>wrote:

>
> I don't understand why this is not working.
> Meanwhile you can use rgdal::writeGDAL
>
>
> library(raster)
> library(rgdal)
> r <- raster(nrow=10, ncol=10)
> s <- stack( sapply(1:2, function(i) setValues(r, rnorm(ncell(r), i, 3) )) )
> s[1:6] <- NA
> single <- s$layer.1
> writeGDAL(as(single, "SpatialGridDataFrame"), fname = "idri.rst",
> drivername = "RST")
> GDALinfo("idri.rst")
>
>
>
>
>
> On Sun, Dec 8, 2013 at 7:22 PM, Eddie Smith <eddieatr@gmail.com> wrote:
>
>> Dear list,
>>
>> I tried to save my data into IDRISI format but end up with this error
>> message:
>> Error in if (is.null(projs) | is.na(projs) | nchar(projs) < 3) { :
>>   argument is of length zero
>>
>> library(raster)
>> library(rgdal)
>> r <- raster(nrow=10, ncol=10)
>> s <- stack( sapply(1:2, function(i) setValues(r, rnorm(ncell(r), i, 3) ))
>> )
>> s[1:6] <- NA
>> single <- s$layer.1
>> writeRaster(single, filename="idri.rst", format="IDRISI", overwrite=TRUE)
>>
>> sessionInfo()
>> R version 3.0.1 (2013-05-16)
>> Platform: x86_64-w64-mingw32/x64 (64-bit)
>>
>> other attached packages:
>> [1] raster_2.1-66 rgdal_0.8-11  sp_1.0-14
>>
>> Can somebody help?
>>
>> Cheers
>> Eddie
>>
>>         [[alternative HTML version deleted]]
>>
>> _______________________________________________
>> R-sig-Geo mailing list
>> R-sig-Geo@r-project.org
>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>
>
>
>
> --
> Ahmadou H. DICKO
> statistician economist (Ingénieur Statisticien Économiste)
> PhD candidate in Climate change economics
> Faculty of economics and managment - Cheikh Anta Diop University
> West African Science Service Center on Climate Change and Adaptated Land
> Use (WASCAL)
> Center for Development Research (ZEF) - University of Bonn
> email : ahmadou.dicko@ucad.edu.sn
> twitter : @dickoah
> github : github/dickoa <https://github.com/dickoa>
> tel : +221 33 827 55 16
> portable: +221 77 123 81 69
>



-- 
Ahmadou H. DICKO
statistician economist (Ingénieur Statisticien Économiste)
PhD candidate in Climate change economics
Faculty of economics and managment - Cheikh Anta Diop University
West African Science Service Center on Climate Change and Adaptated Land
Use (WASCAL)
Center for Development Research (ZEF) - University of Bonn
email : ahmadou.dicko@ucad.edu.sn
twitter : @dickoah
github : github/dickoa <https://github.com/dickoa>
tel : +221 33 827 55 16
portable: +221 77 123 81 69

	[[alternative HTML version deleted]]

