Displaying 1 result from an estimated 1 matches for "var_unit".
Did you mean:
val_unit
2011 Oct 03
3
Best method to add unit information to dataframe ?
...me store information about the units of
the data it contains.
You'll find below a minimal exemple of the way I do, so far. I add a
"units" attribute to the dataframe. But I dont' like the long syntax
needed to access to the unit of a given variable (namely, something
like :
var_unit <- attr(my_frame, "units")[[match(var_name, attr(my_frame,
"names"))]]
Can anybody point me to a better solution ?
Thanks in advance,
Bruno.
# Dataframe creation
x <- c(1:10)
y <- c(11:20)
z <- c(101:110)
my_frame <- data.frame(x, y, z)
attr(my_frame, "...