Question

I'm trying to write binary text files from a data frame in Julia using something along the lines of:

for x in RICT["$i"]["Sick"]

    write(f9, convert(Int16, x ))

and everything works nicely except for when it comes to NA values. Missing values are treated as NA it seems, and I know that there are different ways of handling such values using the data frames package. Does anyone have any experience with these NAtypes? Should I convert the NAtypes to a more conventional type and then write them in? As always any help is much appreciated.

Was it helpful?

Solution

If you are writing a 16-byte integer value, there's no canonical representation of "blank", so you'd have to pick a special 16-byte integer value that represents NA. A common choice for this kind of thing is the smallest representable value – in this case typemin(Int16) == -32768. You can generalize this to other signed integer types.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top