EVOLUTION-MANAGER
Edit File: setValues.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: Set values of a Raster object</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 setValues {raster}"><tr><td>setValues {raster}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Set values of a Raster object</h2> <h3>Description</h3> <p>Assign (new) values to a Raster* object. </p> <h3>Usage</h3> <pre> ## S4 method for signature 'RasterLayer' setValues(x, values, ...) ## S4 method for signature 'RasterBrick' setValues(x, values, layer=-1, ...) ## S4 method for signature 'RasterStack' setValues(x, values, layer=-1, ...) ## S4 method for signature 'RasterLayerSparse' setValues(x, values, index=NULL, ...) values(x) <- value </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>x</code></td> <td> <p>A <code>Raster*</code> </p> </td></tr> <tr valign="top"><td><code>values</code></td> <td> <p>Cell values to associate with the Raster* object. There should be values for all cells</p> </td></tr> <tr valign="top"><td><code>value</code></td> <td> <p>Cell values to associate with the Raster* object. There should be values for all cells</p> </td></tr> <tr valign="top"><td><code>layer</code></td> <td> <p>Layer number (only relevant for RasterBrick and RasterStack objects). If missing, the values of all layers is set</p> </td></tr> <tr valign="top"><td><code>index</code></td> <td> <p>Cell numbers corresponding to the values</p> </td></tr> <tr valign="top"><td><code>...</code></td> <td> <p>Additional arguments (none implemented)</p> </td></tr> </table> <h3>Value</h3> <p>a Raster* object </p> <h3>Note</h3> <p>While you can access the 'values' slot of the objects directly, you would do that at your own peril because when setting values, multiple slots need to be changed; which is what setValues takes care of. </p> <h3>See Also</h3> <p><code><a href="replacement.html">replacement</a></code> </p> <h3>Examples</h3> <pre> r <- raster(ncol=10, nrow=10) vals <- 1:ncell(r) r <- setValues(r, vals) # equivalent to values(r) <- vals </pre> <hr /><div style="text-align: center;">[Package <em>raster</em> version 3.3-13 <a href="00Index.html">Index</a>]</div> </body></html>