Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Column headers not aligned to their data for hb.get.data.frame()

32 views
Skip to first unread message

Spencer Herath

unread,
Jun 18, 2014, 2:21:12 PM6/18/14
to rha...@googlegroups.com
This isn't so much a question as it is a bug report, and recommendation for an easy fix.

I've noticed that when using hb.get.data.frame(), if the columns you specify are not sorted in alphabetical order, then the column headers won't align to the actual data inside the data frame.  This happens because HBase pushes back the column names in alphabetical order, so the column data is aligned by the sorted order of the column names, but the column header assignment uses the initial columns parameter (which may not be sorted).

A very simple fix might be to sort columns before it is used to assign the column names of the data frame g.

...
g <- as.data.frame(lapply(1:length(columns), function(cc) unlist(lapply(lapply(f, 
            "[[", 3), "[[", cc))))
rownames(g) <- unlist(lapply(f, "[[", 1))
colnames(g) <- sort(columns)
g
...

Antonio Piccolboni

unread,
Aug 27, 2014, 3:13:18 PM8/27/14
to rha...@googlegroups.com
Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages