Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8073419
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T14:20:10+00:00 2026-06-05T14:20:10+00:00

Currently: path.expand(~) Gives: C:\\Users\\trinker\\Documents I want it to yield: C:\\Users\\trinker The directory for the

  • 0

Currently:

path.expand("~")

Gives:

"C:\\Users\\trinker\\Documents"

I want it to yield:

"C:\\Users\\trinker"

The directory for the windows command prompt is C:\Users\trinker. This indicates that this is my windows home directory.

?path.expand tells me to look at the rw-FAQ (LINK). This gives information above my cognitive ability. I decided to try to experiment as below:

> Sys.getenv("R_USER")
[1] "C:\\Users\\trinker\\Documents"
> normalizePath("~")
[1] "C:\\Users\\trinker\\Documents"

> Sys.getenv("R_USER") <- "C:\\Users\\trinker"
Error in Sys.getenv("R_USER") <- "C:\\Users\\trinker" : 
  target of assignment expands to non-language object
> normalizePath("~") <- "C:\\Users\\trinker"
Error in normalizePath("~") <- "C:\\Users\\trinker" : 
  target of assignment expands to non-language object 

I saw:

Sys.setenv(...)
Sys.unsetenv(x)

But got scared I was messing with things I ought not be blindly messing with and decided to ask for guidance.

So again I would like to have ~ mean C:\\Users\\trinker\\ again (this was the default for my last PC) not the C:\\Users\\trinker\\Documents it is now.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T14:20:11+00:00Added an answer on June 5, 2026 at 2:20 pm

    To persistently reset the directory that "~" resolves to for all users, put the following in the file Renviron.site, located in $RHOME/etc/Renviron.site:

    R_USER="C:/Users/trinker"
    

    (If the file is not already there, you can just create it yourself.)


    If a computer supports multiple R users, and each wants to set their own R_USER location, each can put the following in their own ".Rprofile" file:

    Sys.setenv(R_USER = "C:/Users/trinker")
    

    ".Rprofile" is looked for in the user’s home directory, which is returned by typing Sys.getenv("HOME"). See ?Startup and the R for Windows FAQ for more details.

    (Thanks to @Dason for pointing out the .Rprofile option.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I currently have this as a search: <%= form_tag users_path, :controller => 'users', :action
I want to set the path for a TShellListView to display a directory of
I currently have a filesystem path I would like to index into a SQL
Currently my eclipse source folder display the entire package path and java files under
I currently have a varchar(255) column that stores the path to a small image
How do I find the full path of the currently running Python interpreter from
How can I get the current working directory and get the path without the
Say the path of the file 'file1.txt' is /home/bentley4/Desktop/sc/file1.txt Say my current working directory
I need to keep an NSPathControl updated with the currently selected path in an
I have this route: routes.MapRoute(null, Users/{id}/Summary, new { controller = Users, action = GetSummary

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.