How to extract the survey data [message #29388] |
Tue, 11 June 2024 10:06 |
26tanishabanik
Messages: 4 Registered: June 2024
|
Member |
|
|
Hi,
I was wondering if anyone or who has already explored the datasets guide me in extracting the survey data without using Stata or SPSS software but using a programming language. I have tried using R but since the files are so big, R studio is not able to load it
Thanks,
Tanisha Banik
|
|
|
|
Re: How to extract the survey data [message #29408 is a reply to message #29391] |
Wed, 12 June 2024 08:46 |
Bridgette-DHS
Messages: 3199 Registered: February 2013
|
Senior Member |
|
|
Following is a response from Senior DHS staff member, Ali Roghani:
To load a DHS data file directly into R without using Stata or SPSS, you can use the haven package. Here's an example of how to do it:
library(haven)
data <- read_dta("your_directory/your_file_name.DTA")
You should use your file path in the read_dta function.
[Updated on: Wed, 12 June 2024 13:20] Report message to a moderator
|
|
|
|
Re: How to extract the survey data [message #29410 is a reply to message #29409] |
Wed, 12 June 2024 16:25 |
Bridgette-DHS
Messages: 3199 Registered: February 2013
|
Senior Member |
|
|
Following is a response from Senior DHS staff member, Ali Roghani:
Usually, with `read_dta`, you can import the data. Make sure your data is in DTA format. Two approaches can be helpful in dealing with this technical issue related to the machine/laptop.
First, you can run this code in RStudio:
```R
Sys.setenv(R_MAX_VSIZE = 16e9)
```
You might need to change the size too.
The second approach is:
1. Open Terminal
2. Run the following commands:
```sh
cd ~
touch .Renviron
open .Renviron
```
3. Save the following as the first line of .Renviron:
```sh
R_MAX_VSIZE=16Gb
```
4. Close RStudio and reopen it
You might need to adjust this parameter depending on the specifications of your machine. Please let us know whether one of these approaches works for you.
[Updated on: Thu, 13 June 2024 06:33] Report message to a moderator
|
|
|