Kristi Glover
2013-Sep-03 02:51 UTC
[R] how to calculate bioclim for table dataset in dismo package
Hi R Experts,
I was trying to develop model (bioclim, Domin) using a table data in
'dismo' package. The data I have is at table format instead of images
(stack of raster images). I followed the procedures of "dismo"
package to calculate the bioclim but I could not figure it out how I can
implement these procedures using table data.
I have pasted an example how I did it, but it did not work. if some one has done
it before, would you mind to suggest me how I can implement bioclim of
'dismo' using table data?
I really appropriate your help.
Sincerely
KG
#----------------------------------------
library(dismo)
dd<-structure(list(long = c(-75.747, -106.84, -105.27, -104.64, -103.71,
-102.72, -101.79, -100.8, -105.69, -104.67, -103.71, -102.69,
-101.66, -100.71, -99.685, -98.656, -97.627, -111.82, -110.2,
-109.55, -106.88, -106.84, -105.85, -104.82, -103.84, -102.8,
-101.83, -100.79, -99.742, -98.695, -97.744, -112.46, -111.8,
-110.79, -108.41, -107.74), lat = c(19.792, 21.576, 21.347, 21.243,
21.078, 21.185, 20.99, 21.067, 22.621, 22.763, 22.594, 22.704,
22.797, 22.581, 22.642, 22.685, 22.711, 24.153, 23.44, 23.385,
23.4, 23.702, 23.565, 23.71, 23.542, 23.654, 23.454, 23.533,
23.596, 23.64, 23.377, 24.796, 24.459, 24.399, 24.503, 24.429
), sp1 = c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L), env1 = c(182.0037689, 163.3301239,
443.0214233, 1240.155273, 1774.867432, 1909.528809, 2153.244141,
1878.018433, 909.1315308, 1980.898438, 2271.118896, 2122.672852,
2033.41626, 1534.658447, 828.4759522, 222.3117523, 23.4761219,
79.52642822, 322.994751, 273.6637268, 35.5085907, 516.3795776,
2205.419434, 2118.727539, 2178.901123, 1995.210083, 2048.075928,
1824.84021, 1043.509888, 184.4526062, 12.6928978, 20.87172508,
126.5344544, 258.8852844, 3.28964257, 140.3287811), env2 = c(1134L,
550L, 2111L, 2523L, 2156L, 1209L, 1107L, 2605L, 3176L, 2490L,
1360L, 801L, 1118L, 1484L, 2730L, 1309L, 104L, 197L, 2033L, 1339L,
567L, 2694L, 2708L, 1806L, 1344L, 912L, 1377L, 2346L, 3265L,
989L, 69L, 428L, 764L, 896L, 100L, 1521L), env3 = c(24.533, 24.928,
24.707, 21.052, 21.318, 18.428, 19.041, 17.743, 24.371, 19.689,
16.879, 16.528, 16.901, 18.015, 20.648, 25.31, 24.308, 22.528,
22.912, 22.001, 25.097, 25.391, 19.154, 14.943, 17.143, 16.898,
16.891, 17.563, 15.63, 24.354, 24.088, 22.527, 22.528, 22.126,
25.317, 25.643), env4 = c(0.047969, 0.003469, 0.003385, 0.002253,
0.000791, 0.001834, 0.008016, 0.009262, 0.003934, 0.002322, 0.00061,
0.000799, 6.4e-05, 0, 0, 0.000107, 0.003151, 0.018915, 0.015077,
0.004554, 0.003499, 0.002705, 0.003507, 0.001173, 0.000149, 0.000308,
0, 0, 0, 0.00074, 0.002845, 0.017047, 0.018915, 0.017111, 0.002417,
0.002668)), .Names = c("long", "lat", "sp1",
"env1", "env2",
"env3", "env4"), class = "data.frame", row.names =
c(NA, -36L))
bioclim.model<-bioclim(dd[,4:7],dd[,3])
I got the following message
Error in function (classes, fdef, mtable) :
unable to find an inherited method for function "bioclim", for
signature "data.frame", "integer"
[[alternative HTML version deleted]]