I am Economics Lead at Zalando SE conducting user experience research to developing new platform steering mechanisms. I am also a visiting research fellow at the Institute for Quantitative Social Science, Harvard University developing innovative statistical software and applications for the social and physical sciences. I previously held posts at City, Univeristy of London, the Hertie School of Governance, Yonsei University, and the London School of Economics where in 2012 I completed a PhD in quantitative political science. My academic research focuses on the international political economy of public financial and monetary institutions, as well as applied social science statistics. My work has been published in peer reviewed journals including the British Journal of Political Science, Journal of Common Market Studies, Journal of Peace Research, International Studies Quarterly, Journal of European Public Policy, Review of International Political Economy, Political Science Research and Methods, and Journal of Statistical Software. I have co-authored a number of pieces on European banking union for the Bruegel Policy Contribution series. I published a book on reproducible computational research methods for Chapman and Hall.
For more details, please see my CV.
I often want to quickly create a lag or lead variable in an R data frame. Sometimes I also want to create the lag or lead variable for different groups in a data frame, for example, if I want to lag GDP for each country in a data frame.I've found the various R methods for doing this hard to remember and usually need to look at old blogposts. Any time we find ourselves using the same series of codes over and over, it's probably time to put them into a function. So, I added a new command–slide–to the DataCombine R package (v0.1.5).Building on the shift function TszKin Julian posted on his blog, slide allows you to slide a variable up by any time unit to create a lead or down to create a lag. It returns the lag/lead variable to a new column in your data frame. It works with both data that has one observed unit and with time-series cross-sectional data.Note: your data needs to be in ascending time order with equally spaced time increments. For example 1995, 1996, 1997. ExamplesNot…