Installing R and RStudio and Basic Commands in R


Created on August 15 2015 At 1:09 PM

Back To The Main Blog Page

Introduction

This is the first in a series of blogs that I am going to post about the basics commands and data visualization in R .From the website R is a language and environment for statistical computing and graphics. It is a GNU project which is similar to the S language and environment which was developed at Bell Laboratories by John Chambers and colleagues. So without wasting much time lets jump right in.

Downloading R and RStudio

To install R on Linux press Ctrl-Alt-Tab to open terminal and write the command

On Windows and Mac you can use the download it directly from the official CRAN site.
Now You can use the R directly from the terminal form Linux by typing R but as it so happens that R can be handled in a much more efficient manner using RStudio which provides a much better user interface I would highly suggest for usage due to smooth functionality and easy to handle UX.To install RStudio (The free version Desktop version that is) you can click this link .

Basic Commands in R

Ok so I Assume that you have followed along and downladed R and RStudio.To Shoot RStudio just search for RStudio( or if you are on windows it'll be in your desktop only ).It should look something like this
Note the version of R printed in your console will be different than mine is a bit older.Now we will try to implement some basic commands in R to get to know the language more.

cat
cat is a basic command which can be used to print things to the screen . To run this command type
cat("Hello world!") in your console(which will be in the left by default in RStudio).
getwd()
getwd() print the "present working directory" in R . Note that R tries to save a workspace image of your proceedings on in a certain directory.
setwd({dir})
setwd() is used to change the working directory to a new directory . Note That in windows directories are expressed with "\" as separator unlike in Mac and Linux and have to be carefully changed to "/" before command.
read.csv()
This is a very important R command which is used to export csv files to R and can vary many variation depending on the choice of Arguments which can be read here. Again do remember to change "\" as seperators from windows to "/".

For any suggestion or comments feel free to contact me :: aaditya.jamuar [at] learner.manipal.edu