From: "trans. (T. Onoma)" Date: 2004-10-13T23:13:12+09:00 Subject: Re: The Challenge of R On Wednesday 13 October 2004 04:24 am, Ara.T.Howard@noaa.gov wrote: | i did not write it, but narray does all that you want, and more, including | being extremely fast, doing simply display of data in X, and working | seamlessly with memory mapping: I did not know NArray worked elementwise. Nice. For numbers at least, that's one hell of a solution Ara ;) | jib:~ > cat a.rb | require 'narray' | | a = NArray[1..10] | b = a + 5 | p b | | c = b | pos = 0,1,2,4,6 # adjust R's 1 based idx to ruby's 0 based | c[pos] = c[pos] * 10 | p c | | d = c | d[(d % 2).eq(0).where] = -1 | p d | | jib:~ > ruby a.rb | NArray.int(10): | [ 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 ] | NArray.int(10): | [ 60, 70, 80, 9, 100, 11, 120, 13, 14, 15 ] | NArray.int(10): | [ -1, -1, -1, 9, -1, 11, -1, 13, -1, 15 ] | | you can thank Masahiro Tanaka for such a great work. | | http://www.ir.isas.ac.jp/~masa/ruby/index-e.html Double thanks! T.