Thursday, 1 December 2016



Want to learn R ?

Here's something for you :

I have compiled a few notes which could be handy in beginning to learn R, expecially if you're a newbie.

My first post would pertain  with  first setting up your working directory in R environment :

I have listed here a few  simple functions  that would enable you to have an idea of working environment of R.

Setting your working Directory in R :

>getwd()

[1] "C:/Users/bhavya/Documents"

getwd() function provides you with your current working directory in R, if you have begun a new R session,then it would provide Documents as default on Windows.

>dir() # provides all files under the directory

 [1] "01_fsb_post_cleaning.rda"                "test.csv"                      
 [3] "Database1.accdb"                         "desktop.ini"                          
 [5] "Model.xlsx"                          "IG.csv"


The function dir() provides all functions under the directory Documents .

>setwd("C:/RProject/") #set working directory ie provide path

The function setwd() provides us the functionality to set our working directory using command-line

One can also set the directory using the following steps :

ctrl+shift+H or Session>SetWorkingDirectory>Choose Directory

>getwd()

[1]" C:/RProject/"





No comments:

Post a Comment