File Management in Rstudio
Working with R’s GUI — Rstudio can be pure bliss — the vast amount of packages that exist and cool tricks that you can do with it is mind-boggling. Rstudio is, therefore, a darling for many a data scientist and academics looking to plot some beautiful plots for their scientific papers or presentations.
Navigating the various projects you have been working on, however, can be a nightmare! Despite working with R — it took me some time to actually understand how to effectively manage my files — a seemingly trivial task but which can save you stress and anguish down the road.
1. Creating a new project
Open a new RStudio session
Click on the second button (transparent green box with a green arrow on the top left panel)
It gives you a new pop-up — for a brand new project we want to click New Directory
This takes us to the project type — it might be a webpage, data science project, document, or web application (Rstudio has some very surprising cool tricks these days)
Give your project a name — mine is the greatestprojectever
The bottom panel shows where your new directory/folder will be a sub-directory of — in my case of the Desktop
You can even initialize git on this new folder
Now go ahead and create your awesome new project!
So now you’ll have a .Rproj file on the bottom-right panel
When you go to your desktop you can now see your folder — you can close Rstudio and come back to it later and your project will always be there
You can also drag other thing in that folder such as datafile, Rscripts etc that you would need for your cool project!
2. Files that are already on a Folder Sometimes you already have files in a folder say on the desktop. This time you manage your folders differently.
When you open Rstudio again it defaults to the last project you were working on
So because you are a kick-ass scientist with tons of projects you want to start another R project on a folder that already exists with data
So click on the same magic green button, this time clicking existing directory instead of new directory
This takes you to the next panel where you can navigate to the folder where we want to initialize the new R project
Boom! Now we are inside our pre-created folder that has our data and we are ready to work on our CSV folder on the bottom right called somecooldata.csv
3. Files on an online repository Lastly! You might want to download data from an online repository — say Github/Bitbucket et.al.
This time go to the bottom option Version Control and click on it
I want to get my data from a git repository online say from Github
All I need to do is type in the URL on the top bar, name of the project on second and the bottom bar of the panel is where your new cloned project will be a subdirectory of
Boom! All the files are cloned from github and are now on your desktop for you to work on them at your pleasure!
Now you can grab an iced coffee and be satisfied that you do not have to worry about file management in Rstudio ever again!!!!!!