daru

https://github.com/sciruby/daru

Ruby

Data Analysis in RUby

Daru::Vector#initialize

Create a Vector object.

== Arguments

Hash. If Array, a numeric index will be created if not supplied in the
options. Specifying more index elements than actual values in *source*
will insert *nil* into the surplus index elements. When a Hash is specified,
the keys of the Hash are taken as the index elements and the corresponding
values as the values that populate the vector.

== Options

* +:name+  - Name of the vector

* +:index+ - Index of the vector

* +:dtype+ - The underlying data type. Can be :array, :nmatrix or :gsl.
Default :array.

* +:nm_dtype+ - For NMatrix, the data type of the numbers. See the NMatrix docs for
further information on supported data type.

* +:missing_values+ - An Array of the values that are to be treated as 'missing'.
nil is the default missing value.

== Usage

  vecarr = Daru::Vector.new [1,2,3,4], index: [:a, :e, :i, :o]
  vechsh = Daru::Vector.new({a: 1, e: 2, i: 3, o: 4})

Source | Google | Stack overflow

Edit

git clone [email protected]:sciruby/daru.git

cd daru

open lib/daru/vector.rb

Contribute

# Make a new branch

git checkout -b -your-name--update-docs-Daru--Vector-initialize-for-pr


# Commit to git

git add lib/daru/vector.rbgit commit -m "better docs for Daru::Vector#initialize"


# Open pull request

gem install hub # on a mac you can `brew install hub`

hub fork

git push <your name> -your-name--update-docs-Daru--Vector-initialize-for-pr

hub pull-request


# Celebrate!