Use something like this:

julia> using DataFrames

julia> DataArray(Int, 10)
10-element DataArray{Int64,1}:
 NA
 NA
 NA
 NA
 NA
 NA
 NA
 NA
 NA
 NA

 — John

On Oct 12, 2014, at 12:05 PM, Westley Hennigh <[email protected]> wrote:

> Suppose that I want to create a new column of integers, default them all to 
> "not set" (in other words, NA), and then loop and initialize some of them 
> later.
> 
> I can't just `df[:C] = NA` because then I'll have a column that's an 
> Array{NA,1}...
> 
> So maybe I've got to do something like:
> df[:C] = fill!(Array(Any, size(df,1)), NA)
> 
> But then I'm sort of breaking the DataFrame structure (as I understand it). 
> Underneath, the DataFrame is suppose to be a nicely typed set of column 
> arrays, with a separate set of columns that contain values that indicate when 
> something is missing. What I just produced is a column with a very generic 
> type where all values are set and some just happen to be the special NA value.
> 
> Is there a better way to do this?
> 
> On Friday, May 16, 2014 7:10:06 AM UTC-4, Jason Solack wrote:
> Thank you!

Reply via email to