7.5 Persistent user data

If you must…

For R version 4.0 or later (hence a version dependency is required or only conditional use is possible), packages may store user-specific data, configuration and cache files in their respective user directories obtained from tools::R_user_dir(), provided that by [sic] default sizes are kept as small as possible and the contents are actively managed (including removing outdated material).

Can use tools::R_user_dir() to get a file path for where to store the data in the user’s directory.

Do you really need to store data on the user’s disk? There might be other packages/tools that can help that you can use instead.