I would like to get the full path of user's home folder (usually something like C:\Users\%USERNAME%) or "My documents" folder and can't find the way to do this from R script. Is there any solution for this?
To view the full path of an individual file: Click the Start button and then click Computer, click to open the location of the desired file, hold down the Shift key and right-click the file. Copy As Path: Click this option to paste the full file path into a document.
You can open it from the Start menu (Windows System → File Explorer). Or, press the keyboard shortcut Windows key + E (hold down the Windows key and press E). Click in the location bar. Type %USERPROFILE% and press Enter .
Starting with Windows Vista, the Windows home directory is \user\username. In prior Windows versions, it was \Documents and Settings\username. In the Mac, the home directory is /users/username, and in most Linux/Unix systems, it is /home/username.
With the package fs
, you can also get the home directory:
library(fs)
path_home()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With