search for: x_unit

Displaying 1 result from an estimated 1 matches for "x_unit".

Did you mean: y_unit
2011 Oct 03
3
Best method to add unit information to dataframe ?
...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, "units") <- c("x_unit", "y_unit") # # later on, using dataframe for (var_name in c("x", "y")) { idx <- match(var_name, attr(my_frame, "names")) var_unit <- attr(my_frame, "units")[[idx]] print (paste("max ", var_name, ": ", max(my...