Error message that my dataset does not exist when I try to load a dta file into R

370 Views Asked by At

I am trying to load DTA file into R. How do I get a file to exist that R tells me doesn't exist when I am trying to load it? I have also tried loading an SAV file through SPSS in the import dataset function in R but I get the same error message that the file does not exist.

install.packages('haven')
library(haven)
data<-read_dta('C:/Users/myname/Downloads/anes_timeseries_2016_dta%20(4).zip')

in the console, after I try to run it, I get

> data<-read_dta('C:/Users/myname/Downloads/anes_timeseries_2016_dta%20(4).zip')
Error: 'C:/Users/myname/Downloads/anes_timeseries_2016_dta%20(4).zip' does not exist.
> install.packages("haven")
trying URL 'https://cran.rstudio.com/bin/macosx/big-sur-arm64/contrib/4.1/haven_2.5.1.tgz'
Content type 'application/x-gzip' length 1068665 bytes (1.0 MB)
==================================================
downloaded 1.0 MB


The downloaded binary packages are in
    /var/folders/kb/nlv1ctzx5ssb3ncqkbts9zr80000gn/T//RtmpJWiKhR/downloaded_packages

I see that the error message says

'C:/Users/myname/Downloads/anes_timeseries_2016_dta%20(4).zip' does not exist

But I'm trying to get it to exist. Ho do I make it exist as I try to download it? It's in my downloads on my laptop. So, how do I get

'C:/Users/myname/Downloads/anes_timeseries_2016_dta%20(4).zip'
0

There are 0 best solutions below