Profile picture
Nick HK @nickchk
, 11 tweets, 3 min read Read on Twitter
Hey all! I'm excited to reveal my new R package. It fills a gap I've been sorely missing since I've been moving from Stata to R: a quick and easy VARIABLE BROWSER! One you can use Find-in-Page on, and variable labels! Introducing the package vtable()! (thread)
vtable() takes your data and spits out a formatted table of information about your variables. It then opens up that table in the Viewer pane (in RStudio) or in a web browser (elsewhere) so you can continue to refer to it while working on your data. Can give value details too.
It works with variable labels. Provide your own (in one of three flexible formats), or if you've embedded some with Hmisc/haven/sjlabelled, it will pick them up. It detects sjlabelled value labels too. All where Ctrl-F can repeatedly and reliably help you sort through vague names
Other bells n' whistles too. Can title or describe data, adjust the column widths, can output the table to a data frame, or save the HTML output to file. Also comes with the simpler-than-xtable-but-less-powerful dftoHTML which turns any data set to an HTML table.
I've long wished that R made it easier to glance at info about variables without having to repeatedly call head/glimpse, open up the full data, or rely on data providers to have a help(data) documentation file for you.
Plus, Hmisc/haven/sj allow you to work with variable labels, but actually looking at them is a pain. And Ctrl/Cmd-F is just so much easier than find_var(). vtable addresses both the variable-lookin' and the variable-label-lookin' issues.
Not to mention, you can save the vtable() output to file and distribute it alongside your data, which is handy if you're distributing it to non-R people so an Rd file wouldn't work.
Check it out yourself with
library(devtools)
install_github('NickCH-K/vtable')
library(vtable)
or get the example code I've been snapshotting here: pastebin.com/26NiSXnn
This is brand new, v0.1, so bug reports, suggestions, and git edits very welcome. /fin
[secretly very worried that someone is about to post about a function that already does all this, but heck, if there is, it's very well hidden. I do know about promptData() but I think that takes a fairly different approach]
Oops, really should have tagged this all #Rstats
Thread above ^^^
Well this is embarrassing... I'd been preparing things initially to show up in the Help pane but that proved unworkable, so I moved to Viewer. But I never noticed that Viewer doesn't have Ctrl/Cmd-F (why?)!!! That's no good. Opening in out="browser" will still allow Ctrl-F.
Missing some Tweet in this thread?
You can try to force a refresh.

Like this thread? Get email updates or save it to PDF!

Subscribe to Nick HK
Profile picture

Get real-time email alerts when new unrolls are available from this author!

This content may be removed anytime!

Twitter may remove this content at anytime, convert it as a PDF, save and print for later use!

Try unrolling a thread yourself!

how to unroll video

1) Follow Thread Reader App on Twitter so you can easily mention us!

2) Go to a Twitter thread (series of Tweets by the same owner) and mention us with a keyword "unroll" @threadreaderapp unroll

You can practice here first or read more on our help page!

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just three indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member and get exclusive features!

Premium member ($30.00/year)

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal Become our Patreon

Thank you for your support!