set path in rstudio - r

Can anyone please guide me setting up the path in rstudio, why I cant change present working directory. what if I want to save a file on desktop and pull up the file in Rstudio.
Your help is appreciated.
thanks, sandy

Some of the most common reasons I have found where setting directory was a problem with the solution
Forgot the "" marks around the path example of correct setwd("Libraries/Documents")
Working in Windows and forgot to switch the back-slash to a forward slash, examples: WRONG-> "Libraries\Documents" RIGHT->"Libraries/Documents"
There path is on a shared system where they system denies that access (we have remote folders on servers at work that cannot be addressed this way)...IT security
The directory is not actually mapped as you stated, example possibly you do not need the Libraries part or you have to expressly include another level of folders above your current address
The directory has a different name, a capital letter, a space in it or something making addressing it on your system difficult
You are actually already in the wanted directory. as joel said, try getwd() to see where it says you are.
If none of this is your problem, post the error message and your system (linux, OS10.?, Windows 7 pro) and they setwd("path_to_stuff") you are using and we can try to get to the heart of the matter better.

Related

How to mask a folder name differently to WSL?

I am using Microsoft's OneDrive for Business provided by our university to sync big junks of data. I'm also using using a software to run some simulations which is not available for windows and I have to use WSL. Now the issue is that OneDrive folder name is like OneDrive - University of foobar and the software I'm using refuses to accept path names with spaces in it. Unfortunately as far as I know Microsoft has made it impossible to change the folder name for OneDrive for business. I have to find a way to fool WSL to think the folder name is different. something without spaces!
What I have tried:
I have tried ln -s link target but when running the software it considers the original folder
I have tried mount --bind link target but it behaves weirdly and I didn't get what I needed
I also tried the windows side using mklink /D link target it did not work either.
I would appreciate if you could help me know if there are any solutions to let the WSL see the folder name differently.
Wrong solution
Thanks to this post on Reddit I was able to solve this issue. I was using ln in a wrong way. The correct form is:
ln -s /target/path/with\ spaces/ /path/to/link/file
where file must not exist beforehand. Now WSL treats file as the target folder!

Accessing target of a windows shorcut

In linux machines, it is possible to access where a symbolic link is pointing to by using Sys.readlink function in R or readlink from the command line. Reading its documentation, we see that this is not intended for Windows shortcuts.
In Windows I have not been able to find a one liner to give me where the file points to. The closest I got was from this SO question that demonstrates the use of dir. While the output was not perfect I figured with some regex magic I could isolate the file path.
However when I tried system2('dir'), I received the error "dir" not found.
Is there (a better) way for me to access the file path of a Windows shortcut from R and why can't I use dir through a system call in R?
For anyone in the future finding this thread, the answer is fs::link_path() as pointed out by Edward Visel

Aptana won't start because workspace has change location

I'm on Mac OS X, and I just installed a secondary drive, onto which I placed my user's home directory.
Now, when I launch Aptana/Titanium Studio, it says that specified workspace cannot be created because directory is either invalid or read-only.
What I guess that it's looking after the old file path.
In what file can I change to the new workspace location?
Thanks!
Found a workaround.
I simply added a symbolic link into my users’ folder:
myusername -> /Volumes/Second/Home/
VoilĂ !
I had the same issue. I tried to change workspace to a read only location and then couldn't restart.
I searched the usual suspects for a pref file but can't find it. I suspect it's stored somewhere deep in the Eclipse framework files.
I solved it by executing
./AptanaStudio3 -data ~Home
from
~/Applications/Aptana Studio 3/AptanaStudio3.app/Contents/MacOS/
to reset Workspace to ~Home
Hope this helps a future seeker
Is Aptana/Titanium Studio closing after the workspace message or you can get to the preference menu? If so you can change the workspace location by going to
Aptana/Titanium Studio > Preferences > General > Startup and Shutdown > Workspaces
Then when you next start the application you will be asked for you workspace location and you can browse to the new location.
You should be able to change it using the config.ini file located at /Application/Titanium Studio/configuration/config.ini.
I have not had reason to do this for Titanium, but I have done in the past for Eclipse and as Titanium/Aptana are basically Eclipse spin offs this should work for them as well.
Just in case anyone faced the same problem and the answer didn't work. My problem was trivial. There was no free space on my HD! (only 2MB). If so, free some space and re-launch Aptana.
(I am wondering why the message was that vague. Why not to say "Free some space" and "free" me from wasting my time!)
I know this is old but I ended up here after copying my Aptana Studio 3 data to a new computer, and placing my Workspace in a different location, which gives the same error that the Workspace can't be opened.
If you installed into the default location (on Windows) and want to tell Aptana where you've moved your Workspace, the file where you can set the path is:
%HOMEPATH%\AppData\Roaming\Appcelerator\Aptana Studio\configuration\.settings\org.eclipse.ui.ide.prefs

Can't Write Configuration File

I have been unsuccessful in getting Aptana 3.0.8 to start. I keep getting the error
The configuration area at 'C:\Users\Devon\.eclipse\com.aptana.rcp.product_3.0.8.201201201658_68819209\configuration' is not writable. Please choose a writable location using the '-configuration' command line option.
I have used the -configuration command within the target area of my shortcut to point to two different locations at two different times.
First I made a folder in the root of my drive and made sure that it was writable, but still got the same error, except it would say that the folder I specified was not writable instead of listing the folder in the above error.
I also tried to point it to write to a mapped network drive via my server and it still gave me the same error.
I have read other posts on this site and none of the resolutions solved my issue. I also went into my local appdata folder and changed the path of the default workspace location within the config.ini folder and changed it to a directory that does not have spaces in its name in hopes that would resolve the issue.
I really needed to work on my business website and thus have installed Aptana 2 in the mean time because that seems to be working without any issues. However I would really like to be able to get Aptana 3 working.
I am running Windows 7 Pro x64
Thanks in advance for any help provided here

QFileInfo::exists() for a shared-drive file path

Question from a newcomer to QT: when I supply the exists() method of a QFileInfo object with a shared-drive file path, it always returns false, even with me escaping every backslash with another backslash (i.e. \\10.1.2.34.56\dir1). And yes, the directory does exist :) Could there be some other issue at work here, such as a lack of permission for the directory in question? Thanks in advance for any light you might shed on this issue...
It seems it works correctly on XP (with Qt 4.7.3) either with doubled backslashes or single slashes ('//ip/share/filepath').
Try getting the file url through QFileDialog::getOpenFileName. As it uses a native dialog, it should ask for your login/password if needed.
If QFileInfo can then find that the file exists, you could try using the native API (Windows Networking) to connect or allow access programmatically to the network share.
As it turns out, my issue had everything to do with permissions and nothing to do with escaping backslashes.
The application I inherited actually has two components: i) the window that provides the GUI interface for the app and (ii) the Window service that does the actual work. The window was able to "see" the shared drive because the Windows userid for which it was running had permission for that drive, whereas the Windows service running as the local system could not. Once I used the Services window to change the service to run under a userid with permission for that drive, then it ran just fine. Thanks for your response...

Resources