EVOLUTION-MANAGER
Edit File: update.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Update raster cells of files (on disk)</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for update {raster}"><tr><td>update {raster}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Update raster cells of files (on disk)</h2> <h3>Description</h3> <p>Update cell values of a file (i.e., cell values on disk) associated with a RasterLayer or RasterBrick. </p> <p>User beware: this function _will_ make changes to your file (first make a copy if you are not sure what you are doing). </p> <p>Writing starts at a cell number <code>cell</code>. You can write a vector of values (in cell order), or a matrix. You can also provide a vector of cell numbers (of the same length as vector <code>v</code>) to update individual cells. </p> <p>See <code><a href="writeFormats.html">writeFormats</a></code> for supported formats. </p> <h3>Usage</h3> <pre> ## S4 method for signature 'RasterLayer' update(object, v, cell, ...) ## S4 method for signature 'RasterBrick' update(object, v, cell, band, ...) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>object</code></td> <td> <p>RasterLayer or RasterBrick that is associated with a file</p> </td></tr> <tr valign="top"><td><code>v</code></td> <td> <p>vector or matrix with new values</p> </td></tr> <tr valign="top"><td><code>cell</code></td> <td> <p>cell from where to start writing. Or a vector of cell numbers if v is a vector of the same length</p> </td></tr></table> <p>. </p> <table summary="R argblock"> <tr valign="top"><td><code>band</code></td> <td> <p>band (layer) to update (for RasterBrick objects)</p> </td></tr></table> <p>. </p> <table summary="R argblock"> <tr valign="top"><td><code>...</code></td> <td> <p>additional arguments. None implemented</p> </td></tr> </table> <h3>Value</h3> <p>RasterLayer or RasterBrick </p> <h3>Examples</h3> <pre> ## Not run: # setting up an example RasterLayer with file r <- raster(nrow=5, ncol=10, vals=0) r <- writeRaster(r, rasterTmpFile(), overwrite=TRUE, datatype='INT2S') as.matrix(r) # update with a vector starting a cell r <- update(r, v=rep(1, 5), cell=6) # 99.99 gets rounded because this is an integer file r <- update(r, v=9.99, cell=50) as.matrix(r) # update with a vector of values and matching vector of cell numbers r <- update(r, v=5:1, cell=c(5,15,25,35,45)) as.matrix(r) # updating with a marix, anchored at a cell number m <- matrix(1:10, ncol=2) r <- update(r, v=m, cell=2) as.matrix(r) ## End(Not run) </pre> <hr /><div style="text-align: center;">[Package <em>raster</em> version 3.3-13 <a href="00Index.html">Index</a>]</div> </body></html>