R Programming
- Overview of R
- Installing R on Windows
- Download and Install RStudio on Windows
- Setting Your Working Directory (Windows)
- Getting Help with R
- Installing R Packages
- Loading R Packages
- Take Input and Print in R
- R Objects and Attributes
- R Data Structures
- R – Operators
- Vectorization
- Dates and Times
- Data Summary
- Reading and Writing Data to and from R
- Control Structure
- Loop Functions
- Functions
- Data Frames and dplyr Package
- Generating Random Numbers
- Random Number Seed in R
- Random Sampling
- Data Visualization Using R
Setting Your Working Directory (Windows)
R getwd() Function:
Working directory is the directory where R finds all R file for reading and writing. getwd() function returns an absolute filepath representing the current working directory of the R process.
getwd()
Output:
[1] "C:/Users/Kalyan/Documents"
R setwd() Function:
setwd(dir) is used to set the working directory to dir.
setwd("e:/MakeMeAnalyst/R/")
R dir() Function:
dir() function lists all the files in a directory.
dir()
R ls() Function:
ls() is a function in R that lists all the object in the working environment.
ls()
It can be used in scenario where you want to clean the environment before running code. Below command will remove all the object from R environment.
rm(list = ls())