Yes, you're right, that won't work.

I got to thinking about this from this part of the DataFrames documentation:
http://dataframesjl.readthedocs.org/en/latest/getting_started.html#the-dataframe-type

df = DataFrame(A = 1:4, B = ["M", "F", "F", "M"])

and this code

df = DataFrame() 
df[:A] = 1:8 
df[:B] = ["M", "F", "F", "M", "F", "M", "M", "F"] 
df

If I already had arrays A and B (or an arbitrary number of them) it would be 
nice to be able to do

df = DataFrame(A, B)

and then df would have column names :A and :B.



On Friday, July 3, 2015 at 7:24:55 PM UTC-5, Yichao Yu wrote:
>
> On Fri, Jul 3, 2015 at 8:21 PM, Kevin Owens <kevin....@gmail.com 
> <javascript:>> wrote: 
> > Gah, nevermind: 
> > 
> > function as_symbol(x) 
> >     :(print(x)).args[2] 
> > end 
>
> This is almost certainly not what you want unless you just want a 
> function that returns `:x`, in which case, you would be better off to 
> just return that. 
>
> Can you elaborate on what exactly you would like to do? Depending on 
> what you really want, there are different ways to implement. 
>
> > 
> > 
> > (using print() so that it works regardless of the type) 
> > 
> > 
> > On Friday, July 3, 2015 at 7:16:38 PM UTC-5, Kevin Owens wrote: 
> >> 
> >> Say you have an array 
> >> 
> >> x = rand(5) 
> >> 
> >> or just any variable 
> >> 
> >> y = "abc" 
> >> 
> >> How would I write a function that I would call like foo(x) and would 
> >> return the symbol :x? 
>

Reply via email to