It took me a long time to understand R's dimension indication, coming myself from octave before R. I think I never really got used to it, I always need to think twice in R. My way of remembering the R semantics is that the dimensions indicate the dimensions that you are left with after the operation (marginalizing, I suppose).
That said, I did appreciate R's general approach towards specifying dimensions, as in `apply(fourdimarray, c(2,3), sum)`. But you can do this in Julia as well. I prefer the Julia semantics, though. ---david On Sunday, October 26, 2014 4:33:28 PM UTC+1, John Myles White wrote: > > size(m, 1) — counts _over_ rows > > sum(m, 1) — sums _over_ rows > > So no mixup, just a different perspective than you’re taking right now. > > My best advice: discard everything you know about R while using Julia. If > you’ve used Matlab, that will be much more useful as an analogy for how > Julia works. > > — John > > On Oct 26, 2014, at 4:59 AM, Justas _ <[email protected] <javascript:>> > wrote: > > I am a bit confused. Take a look: > > size(m, 1) # returns size of rows > size(m, 2) # returns size of columns > > sum(m, 1) # sums columns > sum(m, 2) # sums rows > > Also, I have R background, and there 1 is used for rows, 2 - for columns. > > Why Julia mixes this up? > > >
