Articles by R on Abhijit Dasgupta

Selecting columns based on type

October 31, 2019 | R on Abhijit Dasgupta

The tidyverse and, in particular, dplyr, provides functions to select columns from a data frame. There are three scoped functions available: select_all, select_if and select_at. In this post, we’ll look at a particular application of select_if, i.e., capturing the names of numeric variables. A ...
[Read more...]

Templated output in R

April 28, 2019 | R on Abhijit Dasgupta

Earo Wang, who is the curator for the We are R-Ladies twitter feed this week (last week of April, 2019), had a really nice tweet about using the whisker package to create a template incorporating text and data in R. Her example created a list of tidyverse packages with descriptions. I ... [Read more...]

Modifying Excel Files using openxlsx

October 15, 2018 | R on Abhijit Dasgupta

I’ve been creating several output tables for a paper, which I usually store as sheets in an Excel file, since my collaborators are entirely in the Microsoft Office ecosystem. One issue I often run into is having to modify a single sheet in that file with updated data, while ... [Read more...]

Bootstrapping clustered data

August 29, 2018 | R on Abhijit Dasgupta

When evaluating the sampling variability of different statistics, I’ll often use the bootstrap procedure to resample my data, compute the statistic on each sample, and look at the distribution of the statistic over several bootstrap samples. In principle, the bootstrap is straightforward to do. However, if you have correlated ...
[Read more...]

Joint Statistical Meetings Talk

July 31, 2018 | R on Abhijit Dasgupta

The Joint Statistical Meetings are being held in the beautiful city of Vancouver, British Columbia this year. I gave a talk on data visualization this year, which is a new one for me, but an area I’m quite excited about. I’ve been looking into the newer toolsets using ... [Read more...]

Cleaning up tables

May 15, 2018 | R on Abhijit Dasgupta

Context One of things I have to do quite often is create tables for papers and presentations. Often the “Table 1” of a paper has descriptives about the study, broken down by subgroups. For presentation purposes, it doesn’t look good (to me, at least) that the name of each subgroup ... [Read more...]

Tidying messy Excel data (tidyxl)

May 1, 2018 | R on Abhijit Dasgupta

Well, here’s what I was dealing with: Exemplar Excel file from collaborator Notice that we have 3 header rows, first with patient IDs, second with spine region, and third with variable names (A and B, to protect the innocent). Goal A dataset that, for each patient and each angle gives ...
[Read more...]

Tidying messy Excel data (Introduction)

April 30, 2018 | R on Abhijit Dasgupta

Personal expressiveness, or how data is stored in a spreadsheet When you get data from a broad research community, the variability in how that data is formatted and stored is truly astonishing. Of course there are the standardized formats that are output from machines, like Next Generation Sequencing and other ... [Read more...]

Finding my Dropbox in R

July 4, 2017 | R on Abhijit Dasgupta

I’ll often keep non-sensitive data on Dropbox so that I can access it on all my machines without gumming up git. I just wrote a small script to find the Dropbox location on each of my computers automatically. The crucial information is available here, from Dropbox. My small snippet ... [Read more...]

Copying tables from R to Outlook

February 27, 2017 | R on Abhijit Dasgupta

I work in an ecosystem that uses Outlook for e-mail. When I have to communicate results with collaborators one of the most frequent tasks I face is to take a tabular output in R (either a summary table or some sort of tabular output) and send it to collaborators in ... [Read more...]

Annotated Facets with ggplot2

October 19, 2016 | R on Abhijit Dasgupta

I was recently asked to do a panel of grouped boxplots of a continuous variable, with each panel representing a categorical grouping variable. This seems easy enough with ggplot2 and the facet_wrap function, but then my collaborator wanted p-values on the graphs! This post is my approach to the ...
[Read more...]

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)