Summarizing data tables¶
Here we use data from the British Election Study 2010. The data set bes2010feelings.RData is prepared from the original available at https://www.britishelectionstudy.com/data-object/2010-bes-cross-section/ by removing identifying information and scrambling the data.
Mean <- function(x) mean(x,na.rm=TRUE) bes2010feelings[,.(Brown=Mean(flng.brown), Cameron=Mean(flng.cameron), Clegg=Mean(flng.clegg), N=.N)]
Brown Cameron Clegg N 1 4.406517 5.162484 4.850231 5010
bes2010feelings[,.(Brown=Mean(flng.brown), Cameron=Mean(flng.cameron), Clegg=Mean(flng.clegg), N=.N), by=.(wave,region)]
wave region Brown Cameron Clegg N 1 Pre England 4.092674 5.284810 4.618690 1159 2 Pre NA 4.507143 4.929870 4.426573 437 3 Pre Scotland 5.395000 4.502591 4.405229 207 4 Pre Wales 4.328244 4.774194 4.592233 132 5 Post England 4.140990 5.441454 5.160313 2175 6 Post Scotland 5.510769 4.539075 4.513793 665 7 Post Wales 4.307692 4.855895 4.814480 235
Downloadable R script and interactive version
The link with the “jupyterhub” icon directs you to an interactive Jupyter1 notebook, which runs inside a Docker container2. There are two variants of the interative notebook. One shuts down after 60 seconds and does not require a sign it. The other requires sign in using your ORCID3 credentials, yet shuts down only after 24 hours. (There is no guarantee that such a container persists that long, it may be shut down earlier for maintenance purposes.) After shutdown all data within the container will be reset, i.e. all files created by the user will be deleted.4
Above you see a rendered version of the Jupyter notebook.5
ORCID is a free service for the authentication of researchers. It also allows to showcase publications and contributions to the academic community such as peer review.. See
https://info.orcid.org/what-is-orcid/for more information.
The Jupyter notebooks come with NO WARRANTY whatsoever. They are provided for educational and illustrative purposes only. Do not use them for production work.
The notebook is rendered with the help of the nbsphinx extension.