I recently found myself in the unpleasant situation of needing to read a Stata .dta file, but not having Stata readily available to me. Normally, I’d fire up a text editor and deconstruct the file, except Stata saves its data in a proprietary Binary format, meaning it garbles some of the content of the file. Lucky thing the R foreign library was there to save the day:
write.table(read.dta(file.choose()), file="output.csv", quote = FALSE, sep = ",")
It never ceases to amaze me how much raw functionality you can cram into one line of R code (without descending into line noise!).