R Python
R Python
CS Mukhopadhyay, PhD
Senior Scientist
College of Animal Biotechnology,
Guru Angad Dev Veterinary and Animal Sciences University 1
R-Python-MATLAB 7/19/2023
INTRODUCTION
Programming language: A set of computer understandable
instructions (in form of syntactical notations) to execute some
task by the computer system
Two components of PL:
Semantics: meaning assigned to a code by strings and syntax
2
7/19/2023
4
R-Python-MATLAB 7/19/2023
R PROGRAMMING ENVIRONMENT
R has been used primarily in academics & research
5
R-Python-MATLAB 7/19/2023
R PROGRAMMING ENVIRONMENT
Integrated development environment (IDE): either through command line or
RStudio (an integrated environment comprising of a data editor, debugging
support, & a graphics-window).
Anaconda IDE is also used but less popular than using Anaconda for Python
(jupyter notebook and Spyder / Scientific PYthon Development EnviRonment
for Python)
Jupyter Notebook: an application, used for creating and editing scripts to
display the input and output of a Python or R language script. The notebook
files
R is preferred for standalone computing or related analysis
To initiate R in jupyter: open Anaconda prompt 3 and install R using the
following code: “C:\Users\csmbi>conda install -c r r-irkernel”
6
R-Python-MATLAB 7/19/2023
R PROGRAMMING ENVIRONMENT
R Studio
R Console
7
R-Python-MATLAB 7/19/2023
PYTHON LANGUAGE
8
R-Python-MATLAB 7/19/2023
PYTHON LANGUAGE
Python is preferred by programmers, data analysts, data scientists
and by developers.
PYTHON LANGUAGE
Python: suitable for most of mathematical computation & learning how
algorithms work
The Python Package Index (PyPi) & Anaconda are repositories of Python
software with all libraries
Data Visualizations are more convoluted in Python than in R, & results are
less eye-pleasing or informative
Jupyter Notebooks & Spyder are popular, & mostly preferred IDEs in Python
MATLAB
11
R-Python-MATLAB 7/19/2023
ANACONDA NAVIGATOR
12
R-Python-MATLAB 7/19/2023
JUPYTER NOTEBOOK
13
R-Python-MATLAB 7/19/2023
14
R-Python-MATLAB 7/19/2023
ggplot2 to visualize
15
R-Python-MATLAB 7/19/2023
16
R-Python-MATLAB 7/19/2023
Bioinformatics Toolbox
Database Toolbox
17
R-Python-MATLAB 7/19/2023
18
R-Python-MATLAB 7/19/2023
19
R-Python-MATLAB 7/19/2023
Python:
import pandas as pd
DF_Name_0 =
pd.DataFrame({
"Name" : ["AA", "BB", "CC", "DD", "EE", "FF"],
"Age" : [20, 25, 30, 20, 20, 30],
"Ph.D.": [True, False, True, "TRUE", "T", "FALSE"]})
21
R-Python-MATLAB 7/19/2023
22
R-Python-MATLAB 7/19/2023
R:
DF_Name<- read.csv(“path/file_name.csv",
header = FALSE, sep = "\t")
Python:
import pandas
DF_Name = pandas.read_csv(“path/1_Age_Wt_Ht.csv")
DF_Name
23
IASRI Talk: GWAS Hands On 22/02/2016
ACKNOWLEDGMENTS: PROF JAMES REECY, DR. JAMES KOLTES , DR. J. R. TAIT & ERIC
FRITZ ALONG WITH TWO OTHER TRAINEES FROM PAKISTAN (DR SAIF-UR RAHMAN) AND
CHINA (XEURONG YANG)
24
22/02/2016