[R-sig-Geo] alternative for spixdf2kasc from adehabitat package
Mathieu Basille
basille.web at ase-research.org
Sun Jul 7 17:45:04 CEST 2013
Dear Andres,
In addition to Alexandre's answers, did you try with the RGDAL package?
Something like:
veg <- readGDAL("~/Desktop/natur_inter.asc")
This should solve your problem: the asc should be imported as a
SpatialPixel object, which can then be used in the new version of
adehabitat package, as underlined by Alexandre.
Mathieu Basille.
Le 07/07/2013 12:46 AM, Alexandre Villers a écrit :
> Hello,
>
> Look at adehabitatHS package (and other related packages adehabitatHR and
> adehabitatLT): there are new functions to take advantage of sp class
> objects (such as the ones created when reading a raster with rgdal).
> Adehabitat is now "deprecated" and you should use these other packages
> instead
>
> HTH
>
> Alex
>
>
> 2013/7/7 Andres Merino-Viteri <amerinoviteri at gmail.com>
>
>> Dear list,
>>
>> Sometimes I have problems opening ASCII files with read.asc function from
>> SDMTools package.
>>
>> The error message is like the following one:
>>
>>> Veg=read.asc("~/Desktop/natur_inter.asc")
>> Error in if ((yll[[1]][1] == "yllcenter") | (xll[[1]][1] == "YLLCENTER")) {
>> :
>> missing value where TRUE/FALSE needed
>> In addition: Warning message:
>> In read.asc("~/Desktop/natur_inter.asc") : NAs introduced by coercion
>>
>> Looking at different forums I found the following solution to this problem:
>>
>> library("rgdal")
>> library("adehabitat")
>> B1=readGDAL("~/Desktop/natur_inter.asc")
>> blaK <- spixdf2kasc(B1)
>> write.asc(blaK, "~/Desktop/NEW_natur_inter.asc", gz=FALSE)
>>
>> It used to solve my problem. The NEW .asc file did not display any error
>> message when read with the read.asc function.
>>
>> However, since I updated to R 2.15.2 GUI 1.53 Leopard build 32-bit (6335),
>> I can not use adehabitat package anymore, and I have not been able to find
>> the "spixdf2kasc" function in the new adehabitat family packages. Now, I am
>> not able to use new .asc files provided to me.
>>
>> Does anyone have an alternative solution for the read.asc error? or an
>> alternative for using "spixdf2kasc" function?
>>
>> Any help would be very appreciated. Thanks.
>>
>> Andres
>>
>> Additional infor about my R version:
>> R version 2.15.2 (2012-10-26) -- "Trick or Treat"
>> Copyright (C) 2012 The R Foundation for Statistical Computing
>> ISBN 3-900051-07-0
>> Platform: i386-apple-darwin9.8.0/i386 (32-bit)
>>
>> My computer:
>> MacBook 2GHz Intel Core 2 Duo
>> MAC OS X Version 10.6.8
>>
>> [[alternative HTML version deleted]]
>>
>> _______________________________________________
>> R-sig-Geo mailing list
>> R-sig-Geo at r-project.org
>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>
>
>
>
--
~$ whoami
Mathieu Basille, PhD
~$ locate --details
University of Florida \\
Fort Lauderdale Research and Education Center
(+1) 954-577-6314
http://ase-research.org/basille
~$ fortune
« Le tout est de tout dire, et je manque de mots
Et je manque de temps, et je manque d'audace. »
-- Paul Éluard
More information about the R-sig-Geo
mailing list