[R] convert to grid file

Petr PIKAL petr.pikal at precheza.cz
Thu Sep 1 16:22:41 CEST 2011


Hi

> Thank you Petr
> 
> It work. 
> 
> Now I have a matrix 970*960. If I want to convert to spatial grid (each 
> pixel has x and y coordinate). 
> How can I do? 

I do not understand. What do you want to do with your data? Maybe you 
could consult spatial package or CRAN Task views. One option could be to 
make vectors of row and columns coordinates. But it depends on what you 
want to do with your data.

Regards
Petr


> 
> Thanks
> 
> 
> From: Petr PIKAL <petr.pikal at precheza.cz>
> To: azam jaafari <azamjaafari at yahoo.com>
> Cc: R-help <r-help at r-project.org>
> Sent: Thursday, September 1, 2011 8:59 AM
> Subject: Re: [R] convert to grid file
> 
> Hi
> 
> > 
> > Hi
> > 
> > I computed probability in each cell.
> > I have:
> > 
> >  [99883,] -0.0062412957690
> >  [99884,] -0.0062412957690
> >  [99885,] -0.0062412957690
> >  [99886,] -0.0062412957690
> >  [99887,] -0.0062412957690
> >  [99888,] -0.0062412957690
> >  [99889,]  0.9909126638948
> >  [99890,]  0.9909126638948
> >  [99891,]  0.9909126638948
> >  [99892,]  0.9909126638948
> >  [99893,]  0.9909126638948
> >  [99894,]  0.9909126638948
> >  [99895,]  0.9909126638948
> >  [99896,]  0.9909126638948
> >  [99897,]  0.9909126638948
> >  [99898,]  0.9909126638948
> >  [99899,]  0.9909126638948
> >  [99900,]  0.9909126638948
> >  [99901,]  0.9909126638948
> >  [99902,]  0.9909126638948
> >  [99903,]  0.9909126638948
> > 
> >  [99999,] -0.0062412957690
> >  [ reached getOption("max.print") -- omitted 839931 rows ]]
> > 
> > How want to convert this matrix to a grid file with 970*960 pixel.
> 
> Assuming your object is one column matrix called mat1
> 
> You can simply change its dimension
> 
> dim(mat) <- c(970, 960)
> 
> regards
> Petr
> 
> 
> 
> 
> > 
> > Thanks alot
> >    [[alternative HTML version deleted]]
> > 
> > ______________________________________________
> > R-help at r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide 
> http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
> 
>



More information about the R-help mailing list