Yet Another Blog in Statistical Computing

I can calculate the motion of heavenly bodies but not the madness of people. -Isaac Newton

A Learning Section for Julia – Recoding A String Vector to A Integer Vector

julia> using RDatasets, DataFrames

julia> data = dataset("datasets", "iris");

julia> species = array(data[:, 5]);

julia> x = int([i == "setosa" for i in species]);

julia> sum(x)
50
Advertisements

Written by statcompute

October 7, 2014 at 11:34 pm

Posted in Julia

Tagged with

%d bloggers like this: