How can I replace values in a Transition layer? (gdistance)

Viewed 290

I'm wondering if anyone could help me in replacing values in a transition layer.

If I try:

transitionlayer[transitionlayer >= 0.14] <- 1

I get the following error:

Error in hd >= 0.14 : 
  comparison (5) is possible only for atomic and list types

What I'm trying to do is replace all values above 0.14 in a slope transition layer.

I've found these examples in the gdistance vignette, however they use another transitionlayer, which I don't want to do, as I won't have the locations of cells that have a slope above 0.14

  #Extracting and replacing
  tr1[cbind(1:9,1:9)] <- tr2[cbind(1:9,1:9)]
  tr1[1:9,1:9] <- tr2[1:9,1:9]
  tr1[1:5,1:5]

Any ideas?

Thanks!

1 Answers
Related