Monday, 1 October 2018

Introduction_Command line_Data editor_Rstudio in R languages

Command Line versus Scripts

Execution of commands in R is not menu driven. (Not like Clicking over buttons to get outcome)

we need to type the commands.

Single line and multi line commands are possible to write.

When writing multi-line programs, it is useful to use a text editor rather than execute everything directly at the command line.

Option 1:
  • One way use R's own built-in editor.
  • It is accessible from the RGui menu bar.
  • Click File and then click on New script
At this point R will open a window entitled Untitled-R Editor.

We may type and edit in this.

It we want to execute a line or a group of lines, just highlight them and press Ctrl+R.

Option 2:

Use R studio software

Suppose we want to use following three functions:

Type them.
library (MASS)
attach (bacteria)
fix (bacteria)

Suppose we want to run only function: library (MASS)

Highlight it and click on Run.

Data Editor
  • There is a data editor within R that can be accessed from the menu bar by selecting Edit/Data editor.
  • Provide the name of the matrix or data frame that we want to edit and a Data Editor window appears.
  • Alternatively we can do this from the command line using the fix function. 
  library (MASS)
  attach (bacteria)
  fix (bacteria)

We can do it in R Studio as follows :

Cleaning up the Windows
  • We assign names to variables when analyzing any data.
  • It is good practice to remove the variable names give to any data frame at the end each session in R.
  • This way, variable with same names but different properties will not get in each others way in subsequent work.
  • rm ( ) command removes variable name
  • For example,
           rm (x, y, z) removes the variable x, y and z.
  • detach ( ) command detaches objects from the Search Path.
  • It removes it from the search ( ) path of available R objects.
  • Usually this is either a data.frame which has been attached or a package which was attached by library.
  • To get rid of everything, including data frames, type rm (list=1s( )  ).


Post a Comment

Codecademy Code Foundations

Popular Posts


Android (23) AngularJS (1) Assembly Language (2) Books (10) C (75) C# (12) C++ (81) Course (1) Data Strucures (4) Downloads (1) Engineering (13) flutter (1) FPL (17) Hadoop (1) HTML&CSS (38) IS (25) Java (89) Leet Code (4) Pandas (1) PHP (20) Projects (17) Python (376) R (69) Selenium Webdriver (2) Software (14) SQL (27)