I have two variable (rain and humidity). I am doing spatial interpolation using 'gstat' and 'ggplot2' package in R. In result, I'm getting only-- x1, x2, and var1.pred columns. where, x1 contains Longitude values, x2 latitude, and var1.pred interpolated values.
Please, I appreciate if someone can help me with how to get variables name and century columns also.
(--If I will get these two new columns then I can use facet_wrap in ggplot2 plot
)
I'm using this script-
r.idw <- gstat::idw(mean ~ 1, data, newdata=grd, idp=2.0)
my data looks like this--
Variable Century Longitude Latitude Mean
Hum 900 13.931100 78.02170 1.003004829
Hum 1000 13.931100 78.02170 1.003004829
Hum 1100 13.931100 78.02170 -0.728323009
Hum 1200 13.931100 78.02170 -1.377570948
Hum 1300 13.931100 78.02170 -0.079075070
Rain 900 13.931100 78.02170 -1.377570948
Rain 1010 13.931100 78.02170 1.435836789
Rain 1030 13.931100 78.02170 0.786588849
Rain 1060 13.931100 78.02170 2.301500707
Thank you in advance 