Dear Robert,


 Yes previously I created a raster using the following command

F1<-data.frame(x, y)
r <- raster(as.matrix(F1))
extent(r) <- extent(xmin, xmax, ymin, ymax)
The problem was that my interpolated results seemed very implausible (for
instance if my temperature observations ranged between 6 and 28, I ended up
getting interpolated result between 15 and 17 and extreme temperatures are
critical to statistical analysis I will be doing after the interpolation).
So I thought the reason I was getting these results was because somehow my
raster formation was bad. And in one of the R manuals, I saw that the
raster has to be gridded and that is basically what I am trying to achieve.
Perhaps I have a different problem than the raster, but I have tried
different interpolation mathods (thin plate spline, kriging and IDW) but my
problem will not go away. Anyway here is the remaining code :


IDW <- gstat(id = "z", formula = z~1, locations = ~x+y, data=da1,
set=list(idp =2))
IDWRaster <- interpolate(r, IDW)

Cheers
minti

On Mon, Oct 8, 2012 at 4:16 AM, Robert J. Hijmans <r.hijmans@gmail.com>
wrote:
>
> Minti,
> At this point, given your previous messages, it is rather unclear whether
> you actually need spTransform. Why are you using it? It does not help in
> creating a raster (which you say your purpose is).
> Robert
>
>
> On Sun, Oct 7, 2012 at 3:58 PM, alemante zd <mintibezabih@gmail.com>
wrote:
>>
>> Dear all,
>>
>> This might be a very elementary question to most on here but I am
>> trying to construct a raster from my latitude/longtude data and while
>> I managed to get most codes right (with help from you guys), I could
>> not figure out what to put in place of "fill in the proj4 string you
>> want". Where do I get these figures from? I tried looking up the
>> location of Ethiopia where data for this exercise is from and came up
>> with this figure("+init=epsg:4326"). But when I insterted it , I was
>> not successful in fully running my code
>>
>> Anyway, my full codes looks like below:
>>
>>
>> x <- 1:10
>>
>> y <- 1:10
>>
>> F1<-data.frame(x, y)
>>
>> library(sp)
>>
>> SP <- SpatialPoints(F1,proj4string=CRS("+proj=longlat"))
>>
>>
>> library(rgdal)
>>
>> spt <- spTransform(SP, CRS("  fill in  the proj4 string you want  ") )
>>
>>
>> gridded(spt) = TRUE
>>
>> library(raster)
>> r = raster(spt)
>> projection(r) = CRS("fill in  the proj4 string you want  ")
>> plot(r)
>>
>> I would be most grateful for any help as usual.
>>
>> Cheers
>> minti
>>
>> _______________________________________________
>> R-sig-Geo mailing list
>> R-sig-Geo@r-project.org
>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
>

	[[alternative HTML version deleted]]

