I have 2 data frames resulted of fortifying 2 rasters (RStoolbox::fortify.raster).
> str(rt06df)
'data.frame': 13056 obs. of 4 variables:
$ x : num -85.3 -85.3 -85.3 -85.3 -85.3 ...
$ y : num 9.79 9.79 9.79 9.79 9.79 ...
$ layer: num NA NA NA NA NA NA NA NA NA NA ...
$ tag : chr "T06" "T06" "T06" "T06" ...
> str(rt07df)
'data.frame': 9434 obs. of 4 variables:
$ x : num -85.3 -85.3 -85.3 -85.3 -85.3 ...
$ y : num 9.79 9.79 9.79 9.79 9.79 ...
$ layer: num NA NA NA NA NA NA NA NA NA NA ...
$ tag : chr "T07" "T07" "T07" "T07" ...
When I plot the each data frame there is no problem.
ggplot() + geom_tile(aes(x = x, y = y, fill = layer), data = rt06df) + scale_fill_gradient(guide = FALSE, low = "yellow", high = "red", na.value="transparent")
ggplot() + geom_tile(aes(x = x, y = y, fill = layer), data = rt07df) + scale_fill_gradient(guide = FALSE, low = "yellow", high = "red", na.value="transparent")
but when I try to plot the 2 data frames after binding them with rbind or rbind.fill my plot is empty.
> rtiburon = rbind(rt06df, rt07df)
> str(rtiburon)
'data.frame': 22490 obs. of 4 variables:
$ x : num -85.3 -85.3 -85.3 -85.3 -85.3 ...
$ y : num 9.79 9.79 9.79 9.79 9.79 ...
$ layer: num NA NA NA NA NA NA NA NA NA NA ...
$ tag : chr "T06" "T06" "T06" "T06" ...
> ggplot() + geom_tile(aes(x = x, y = y, fill = layer), data = rtiburon) + scale_fill_gradient(guide = FALSE, low = "yellow", high = "red", na.value="transparent")
I don't understand why I cannot plot the binded data frame.
--
Manuel Spínola, Ph.D.
Instituto Internacional en Conservación y Manejo de Vida Silvestre
Universidad Nacional
Apartado 1350-3000
Heredia
COSTA RICA
mspi...@una.cr
mspin...@gmail.com
Teléfono: (506) 8706 - 4662
Personal website:
Lobito de río
Institutional website:
ICOMVIS