R-Bloggers

Editable DataTables for Shiny Applications

RStudio recently updated Shiny to allow for editable DataTables. Their implementations allows for editing cells direclty with in the DataTable view. This is fine for many advanced applications, however, for many applications more fine tuned control of what the user can edit is necessary. For example, you may want to only allow a subset of columns to be editable. Or you want to view a subset of columns in a spreadsheet view but allow other columns to be editable.

Conducting Assessments and Surveys with Shiny

This post describes a framework for using Shiny for conducting, grading, and providing feedback for assessments. This framework supports any multiple choice format including multiple choice tests or Likert type surveys. A demo is available at jbryer.shinyapps.io/ShinyAssessmentTest or can be run locally as a Github Gist: runGist(‘a6fb5a3b1d5fd56cff64’) Key features of this framework include: Assessments take over the entire user interface for a distraction free assessment. Creating an assessment requires: A vector of item stems.

Shiny App for Bayes Billiards Problem

Consider a pool table of length one. An 8-ball is thrown such that the likelihood of its stopping point is uniform across the entire table (i.e. the table is perfectly level). The location of the 8-ball is recorded, but not known to the observer. Subsequent balls are thrown one at a time and all that is reported is whether the ball stopped to the left or right of the 8-ball. Given only this information, what is the position of the 8-ball?

Data Caching

Data caching is not new. It is often necessary to save intermediate data files when the process of loading and/or manipulating data takes a considerable amount of time. This problem is further complicated when working with dynamic data that changes regularly. In these situations it often sufficient to use data that is current with in some time frame (e.g. hourly, daily, weekly, monthly). One solution is to use a time-based job scheduler such as cron.

Women Graduates in Math, Statistics, and Computer Information Systems

One of the more interesting talks at this year’s useR! Conference was the heR Panel discussing the role of women in the R community. They estimate that fewer than 15% of package authors are women. One of the points brought up was that this is less than the percentage of women in statistics. Perhaps this is more related to the computer science aspect of R that that of statistics. By way of comparison, the United States Department of Labor estimates there are between 7.

useR 2014 Slides for PSAboot and version 1.1. on CRAN

str Implementation for Data Frames

The str function is perhaps the most useful function in R. It provides great information about the structure of some object. When I teach R, especially for those coming from SPSS, the str function for data frames provides the information they are use to seeing on the variable view tab. However, sometimes I want to display the information str returns in a better format (e.g. as an HTML or LaTeX table).

Rgitbook Package for Using R Markdown with Gitbook

Last week I published an R script to interface with Gitbook. I received some positive feedback and decided to include all the code in an R package. This also allowed me to make some nice additions including default support for MathJax. It is currently available on Github and can be installed using devtools: devtools::install_github(‘jbryer/Rgitbook’) I have only tested this on Mac OS X, so please provide suggestions or issues on other systems.

Albany, NY R Users Group

Function to Simplify Loading and Installing Packages

One of the more tedious parts of working with R is maintaining my R library. To make my R scripts reproducible and sharable, I will install packages if they are not available. For example, the top of my R scripts tend to look something like this: if(!require(devtools) | !require(ggplot2) | !require(psych) | !require(lme4) | !require(benchmark)) { install.packages(c(‘devtools’,‘ggplot2’,‘psych’,‘lme4’,‘benchmark’)) } This has worked fine for some time, but I felt there was a better approach.