SCM

Forum: open-discussion

Monitor Forum | Start New Thread Start New Thread
RE: create transition matrix [ Reply ]
By: Jacob van Etten on 2010-10-19 21:13
[forum:3519]
Try tr1[index] directly. "index" should be a two-columned matrix with the cell numbers you are interested in.

Cell numbers follow the conventions of the raster package -- theystart with 1 in the upper left corner and continue to the right. Numbering then starts again on the left.

RE: create transition matrix [ Reply ]
By: Tabitha Graves on 2010-10-19 17:33
[forum:3518]
Ok, maybe I need to clarify my question. I'm trying to figure out how I'd check on the transition value for a particular location.

So this command seems to pull out the transition values for the first five non-zero values:
tr1@transitionMatrix@x[tr1@transitionCells[1:5]]
but it's unclear to me how I tell where that is (i.e. on the map)?
Is p referring to the cell number? Is i the column number or perhaps the 'to' cell number?
I am new to working with S4 structures in R, so sorry if this is a very basic question.

RE: create transition matrix [ Reply ]
By: Jacob van Etten on 2010-10-19 08:15
[forum:3516]
Use indexing to get the values out of the object.

m[] should give you the full matrix.

RE: create transition matrix [ Reply ]
By: Tabitha Graves on 2010-10-15 15:25
[forum:3501]
Is there somewhere where all transition values are located?

Thanks for your help and for building the package too!

RE: create transition matrix [ Reply ]
By: Jacob van Etten on 2010-10-15 10:26
[forum:3499]
That gives you the non-zero values only, but perhaps that is what you want?

RE: create transition matrix [ Reply ]
By: Tabitha Graves on 2010-10-14 16:55
[forum:3498]
That seems to have worked! Thank you and thanks for putting this package together too!

Am I correct that this would give me a raw vector of the transition values?
tr1@transitionMatrix@x


RE: create transition matrix [ Reply ]
By: Jacob van Etten on 2010-10-12 08:17
[forum:3480]
Hi Tabitha,

Your version of gdistance does not correspond to your version of raster.

Try to install the latest version from R-Forge.

The latest code should not produce this error.

create transition matrix [ Reply ]
By: Tabitha Graves on 2010-10-11 22:50
[forum:3477]
Hi. I get an error using the TransitionFromRaster command, even when I use it exactly as it's in the example in the vignettt. I'm using R.11.1

The error is
Error: could not find function "values"
Error in which(!is.na(values(object))) :
error in evaluating the argument 'x' in selecting a method for function 'which'

Any ideas? Thanks!

Thanks to:
Vienna University of Economics and Business Powered By FusionForge