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? Thanks
From: Petr PIKAL <petr.pi...@precheza.cz> To: azam jaafari <azamjaaf...@yahoo.com> Cc: R-help <r-help@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@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. [[alternative HTML version deleted]]
______________________________________________ R-help@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.