Thanks going to look into those new ones.
On Friday, August 26, 2016 at 10:28:16 PM UTC-4, tshort wrote: > > The DataFramesMeta.jl package has one approach. Two new kids on the block: > jplyr.jl and Query.jl have different approaches for that type of function. > > On Aug 26, 2016 1:38 PM, <jtwa...@gmail.com <javascript:>> wrote: > > Hi, > > I'm exited about Julia. Coming from an R and SAS background I am trying > to develop some familiar tools to manipulate and query data. So far here > are some of the things I have, but I just want feedback to see if there is > a better way. The following code attempts to create a summarize() function > similar to that of dplyr in R. But the call is a bit odd to look at (see > below). Is there something I can do to avoid using :() or quotes? > > # function definitions are below > > using DataFrames > > dat = DataFrame(x=rand(10), y=rand(10)) > summary = summarize(dat, mu_x = :(mean(:x)), mu_y = :(mean(:y))); > > > # Function definitions manipulate expressions (Expr types) to > # access data frame elements > > function df_statement(df, u::Expr) > > t = u > arg_id = 1 > > for ar in t.args > if typeof(ar) == QuoteNode > t.args[arg_id] = df[eval(ar)] > elseif typeof(ar) == Expr > df_statement(df, ar) > end > arg_id += 1 > end > > return eval(t) > > end > > > function summarize(df; kwargs...) > > df_out = DataFrame() > > for (key, value) in kwargs > df_out[Symbol(key)] = df_statement(df, value) > end > > return df_out > > end > > >