Publications by markheckmann
R: Combining vectors or data frames of unequal length into one data frame
Today I will treat a problem I encounter every once in a while. Let’s suppose we have several dataframes or vectors of unequel length but with partly matching column names, just like the following ones: df1 <- data.frame(Intercept = .4, x1=.4, x2=.2, x3=.7) df2 <- data.frame(Intercept = .5, x2=.8 ) This for example m...
2918 sym R (1345 sym/12 pcs) 12 img
R: Calculating all possible linear regression models for a given set of predictors
Although the graphic at the left might not seem a 100% appropriate, it gives a hint to what I am about to do. I want to calculate all possible linear regression models with one dependent and several independent variables. I do not want to address bias and fitting issues or the question if this makes sense from a statistical point of view in this...
3735 sym R (3369 sym/12 pcs) 14 img
R: Good practice – adding footnotes to graphics
In some statistical programs there is the option available to attach a footnote to the graphical output that is created. This footnote may contain the name of the script or the file that produced the graphic, the author’s name and the date of creation. In SAS for example there is a footnote command to achieve this. Ever since I realized that th...
1250 sym R (1146 sym/1 pcs) 16 img
R: Monitoring the function progress with a progress bar
Every once in while I have to write a function that contains a loop doing thousands or millions of calculations. To make sure that the function does not get stuck in an endless loop or just to fulfill the human need of control it is useful to monitor the progress. So first I tried the following: ################################################...
1425 sym R (1620 sym/5 pcs) 18 img
R: Zip fastener for two data frames / combining rows or columns of two dataframes in an alternating manner
Sometimes I find it useful to merge two data frames like the following ones X1 X2 X3 X4 Y1 Y2 Y3 Y4 1 o o o o X X X X 2 o o o o X X X X 3 o o o o X X X X by using zip feeding either along the columns X1 Y1 X2 Y2 X3 Y3 X4 Y4 1 o X o X o X o X 2 o X o X o X o X 3 o X...
1253 sym R (2699 sym/5 pcs) 20 img
How accurate or reliable are R calculations?
On the REvolutions Blog there is a nice posting treating the often raised concern on “How good or reliable R is”. At my university R is hardly used. Sometimes I was asked by lecturers wether the calculations done by R and its packages are accurate. The linked posting treats this matter and tries to clarify this point. Related To leave a com...
725 sym 16 img
R: Building functions – using default settings that can be modified via the dot-dot-dot / three point argument
Before you read this post, please have a look at Enrique’s comment below. He pointed out that the built-in R function modifyList() already does what I wanted to describe in this post. Well, I live to learn 🙂 I was wondering how I could write a function that uses default settings but accepts a list to overwrite the default settings via the do...
810 sym R (2336 sym/2 pcs) 16 img
Getting started with R (for german speakers)
Just a little note for german speaking R beginners: There is an introductory course in R (german) available online on the website of the department of methodology and evaluation research at the University of Jena. Dr. Ivailo Partchev holds a seven sessions course on that topic (duration 11.5 hours). Related To leave a comment for the author, pl...
706 sym 16 img
R: Function to create tables in LaTex or Lyx to display regression model results
Most people using LaTex feel that creating tables is no fun. Some days ago I stumbled across a neat function written by Paul Johnson that produces LaTex code as well as LaTex code that can be used within Lyx. The output can be used for regression models and looks like output from the Stata outreg command. His R function that produces the LaTex co...
1294 sym R (1289 sym/1 pcs) 6 img
Infomaps using R – Visualizing German unemployment rates by district on a map
Lately, David Smith from REvolution Computing set out to challenge the R community with the reprocuction of a beautiful choropleth map (= multiple regions map/thematic map) on US unemployment rates he had seen on the Flowing Data blog. Here you can find the impressing results. Being a fan of beautiful visualizations I tried to produce a similar m...
4189 sym R (2395 sym/4 pcs) 14 img