Hi everybody,
I want to create a SAS xpt file with the function haven::write_xpt. Could somebody show me how to create the file in a directory different than the current working directory?
Thank you very much.
Ha
library(haven) # Version 2.4.1
#> Warning: package 'haven' was built under R version 4.0.5
R.version
#> _
#> platform x86_64-w64-mingw32
#> arch x86_64
#> os mingw32
#> system x86_64, mingw32
#> status
#> major 4
#> minor 0.4
#> year 2021
#> month 02
#> day 15
#> svn rev 80002
#> language R
#> version.string R version 4.0.4 (2021-02-15)
#> nickname Lost Library Book
# OK if creating the xpt file in current working directory
haven::write_xpt(mtcars, 'mtcars.xpt')
# This command will give an error
haven::write_xpt(mtcars, 'c:/downloads/mtcars.xpt')
#> Error: Failed to open 'c:\downloads\mtcars.xpt' for writing
Created on 2021-06-29 by the reprex package (v2.0.0)