Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added pander method for data.table class #241

Merged
merged 3 commits into from
Feb 14, 2016

Conversation

gerrymanoim
Copy link
Contributor

data.table drops row name attributes and uses keys instead. While this is useful, it makes it a bit annoying to use with pander. This function grabs the first key (if there is one), removes it from the table, and sets it as the row name attribute.

The x <- x[ ,!(colnames(x) %in% key(test)[1])] is not the most elegant, but I wasn't sure if there was a better way to do this.

data.table drops row name attributes and uses keys instead. While this
is useful, it makes it a bit annoying to use with pander. This function
grabs the first key (if there is one), removes it from the table, and
sets it as the row name attribute.
}
if(haskey(x)){

row.names.dt <- test[[key(test)[1]]]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test should be x here, no? And also below.

@daroczig
Copy link
Member

Sorry for the long delay with my reply! First of all, thank you very much for this PR, indeed makes a lot of sense, but I've just added 2 comment above -- can you please address those? Also, I think this feature should be optional, or at least there should be a way to disable that, so can we have an extra argument for pander.data.table to disable/enable this feature?

@gerrymanoim
Copy link
Contributor Author

Whoops - good call on the test variable, it should be x. And setdiff would work much better!

I'll address those two points and make it optional. Thanks for the feedback.

Removed test variables and made functionality actually work. Use
setdiff for column selection.
@gerrymanoim gerrymanoim reopened this Feb 14, 2016
daroczig added a commit that referenced this pull request Feb 14, 2016
Added pander method for data.table class
@daroczig daroczig merged commit 8be257d into Rapporter:master Feb 14, 2016
@daroczig
Copy link
Member

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants