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. 
Example:
  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( )  ).

0 Comments:

Post a Comment

Popular Posts

Categories

AI (32) Android (24) AngularJS (1) Assembly Language (2) aws (17) Azure (7) BI (10) book (4) Books (146) C (77) C# (12) C++ (82) Course (67) Coursera (198) Cybersecurity (24) data management (11) Data Science (106) Data Strucures (8) Deep Learning (13) Django (14) Downloads (3) edx (2) Engineering (14) Excel (13) Factorial (1) Finance (6) flask (3) flutter (1) FPL (17) Google (21) Hadoop (3) HTML&CSS (47) IBM (25) IoT (1) IS (25) Java (93) Leet Code (4) Machine Learning (46) Meta (18) MICHIGAN (5) microsoft (4) Nvidia (1) Pandas (3) PHP (20) Projects (29) Python (888) Python Coding Challenge (285) Questions (2) R (70) React (6) Scripting (1) security (3) Selenium Webdriver (2) Software (17) SQL (42) UX Research (1) web application (8)

Followers

Person climbing a staircase. Learn Data Science from Scratch: online program with 21 courses