[Biomod-commits] Uncorrect mapping coordinates : coor and Data are not of the same length

Robin Engler robin.engler at gmail.com
Thu Dec 8 03:26:47 CET 2011


Hi,

The "length" of "coor" and "data" refers to the number of rows of
these two data frames.
In the code you wrote you are checking the number of columns, not the
number of rows.
use "nrow()" to check for the number of rows.
Make sure that the two following lines give the same result.

nrow(coordXY)
nrow(Biomod.PA.sample)

Hope this helps,
Cheers,
Robin


Robin Engler
Spatial Ecology Lab
University of Lausanne




On Wed, Dec 7, 2011 at 5:45 PM, Amandine Cornille
<amandine.cornille at u-psud.fr> wrote:
> Hi all,
>
> I am using Biomod package for niche modelling.
>
> I did the initial state and lauched the model. After I tried to plot the
> predictions on a map, but I have this error message :
>
>
>>
>> multiple.plot(Pred_sylvestris[,1:9,1,1],coordXY[Biomod.PA.sample$MyDataPA2$PA1,])
> Erreur dans multiple.plot(Pred_sylvestris[, 1:9, 1, 1],
> coordXY[Biomod.PA.sample$MyDataPA2$PA1,  :
>   Uncorrect mapping coordinates : coor and Data are not of the same length
>
> When I checked  files I used, indeed coor and data are not one the same
> length...
>
>> length(coordXY)
> [1] 2
>> length(Biomod.PA.sample)
> [1] 1
>
>> head(coordXY)
>       X     Y
> 1 16.12 47.88
> 2 16.11 47.89
> 6 16.22 48.39
> 7 17.19 44.00
> 8  4.33 50.94
> 9 15.57 44.97
>> head(Biomod.PA.sample)
> $sylvestris
> $sylvestris$PA1
>    [1]     1     2     3     4     5     6     7     8     9    10    11
> 12    13    14    15    16
>   [17]    17    18    19    20    21    22    23    24    25    26    27
> 28    29    30    31    32
>   [33]    33    34    35    36    37    38    39    40    41    42    43
> 44    45    46    47    48
>   [49]    49    50    51    52    53    54    55    56    57    58    59
> 60    61    62    63    64
>   [65]    65    66    67    68    69    70    71    72    73    74    75
> 76    77    78    79    80
>   [81]    81    82    83    84    85    86    87    88    89    90    91
> 92    93    94    95    96
>
> I deleted all duplicate XY coor in the case of it was that by using :
> MyData3<-MyData[!duplicated(MyData[,c(1,2)]),]
>
> But After re ran initial.state and models, It didn't work again giving the
> same error message ....
>
> May you help me please ?
>
> Thanks a lot for your help,
>
> Amandine
>
>
> _______________________________________________
> Biomod-commits mailing list
> Biomod-commits at lists.r-forge.r-project.org
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/biomod-commits


More information about the Biomod-commits mailing list