Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get windows system folders (user home directory, "My documents", etc) path in R

Tags:

r

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?

like image 321
Vasily A Avatar asked Feb 20 '15 02:02

Vasily A


People also ask

What is the path for my documents?

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.

How do I find the users folder in Windows?

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 .

Where is my home directory windows?

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.


1 Answers

With the package fs, you can also get the home directory:

library(fs)

path_home()

like image 83
Lisa B. Avatar answered Nov 12 '22 15:11

Lisa B.