edquant / edh7916

Course materials and website for EDH7916: Contemporary Research in Higher Education
https://edquant.github.io/edh7916/
3 stars 1 forks source link

Cannot open .dta (Stata) file? #36

Closed nszekeres closed 4 years ago

nszekeres commented 4 years ago

Hi, Dr. Skinner - I'm trying to do assignment 8 but I can't read in the data... it keeps telling me it can't find function for "read_dta"? I've closed R studio several times and even rebooted my computer... do you know if there is a specific library I have to manually call to use this function??

`package ‘survey’ successfully unpacked and MD5 sums checked The downloaded binary packages are in C:\Users\Naomi\AppData\Local\Temp\RtmpS8mU6p\downloaded_packages

dat_dir <- file.path("..", "data") df <- read_dta(file.path(dat_dir, "els_plans.dta")) Error in read_dta(file.path(dat_dir, "els_plans.dta")) : could not find function "read_dta" `

Thanks, Naomi

nszekeres commented 4 years ago

I think installing Haven fixed it... but @btskinner, is that normal that I have to call Haven to read stata-data??

btskinner commented 4 years ago

@nszekeres: yes, you need to load library(haven) in order to read in data from Stata (or SPSS or SAS). It's one of those -in-between packages I mentioned. It's part of the tidyverse and installed when you do install.packages("tidyverse"), but isn't of the core packages loaded when you call library(tidyverse). That's why you have to load it separately.

nszekeres commented 4 years ago

@btskinner - thanks...