Export R file to spss dataset

Try the {haven} example

write_sav(mtcars, "mtcars.sav")

to see how that carries over into your SPSS environment. It's a solid package from Hadley Wickham, himself. I don't have a SPSS set-up, but I'd be extremely surprised if the example didn't work.

However, depending on what your use case writes to SPSS, I suppose it's possible that there could be a glitch. What I'd suggest is to test by creating a SPSS object, using read_sav to bring it into R, then simply change some value and write back. If that works, then the next step would be to see if the code being used in your problem creates any components that require more modification to be well-formed in SPSS. If you need more help, please come back with a reprex. See the FAQ: How to do a minimal reproducible example reprex for beginners.