R/C2/Working-directories-in-RStudio/English-timed
From Script | Spoken-Tutorial
Revision as of 15:04, 22 May 2020 by Sakinashaikh (Talk | contribs)
Time | Narration
|
00:01 | Welcome to this tutorial on Working directories in RStudio. |
00:07 | In this tutorial, you will learn about: |
00:11 | Working directories in Rstudio |
00:15 | How to read and store csv files in R |
00:20 | To understand this tutorial, you should know: |
00:24 | R and RStudio |
00: 27 | Basic commands of R |
00:30 | If not, please locate the relevant tutorials on R on this website. |
00:37 | This tutorial is recorded on |
00:41 | Ubuntu Linux OS 16.04 |
00:46 | R version 3.2.3 |
00:50 | RStudio version 1.1.456 |
00:56 | Install R version 3.2.0 or higher. |
01:02 | We will use the captaincy data set which we created earlier in this series. |
01:08 | Download this data set CaptaincyData.csv from the Code files link of this tutorial. |
01:18 | I have downloaded and moved this data set to the folder myProject on my Desktop. |
01:27 | I shall set this folder as my Working Directory. |
01:33 | Remember we had created two scripts, myfirstscript.R and mysecondscript.R |
01:43 | Both were saved in the folder myProject, on the Desktop. |
01:49 | R always points to a default directory on our computer |
01:55 | This directory is where R will look, by default, for files you ask it to load. |
02:03 | We will find out what our current Working Directory is. |
02:07 | Let us switch to RStudio. |
02:12 | In the Console window, type getwd parentheses and press Enter. |
02:21 | The current Working Directory is shown in the Console. |
02:26 | Note down the directory path. |
02:29 | Now, we will learn how to set our Working Directory. |
02:35 | I will set the folder myProject on my Desktop as my Working Directory. |
02:43 | I am maximizing the Files and Plots window of RStudio. |
02:49 | At the top of the Files and Plots window, click on the Files tab. |
02:57 | Go to the upper right corner of the same window. |
03:02 | Below the refresh icon, click on the button with three dots. |
03:09 | Go To Folder window appears. |
03:13 | Select the folder which you want to make as your Working Directory and click Open. |
03:21 | I am selecting myProject located on my Desktop. |
03:27 | Under Files tab, you can see that the two scripts created earlier, have been loaded. |
03:35 | Now, below the Files tab, click on the More button with the blue gear symbol. |
03:43 | From the dropdown menu, select the Set As Working Directory option. |
03:50 | Now this folder is set as your Working Directory. |
03:56 | You may verify this by looking at the Console. |
04:00 | Now, I am minimizing the Files and Plots window. |
04:05 | There is one other way to set the Working Directory also. |
04:11 | In the Console, type setwd. |
04:15 | Now, inside parentheses, type the desired folder path within double quotes. |
04:23 | Press Enter. |
04:25 | Now, we will learn how to read and store a csv file called CaptaincyData.csv. |
04:34 | We shall declare a variable captaincy to store CaptaincyData.csv. |
04:41 | In the Console window, type captaincy space equal sign space read.csv |
04:50 | Now, CaptaincyData.csv inside double quotes in parentheses and press Enter. |
05:01 | read.csv function is used to read a file and to create a data-frame from it. |
05:10 | Now, we use View function to see the stored data frame. |
05:16 | In the Console window, type View captaincy in parentheses and press Enter. |
05:25 | The contents of captaincy data frame appears in the Source window. |
05:31 | I am maximizing the Source window to see the captaincy data set. |
05:37 | This brings us to the end of this tutorial. Let us summarize. |
05:44 | In this tutorial, we have learned |
05:46 | How to get and set a working directory |
05:50 | How to read and store a csv file |
05:54 | We now suggest an assignment. |
05:58 | Create a new folder on your computer and make it your Working Directory. |
06:04 | The video at the following link summarises the Spoken Tutorial project. |
06:09 | Please download and watch it. |
06:12 | We conduct workshops using Spoken Tutorials and give certificates. |
06:18 | Please contact us. |
06:21 | Pls post your timed queries in this forum. |
06:26 | Pls post your general queries in this forum. |
06:31 | The FOSSEE team coordinates coding of solved examples of popular books. |
06:38 | We give honorarium and certificates to those who do this. |
06:43 | For more details, please visit these sites. |
06:47 | The Spoken Tutorial project is funded by NMEICT, MHRD, Govt. of India |
06:54 | This script for this tutorial was contributed by Shaik Sameer (FOSSEE Fellow 2018). |
07:02 | This is Sudhakar Kumar from IIT Bombay signing off. Thanks for watching. |