Open mahagadorn opened 8 years ago
for(i in 1:nrow(mid.points)){
gmat[mid.points[i,]] <- diamond.step(gmat[mid.points[i,]])
}
...your problem now is that the mid-points aren't enough: you need to give it a range. What you're doing now is the equivalent of typing mat[3,3]
when you should be typing mat[1:3,1:3]
. Make sense?
Yes, that makes sense! I made the adjustment to the code...still getting an error message. Perhaps is how i set up the midpoints?
diamond.square.step<- function(g.mat){
#Apply diamond sqaure steps to the inital matrix
g.mat<-diamond.step(g.mat)
g.mat<- square.step(g.mat)
#we want to create the mid points for the sub-quadrants
#preallocate the midpoint matrix
Top.mid <- c(1, ceiling((1/4)*ncol(g.mat)), ceiling((1/2)*ncol(g.mat)), ceiling((3/4)*ncol(g.mat)), ncol(g.mat))
Bot.mid <- c(1, ceiling((1/4)*nrow(g.mat)), ceiling((1/2)*nrow(g.mat)), ceiling((3/4)*nrow(g.mat)), nrow(g.mat))
mid.points <- expand.grid(Bot.mid, Top.mid) #list of all our midpoints
for(i in 1:nrow(mid.points)){
g.mat[mid.points[i,]] <- diamond.step(g.mat[mid.points[i,]])
}
return(gmat)
}
diamond.square.step(g.mat)
#Error in g.mat[mid.points[i, ]] : invalid subscript type 'list'
Read both of my comments. You've just copy-pasted one of them without reading the other...
I just want you to know I FINALLY see my mistake!!!!! Thanks for not telling me how to do it. Both my duck and I cried at the sight of a completed terrain matrix :D
No worries. Remember this feeling: it gets easier, but it never stops being so satisfying. In three years, when you have your first package on CRAN, you will think of this terrain and smile :D On Mon, 14 Nov 2016 at 23:07, mahagadorn notifications@github.com wrote:
I just want you to know I FINALLY see my mistake!!!!! Thanks for not telling me how to do it. Both my duck and I cried at the sight of a completed terrain matrix :D
— You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub https://github.com/pearselab/r-world-mahagadorn/issues/3#issuecomment-260493530, or mute the thread https://github.com/notifications/unsubscribe-auth/ABLcUpHth4QTHd8LakpZCFYfpUjCLy30ks5q-OmrgaJpZM4KtEMz .
Hi Will,
I am still having issues with the terrain. I have uploaded a "Diamond.Step.Fails" that contains what I am trying to work though. I've been doing it all day since we have talked and haven't progressed much farther.
What am I missing here?? AHHHH.
Alex is also still struggling! @AlexRego