Skip to contents

Authors: Hongyu Mou (UCLA); Licheng Liu (MIT); Yiqing Xu (Stanford)

Date: Sep 24, 2023

Repos: Github (1.1.17) CRAN (1.1.17)

Examples: R code used in the tutorial can be downloaded from here.


Description

panelView visualizes panel data. It has three main functionalities:

  1. it plots treatment status and missing values in a panel dataset;
  2. it plots the temporal dynamics of an outcome variable (or any variable) in a panel dataset;
  3. it visualizes bivariate relationships of two variables by unit or in aggregate.

Installation

You can install the up-to-date development version from GitHub:

# if not already installed
install.packages('devtools', repos = 'http://cran.us.r-project.org') 

# note: "V" is capitalized
devtools::install_github('xuyiqing/panelView') 

You can also install the panelView package from CRAN:

install.packages('panelView') 

If you encounter an installation/execution error, please remove the old package and reinstall panelView.

remove.packages('panelView') 
# or
remove.packages('panelview') # package name "panelview" no longer in use

Tutorial & Paper

For example, plot treatment status in a panel dataset:

library(panelView)
data(panelView)
panelview(turnout ~ policy_edr + policy_mail_in + policy_motor, 
          data = turnout, index = c("abb","year"), 
          xlab = "Year", ylab = "State")

Note that “V” in the package name is capitalized while “v” in the function name is not—to be consistent with the Stata version.

See the tutorial page for more details.

For a paper version of the tutorial, see Mou, Liu & Xu (2023): “Panel Data Visualization in R (panelView) and Stata (panelview).”

Report bugs

Please report bugs to yiqingxu [at] stanford.edu with your sample code and data file. Much appreciated!