The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Data » Dataset use (other programs) » import data file to R
import data file to R [message #13979] Wed, 31 January 2018 10:37 Go to next message
Messages: 3
Registered: January 2018
Location: Toulouse
I am conducting research on sexual violence. I am interested in utilizing the household and woman interviews. Let's take the example of the folder "ETHR70FL"

I gave 2 questions:

(1) I manage to download the files but I cannot import the data into R. How to do this?

I read the response of Trevor to message #11707 saying that I should do this:
dta <- read.dta("PKBR21FL.dta", convert.factors = FALSE)

but I do not have a .dta file in my folder (I only have a .DAT .DCF .DCT .SAS and .SPS) and when I do read.dta("ETHR70FL.DAT", convert.factors = FALSE) it does not work: "Error in xx : not a Stata version 5-12 .dta file"

(2) where are the headers of the columns?
I actually manage to open the .DAT file with read.table in R but I wonder where the column labels are? There is no header in the .DAT file. In the associated .DCF file, there is a list of [Item] which I suppose are the corresponding columns' names but the number of columns in the .DAT file and the number of different [Item] in the .DCF do not correspond.

Many thanks for your help.

Re: import data file to R [message #13980 is a reply to message #13979] Wed, 31 January 2018 10:49 Go to previous message
Bridgette-DHS is currently offline  Bridgette-DHS
Messages: 3114
Registered: February 2013
Senior Member
Please login to your account and download the following zip file, which will contain the .DTA file:

ETHR70DT.ZIP Stata dataset (.dta)
Previous Topic: filtering hhid in the HR file using R after importing in haven and using dplyr
Next Topic: Harmonised region variable
Goto Forum:

Current Time: Wed Jul 17 15:37:14 Coordinated Universal Time 2024