SlideShare ist ein Scribd-Unternehmen logo
1 von 3
Downloaden Sie, um offline zu lesen
4/16/2020 R Programming Lab - 3 - Jupyter Notebook
https://hub.gke.mybinder.org/user/binder-examples-r-kagj2wsh/notebooks/R Programming Lab - 3.ipynb# 1/3
R - Notebook [LAB EXPERIMENTS DEMONSTRATION] ---------------Prepared by - Asst. Prof.
Ashwini Mathur(CSSP)- Jain University
Following tasks to perform:
1. Calculate the interest earned after 5 years on an investment of $200
0, assuming an interest rate of 3% compounded annually.
2. Use R to calculate the area of a circle with radius 7 cm.
3. Do you think there is a difference between 48:14ˆ2and 48:(14ˆ2)?
4. Usin rep() and seq()as needed, create the vectors: 000001111122222333
3344444 and 1234512345123451234512345
5. Create the vector (00011110001111000111100011110001111) and convert i
t to a factor. Identify the levels of the result, and then change t
he level labels to obtain the factor:
Levels: Male Female
6. Use more.colors vector, rep() and seq() to create the vector
"red" "yellow" "blue" "yellow" "blue" "green"
"blue" "green" "magenta" "green" "magenta" "cyan"
Question 1. Calculate the interest earned after 5 years on an investment of $2000, assuming an
interest rate of 3% ompounded annually.
In [1]:
Question 2. Use R to calculate the area of a circle with radius 7 cm.
In [2]:
Question 3. Do you think there is a difference between 48:14^2and 48:(14^2)?
60 121.8 185.45 251.02 318.55 388.1 459.75 533.54 609.55 687.83 768.47 851.52
937.07 1025.18 1115.93 1209.41 1305.7 1404.87 1507.01 1612.22 1720.59 1832.21
1947.17 2065.59 2187.56 2313.18 2442.58 2575.86 2713.13 2854.52
153.9380400259
round(2000*(1.03^(1:30) - 1), 2)
r <- 7
area <- pi * r^2
area
4/16/2020 R Programming Lab - 3 - Jupyter Notebook
https://hub.gke.mybinder.org/user/binder-examples-r-kagj2wsh/notebooks/R Programming Lab - 3.ipynb# 2/3
In [3]:
Question 4. Using rep() and seq()as needed, create the vectors : 0000011111222223333344444
and 1234512345123451234512345
In [5]:
Question 5. Create the vector (00011110001111000111100011110001111) and convert it to a
factor. Identify the levels of the result, and then change the level labels to obtain the factor:
Assign the Levels: Male Female
In [4]:
48 47 46 45 44 43 42
144 141 138 135 132 129 126 123 120 117 114 111 108 105 102 99 96 93 90
87 84 81 78 75 72 69 66 63 60 57 54 51 48 45 42
0 0 0 0 0 1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4
0 0 0 0 0 1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4
1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5
0 0 0 1 1 1 1 0 0 0 1 1 1 1 0 0 0 1 1 1 1 0 0 0 1 1 1 1 0 0 0 1 1 1
1
#Yes, the parentheses are necessary, because the : has higher priority than the
#Second case the sequence is multiplied by 3.
48:(14*3)
48:14*3
rep(seq(0,4,1),times = 1,each = 5)
rep( 0:4, rep(5,5))
rep(seq(1,5,1),times = 5)
#5. Create the vector [1]00011110001111000111100011110001111
x <- rep( c(rep(0, 3), rep(1, 4)), 5)
x
4/16/2020 R Programming Lab - 3 - Jupyter Notebook
https://hub.gke.mybinder.org/user/binder-examples-r-kagj2wsh/notebooks/R Programming Lab - 3.ipynb# 3/3
In [6]:
Question 6. Use more.colors vector, rep() and seq() to create the vector
"red" "yellow" "blue" "yellow" "blue" "green" "blue" "green" "magenta"
"green" "magenta" "cyan"
In [9]:
0 0 0 1 1 1 1 0 0 0 1 1 1 1 0 0 0 1 1 1 1 0 0 0 1 1 1 1 0 0 0 1 1 1
1
Levels:
'0' '1'
male male male female female female female male male male female female female
female male male male female female female female male male male female female
female female male male male female female female female
Levels:
'red' 'yellow' 'blue' 'yellow' 'blue' 'green' 'blue' 'green' 'magenta' 'green' 'magenta' 'cyan'
#and convert it to a factor. Identify the levels of the result, and
#change the level labels to obtain the factor:
## [1] Male Male Male Female Female Female Female Male Male
## [10] Male Female Female Female Female Male Male Male Female
## [19] Female Female Female Male Male Male Female Female Female
## [28] Female Male Male Male Female Female Female Female
## Levels: Male Female
numbers = factor(rep(c(0,1,0,1,0,1,0,1,0,1),c(3,4,3,4,3,4,3,4,3,4)))
numbers
levels(numbers)=c('male','female')
numbers
more.colors <- c("red","yellow","blue","green","magenta","cyan")
more.colors[rep( seq(1,3), times = 4) + rep( seq(0,3), each=3)]

Weitere ähnliche Inhalte

Was ist angesagt?

Lesson 15: Exponential Growth and Decay (Section 021 slides)
Lesson 15: Exponential Growth and Decay (Section 021 slides)Lesson 15: Exponential Growth and Decay (Section 021 slides)
Lesson 15: Exponential Growth and Decay (Section 021 slides)Matthew Leingang
 
Matlab ch1 (6)
Matlab ch1 (6)Matlab ch1 (6)
Matlab ch1 (6)mohsinggg
 
Statistics-Regression analysis
Statistics-Regression analysisStatistics-Regression analysis
Statistics-Regression analysisRabin BK
 
Credit Risk Assessment using Machine Learning Techniques with WEKA
Credit Risk Assessment using Machine Learning Techniques with WEKACredit Risk Assessment using Machine Learning Techniques with WEKA
Credit Risk Assessment using Machine Learning Techniques with WEKAMehnaz Newaz
 
Simple Linier Regression
Simple Linier RegressionSimple Linier Regression
Simple Linier Regressiondessybudiyanti
 
Introduction to Generalized Linear Models
Introduction to Generalized Linear ModelsIntroduction to Generalized Linear Models
Introduction to Generalized Linear Modelsrichardchandler
 
Chapter 6 simple regression and correlation
Chapter 6 simple regression and correlationChapter 6 simple regression and correlation
Chapter 6 simple regression and correlationRione Drevale
 

Was ist angesagt? (8)

Class ppt intro to r
Class ppt intro to rClass ppt intro to r
Class ppt intro to r
 
Lesson 15: Exponential Growth and Decay (Section 021 slides)
Lesson 15: Exponential Growth and Decay (Section 021 slides)Lesson 15: Exponential Growth and Decay (Section 021 slides)
Lesson 15: Exponential Growth and Decay (Section 021 slides)
 
Matlab ch1 (6)
Matlab ch1 (6)Matlab ch1 (6)
Matlab ch1 (6)
 
Statistics-Regression analysis
Statistics-Regression analysisStatistics-Regression analysis
Statistics-Regression analysis
 
Credit Risk Assessment using Machine Learning Techniques with WEKA
Credit Risk Assessment using Machine Learning Techniques with WEKACredit Risk Assessment using Machine Learning Techniques with WEKA
Credit Risk Assessment using Machine Learning Techniques with WEKA
 
Simple Linier Regression
Simple Linier RegressionSimple Linier Regression
Simple Linier Regression
 
Introduction to Generalized Linear Models
Introduction to Generalized Linear ModelsIntroduction to Generalized Linear Models
Introduction to Generalized Linear Models
 
Chapter 6 simple regression and correlation
Chapter 6 simple regression and correlationChapter 6 simple regression and correlation
Chapter 6 simple regression and correlation
 

Ähnlich wie R programming lab 3 - jupyter notebook

R programming lab 1 - jupyter notebook
R programming lab   1 - jupyter notebookR programming lab   1 - jupyter notebook
R programming lab 1 - jupyter notebookAshwini Mathur
 
Introduction to Data Science With R Lab Record
Introduction to Data Science With R Lab RecordIntroduction to Data Science With R Lab Record
Introduction to Data Science With R Lab RecordLakshmi Sarvani Videla
 
A practical work of matlab
A practical work of matlabA practical work of matlab
A practical work of matlabSalanSD
 
Descriptive analytics in r programming language
Descriptive analytics in r programming languageDescriptive analytics in r programming language
Descriptive analytics in r programming languageAshwini Mathur
 
Regression and Classification with R
Regression and Classification with RRegression and Classification with R
Regression and Classification with RYanchang Zhao
 
DeepXplore: Automated Whitebox Testing of Deep Learning
DeepXplore: Automated Whitebox Testing of Deep LearningDeepXplore: Automated Whitebox Testing of Deep Learning
DeepXplore: Automated Whitebox Testing of Deep LearningMasahiro Sakai
 
1 Faculty of Computer Studies Information Technology a.docx
1 Faculty of Computer Studies Information Technology a.docx1 Faculty of Computer Studies Information Technology a.docx
1 Faculty of Computer Studies Information Technology a.docxmercysuttle
 
Introduction to computing Processing and performance.pdf
Introduction to computing Processing and performance.pdfIntroduction to computing Processing and performance.pdf
Introduction to computing Processing and performance.pdfTulasiramKandula1
 
Smarter Measure ReflectionThis reflection paper is to be typed a.docx
Smarter Measure ReflectionThis reflection paper is to be typed a.docxSmarter Measure ReflectionThis reflection paper is to be typed a.docx
Smarter Measure ReflectionThis reflection paper is to be typed a.docxbudabrooks46239
 
0113 examia
0113 examia0113 examia
0113 examiapschlein
 
Breaking a Stick to form a Pentagon with Positive Integers using Programming ...
Breaking a Stick to form a Pentagon with Positive Integers using Programming ...Breaking a Stick to form a Pentagon with Positive Integers using Programming ...
Breaking a Stick to form a Pentagon with Positive Integers using Programming ...IRJET Journal
 
RDataMining slides-regression-classification
RDataMining slides-regression-classificationRDataMining slides-regression-classification
RDataMining slides-regression-classificationYanchang Zhao
 
Idea for ineractive programming language
Idea for ineractive programming languageIdea for ineractive programming language
Idea for ineractive programming languageLincoln Hannah
 
Build Your Own 3D Scanner: 3D Scanning with Structured Lighting
Build Your Own 3D Scanner: 3D Scanning with Structured LightingBuild Your Own 3D Scanner: 3D Scanning with Structured Lighting
Build Your Own 3D Scanner: 3D Scanning with Structured LightingDouglas Lanman
 

Ähnlich wie R programming lab 3 - jupyter notebook (20)

R programming lab 1 - jupyter notebook
R programming lab   1 - jupyter notebookR programming lab   1 - jupyter notebook
R programming lab 1 - jupyter notebook
 
Introduction to Data Science With R Lab Record
Introduction to Data Science With R Lab RecordIntroduction to Data Science With R Lab Record
Introduction to Data Science With R Lab Record
 
A practical work of matlab
A practical work of matlabA practical work of matlab
A practical work of matlab
 
Descriptive analytics in r programming language
Descriptive analytics in r programming languageDescriptive analytics in r programming language
Descriptive analytics in r programming language
 
Regression and Classification with R
Regression and Classification with RRegression and Classification with R
Regression and Classification with R
 
R Programming Intro
R Programming IntroR Programming Intro
R Programming Intro
 
DeepXplore: Automated Whitebox Testing of Deep Learning
DeepXplore: Automated Whitebox Testing of Deep LearningDeepXplore: Automated Whitebox Testing of Deep Learning
DeepXplore: Automated Whitebox Testing of Deep Learning
 
QMC: Undergraduate Workshop, Tutorial on 'R' Software - Yawen Guan, Feb 26, 2...
QMC: Undergraduate Workshop, Tutorial on 'R' Software - Yawen Guan, Feb 26, 2...QMC: Undergraduate Workshop, Tutorial on 'R' Software - Yawen Guan, Feb 26, 2...
QMC: Undergraduate Workshop, Tutorial on 'R' Software - Yawen Guan, Feb 26, 2...
 
1 Faculty of Computer Studies Information Technology a.docx
1 Faculty of Computer Studies Information Technology a.docx1 Faculty of Computer Studies Information Technology a.docx
1 Faculty of Computer Studies Information Technology a.docx
 
Introduction to computing Processing and performance.pdf
Introduction to computing Processing and performance.pdfIntroduction to computing Processing and performance.pdf
Introduction to computing Processing and performance.pdf
 
Learning R
Learning RLearning R
Learning R
 
Taller parcial 2
Taller parcial 2Taller parcial 2
Taller parcial 2
 
Smarter Measure ReflectionThis reflection paper is to be typed a.docx
Smarter Measure ReflectionThis reflection paper is to be typed a.docxSmarter Measure ReflectionThis reflection paper is to be typed a.docx
Smarter Measure ReflectionThis reflection paper is to be typed a.docx
 
0113 examia
0113 examia0113 examia
0113 examia
 
Breaking a Stick to form a Pentagon with Positive Integers using Programming ...
Breaking a Stick to form a Pentagon with Positive Integers using Programming ...Breaking a Stick to form a Pentagon with Positive Integers using Programming ...
Breaking a Stick to form a Pentagon with Positive Integers using Programming ...
 
RDataMining slides-regression-classification
RDataMining slides-regression-classificationRDataMining slides-regression-classification
RDataMining slides-regression-classification
 
Idea for ineractive programming language
Idea for ineractive programming languageIdea for ineractive programming language
Idea for ineractive programming language
 
Build Your Own 3D Scanner: 3D Scanning with Structured Lighting
Build Your Own 3D Scanner: 3D Scanning with Structured LightingBuild Your Own 3D Scanner: 3D Scanning with Structured Lighting
Build Your Own 3D Scanner: 3D Scanning with Structured Lighting
 
Control charts
Control chartsControl charts
Control charts
 
Grade 10 tutorials
Grade 10 tutorialsGrade 10 tutorials
Grade 10 tutorials
 

Mehr von Ashwini Mathur

S3 classes and s4 classes
S3 classes and s4 classesS3 classes and s4 classes
S3 classes and s4 classesAshwini Mathur
 
Summerization notes for descriptive statistics using r
Summerization notes for descriptive statistics using r Summerization notes for descriptive statistics using r
Summerization notes for descriptive statistics using r Ashwini Mathur
 
R programming lab 2 - jupyter notebook
R programming lab   2 - jupyter notebookR programming lab   2 - jupyter notebook
R programming lab 2 - jupyter notebookAshwini Mathur
 
R for statistics session 1
R for statistics session 1R for statistics session 1
R for statistics session 1Ashwini Mathur
 
Object oriented programming in r
Object oriented programming in r Object oriented programming in r
Object oriented programming in r Ashwini Mathur
 
Linear programming optimization in r
Linear programming optimization in r Linear programming optimization in r
Linear programming optimization in r Ashwini Mathur
 
Introduction to python along with the comparitive analysis with r
Introduction to python   along with the comparitive analysis with r Introduction to python   along with the comparitive analysis with r
Introduction to python along with the comparitive analysis with r Ashwini Mathur
 
Example 2 summerization notes for descriptive statistics using r
Example   2    summerization notes for descriptive statistics using r Example   2    summerization notes for descriptive statistics using r
Example 2 summerization notes for descriptive statistics using r Ashwini Mathur
 
Descriptive statistics assignment
Descriptive statistics assignment Descriptive statistics assignment
Descriptive statistics assignment Ashwini Mathur
 
Data analysis for covid 19
Data analysis for covid 19Data analysis for covid 19
Data analysis for covid 19Ashwini Mathur
 
Correlation and linear regression
Correlation and linear regression Correlation and linear regression
Correlation and linear regression Ashwini Mathur
 
Calling c functions from r programming unit 5
Calling c functions from r programming    unit 5Calling c functions from r programming    unit 5
Calling c functions from r programming unit 5Ashwini Mathur
 
Anova (analysis of variance) test
Anova (analysis of variance) test Anova (analysis of variance) test
Anova (analysis of variance) test Ashwini Mathur
 

Mehr von Ashwini Mathur (17)

S3 classes and s4 classes
S3 classes and s4 classesS3 classes and s4 classes
S3 classes and s4 classes
 
Summerization notes for descriptive statistics using r
Summerization notes for descriptive statistics using r Summerization notes for descriptive statistics using r
Summerization notes for descriptive statistics using r
 
Rpy2 demonstration
Rpy2 demonstrationRpy2 demonstration
Rpy2 demonstration
 
Rpy package
Rpy packageRpy package
Rpy package
 
R programming lab 2 - jupyter notebook
R programming lab   2 - jupyter notebookR programming lab   2 - jupyter notebook
R programming lab 2 - jupyter notebook
 
R for statistics session 1
R for statistics session 1R for statistics session 1
R for statistics session 1
 
R for statistics 2
R for statistics 2R for statistics 2
R for statistics 2
 
Play with matrix in r
Play with matrix in rPlay with matrix in r
Play with matrix in r
 
Object oriented programming in r
Object oriented programming in r Object oriented programming in r
Object oriented programming in r
 
Linear programming optimization in r
Linear programming optimization in r Linear programming optimization in r
Linear programming optimization in r
 
Introduction to python along with the comparitive analysis with r
Introduction to python   along with the comparitive analysis with r Introduction to python   along with the comparitive analysis with r
Introduction to python along with the comparitive analysis with r
 
Example 2 summerization notes for descriptive statistics using r
Example   2    summerization notes for descriptive statistics using r Example   2    summerization notes for descriptive statistics using r
Example 2 summerization notes for descriptive statistics using r
 
Descriptive statistics assignment
Descriptive statistics assignment Descriptive statistics assignment
Descriptive statistics assignment
 
Data analysis for covid 19
Data analysis for covid 19Data analysis for covid 19
Data analysis for covid 19
 
Correlation and linear regression
Correlation and linear regression Correlation and linear regression
Correlation and linear regression
 
Calling c functions from r programming unit 5
Calling c functions from r programming    unit 5Calling c functions from r programming    unit 5
Calling c functions from r programming unit 5
 
Anova (analysis of variance) test
Anova (analysis of variance) test Anova (analysis of variance) test
Anova (analysis of variance) test
 

Kürzlich hochgeladen

Introduction-to-Machine-Learning (1).pptx
Introduction-to-Machine-Learning (1).pptxIntroduction-to-Machine-Learning (1).pptx
Introduction-to-Machine-Learning (1).pptxfirstjob4
 
Best VIP Call Girls Noida Sector 22 Call Me: 8448380779
Best VIP Call Girls Noida Sector 22 Call Me: 8448380779Best VIP Call Girls Noida Sector 22 Call Me: 8448380779
Best VIP Call Girls Noida Sector 22 Call Me: 8448380779Delhi Call girls
 
Invezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signalsInvezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signalsInvezz1
 
Best VIP Call Girls Noida Sector 39 Call Me: 8448380779
Best VIP Call Girls Noida Sector 39 Call Me: 8448380779Best VIP Call Girls Noida Sector 39 Call Me: 8448380779
Best VIP Call Girls Noida Sector 39 Call Me: 8448380779Delhi Call girls
 
BigBuy dropshipping via API with DroFx.pptx
BigBuy dropshipping via API with DroFx.pptxBigBuy dropshipping via API with DroFx.pptx
BigBuy dropshipping via API with DroFx.pptxolyaivanovalion
 
April 2024 - Crypto Market Report's Analysis
April 2024 - Crypto Market Report's AnalysisApril 2024 - Crypto Market Report's Analysis
April 2024 - Crypto Market Report's Analysismanisha194592
 
Smarteg dropshipping via API with DroFx.pptx
Smarteg dropshipping via API with DroFx.pptxSmarteg dropshipping via API with DroFx.pptx
Smarteg dropshipping via API with DroFx.pptxolyaivanovalion
 
Week-01-2.ppt BBB human Computer interaction
Week-01-2.ppt BBB human Computer interactionWeek-01-2.ppt BBB human Computer interaction
Week-01-2.ppt BBB human Computer interactionfulawalesam
 
Call me @ 9892124323 Cheap Rate Call Girls in Vashi with Real Photo 100% Secure
Call me @ 9892124323  Cheap Rate Call Girls in Vashi with Real Photo 100% SecureCall me @ 9892124323  Cheap Rate Call Girls in Vashi with Real Photo 100% Secure
Call me @ 9892124323 Cheap Rate Call Girls in Vashi with Real Photo 100% SecurePooja Nehwal
 
VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...
VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...
VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...SUHANI PANDEY
 
Determinants of health, dimensions of health, positive health and spectrum of...
Determinants of health, dimensions of health, positive health and spectrum of...Determinants of health, dimensions of health, positive health and spectrum of...
Determinants of health, dimensions of health, positive health and spectrum of...shambhavirathore45
 
Carero dropshipping via API with DroFx.pptx
Carero dropshipping via API with DroFx.pptxCarero dropshipping via API with DroFx.pptx
Carero dropshipping via API with DroFx.pptxolyaivanovalion
 
Zuja dropshipping via API with DroFx.pptx
Zuja dropshipping via API with DroFx.pptxZuja dropshipping via API with DroFx.pptx
Zuja dropshipping via API with DroFx.pptxolyaivanovalion
 
Halmar dropshipping via API with DroFx
Halmar  dropshipping  via API with DroFxHalmar  dropshipping  via API with DroFx
Halmar dropshipping via API with DroFxolyaivanovalion
 
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al BarshaAl Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al BarshaAroojKhan71
 
Generative AI on Enterprise Cloud with NiFi and Milvus
Generative AI on Enterprise Cloud with NiFi and MilvusGenerative AI on Enterprise Cloud with NiFi and Milvus
Generative AI on Enterprise Cloud with NiFi and MilvusTimothy Spann
 
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort Service
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort ServiceBDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort Service
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort ServiceDelhi Call girls
 
Ravak dropshipping via API with DroFx.pptx
Ravak dropshipping via API with DroFx.pptxRavak dropshipping via API with DroFx.pptx
Ravak dropshipping via API with DroFx.pptxolyaivanovalion
 

Kürzlich hochgeladen (20)

Introduction-to-Machine-Learning (1).pptx
Introduction-to-Machine-Learning (1).pptxIntroduction-to-Machine-Learning (1).pptx
Introduction-to-Machine-Learning (1).pptx
 
Best VIP Call Girls Noida Sector 22 Call Me: 8448380779
Best VIP Call Girls Noida Sector 22 Call Me: 8448380779Best VIP Call Girls Noida Sector 22 Call Me: 8448380779
Best VIP Call Girls Noida Sector 22 Call Me: 8448380779
 
Invezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signalsInvezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signals
 
Best VIP Call Girls Noida Sector 39 Call Me: 8448380779
Best VIP Call Girls Noida Sector 39 Call Me: 8448380779Best VIP Call Girls Noida Sector 39 Call Me: 8448380779
Best VIP Call Girls Noida Sector 39 Call Me: 8448380779
 
BigBuy dropshipping via API with DroFx.pptx
BigBuy dropshipping via API with DroFx.pptxBigBuy dropshipping via API with DroFx.pptx
BigBuy dropshipping via API with DroFx.pptx
 
(NEHA) Call Girls Katra Call Now 8617697112 Katra Escorts 24x7
(NEHA) Call Girls Katra Call Now 8617697112 Katra Escorts 24x7(NEHA) Call Girls Katra Call Now 8617697112 Katra Escorts 24x7
(NEHA) Call Girls Katra Call Now 8617697112 Katra Escorts 24x7
 
April 2024 - Crypto Market Report's Analysis
April 2024 - Crypto Market Report's AnalysisApril 2024 - Crypto Market Report's Analysis
April 2024 - Crypto Market Report's Analysis
 
Smarteg dropshipping via API with DroFx.pptx
Smarteg dropshipping via API with DroFx.pptxSmarteg dropshipping via API with DroFx.pptx
Smarteg dropshipping via API with DroFx.pptx
 
Week-01-2.ppt BBB human Computer interaction
Week-01-2.ppt BBB human Computer interactionWeek-01-2.ppt BBB human Computer interaction
Week-01-2.ppt BBB human Computer interaction
 
Call me @ 9892124323 Cheap Rate Call Girls in Vashi with Real Photo 100% Secure
Call me @ 9892124323  Cheap Rate Call Girls in Vashi with Real Photo 100% SecureCall me @ 9892124323  Cheap Rate Call Girls in Vashi with Real Photo 100% Secure
Call me @ 9892124323 Cheap Rate Call Girls in Vashi with Real Photo 100% Secure
 
VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...
VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...
VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...
 
Determinants of health, dimensions of health, positive health and spectrum of...
Determinants of health, dimensions of health, positive health and spectrum of...Determinants of health, dimensions of health, positive health and spectrum of...
Determinants of health, dimensions of health, positive health and spectrum of...
 
Carero dropshipping via API with DroFx.pptx
Carero dropshipping via API with DroFx.pptxCarero dropshipping via API with DroFx.pptx
Carero dropshipping via API with DroFx.pptx
 
Zuja dropshipping via API with DroFx.pptx
Zuja dropshipping via API with DroFx.pptxZuja dropshipping via API with DroFx.pptx
Zuja dropshipping via API with DroFx.pptx
 
Halmar dropshipping via API with DroFx
Halmar  dropshipping  via API with DroFxHalmar  dropshipping  via API with DroFx
Halmar dropshipping via API with DroFx
 
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al BarshaAl Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
 
Abortion pills in Doha Qatar (+966572737505 ! Get Cytotec
Abortion pills in Doha Qatar (+966572737505 ! Get CytotecAbortion pills in Doha Qatar (+966572737505 ! Get Cytotec
Abortion pills in Doha Qatar (+966572737505 ! Get Cytotec
 
Generative AI on Enterprise Cloud with NiFi and Milvus
Generative AI on Enterprise Cloud with NiFi and MilvusGenerative AI on Enterprise Cloud with NiFi and Milvus
Generative AI on Enterprise Cloud with NiFi and Milvus
 
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort Service
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort ServiceBDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort Service
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort Service
 
Ravak dropshipping via API with DroFx.pptx
Ravak dropshipping via API with DroFx.pptxRavak dropshipping via API with DroFx.pptx
Ravak dropshipping via API with DroFx.pptx
 

R programming lab 3 - jupyter notebook

  • 1. 4/16/2020 R Programming Lab - 3 - Jupyter Notebook https://hub.gke.mybinder.org/user/binder-examples-r-kagj2wsh/notebooks/R Programming Lab - 3.ipynb# 1/3 R - Notebook [LAB EXPERIMENTS DEMONSTRATION] ---------------Prepared by - Asst. Prof. Ashwini Mathur(CSSP)- Jain University Following tasks to perform: 1. Calculate the interest earned after 5 years on an investment of $200 0, assuming an interest rate of 3% compounded annually. 2. Use R to calculate the area of a circle with radius 7 cm. 3. Do you think there is a difference between 48:14ˆ2and 48:(14ˆ2)? 4. Usin rep() and seq()as needed, create the vectors: 000001111122222333 3344444 and 1234512345123451234512345 5. Create the vector (00011110001111000111100011110001111) and convert i t to a factor. Identify the levels of the result, and then change t he level labels to obtain the factor: Levels: Male Female 6. Use more.colors vector, rep() and seq() to create the vector "red" "yellow" "blue" "yellow" "blue" "green" "blue" "green" "magenta" "green" "magenta" "cyan" Question 1. Calculate the interest earned after 5 years on an investment of $2000, assuming an interest rate of 3% ompounded annually. In [1]: Question 2. Use R to calculate the area of a circle with radius 7 cm. In [2]: Question 3. Do you think there is a difference between 48:14^2and 48:(14^2)? 60 121.8 185.45 251.02 318.55 388.1 459.75 533.54 609.55 687.83 768.47 851.52 937.07 1025.18 1115.93 1209.41 1305.7 1404.87 1507.01 1612.22 1720.59 1832.21 1947.17 2065.59 2187.56 2313.18 2442.58 2575.86 2713.13 2854.52 153.9380400259 round(2000*(1.03^(1:30) - 1), 2) r <- 7 area <- pi * r^2 area
  • 2. 4/16/2020 R Programming Lab - 3 - Jupyter Notebook https://hub.gke.mybinder.org/user/binder-examples-r-kagj2wsh/notebooks/R Programming Lab - 3.ipynb# 2/3 In [3]: Question 4. Using rep() and seq()as needed, create the vectors : 0000011111222223333344444 and 1234512345123451234512345 In [5]: Question 5. Create the vector (00011110001111000111100011110001111) and convert it to a factor. Identify the levels of the result, and then change the level labels to obtain the factor: Assign the Levels: Male Female In [4]: 48 47 46 45 44 43 42 144 141 138 135 132 129 126 123 120 117 114 111 108 105 102 99 96 93 90 87 84 81 78 75 72 69 66 63 60 57 54 51 48 45 42 0 0 0 0 0 1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 0 0 0 0 0 1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 0 0 0 1 1 1 1 0 0 0 1 1 1 1 0 0 0 1 1 1 1 0 0 0 1 1 1 1 0 0 0 1 1 1 1 #Yes, the parentheses are necessary, because the : has higher priority than the #Second case the sequence is multiplied by 3. 48:(14*3) 48:14*3 rep(seq(0,4,1),times = 1,each = 5) rep( 0:4, rep(5,5)) rep(seq(1,5,1),times = 5) #5. Create the vector [1]00011110001111000111100011110001111 x <- rep( c(rep(0, 3), rep(1, 4)), 5) x
  • 3. 4/16/2020 R Programming Lab - 3 - Jupyter Notebook https://hub.gke.mybinder.org/user/binder-examples-r-kagj2wsh/notebooks/R Programming Lab - 3.ipynb# 3/3 In [6]: Question 6. Use more.colors vector, rep() and seq() to create the vector "red" "yellow" "blue" "yellow" "blue" "green" "blue" "green" "magenta" "green" "magenta" "cyan" In [9]: 0 0 0 1 1 1 1 0 0 0 1 1 1 1 0 0 0 1 1 1 1 0 0 0 1 1 1 1 0 0 0 1 1 1 1 Levels: '0' '1' male male male female female female female male male male female female female female male male male female female female female male male male female female female female male male male female female female female Levels: 'red' 'yellow' 'blue' 'yellow' 'blue' 'green' 'blue' 'green' 'magenta' 'green' 'magenta' 'cyan' #and convert it to a factor. Identify the levels of the result, and #change the level labels to obtain the factor: ## [1] Male Male Male Female Female Female Female Male Male ## [10] Male Female Female Female Female Male Male Male Female ## [19] Female Female Female Male Male Male Female Female Female ## [28] Female Male Male Male Female Female Female Female ## Levels: Male Female numbers = factor(rep(c(0,1,0,1,0,1,0,1,0,1),c(3,4,3,4,3,4,3,4,3,4))) numbers levels(numbers)=c('male','female') numbers more.colors <- c("red","yellow","blue","green","magenta","cyan") more.colors[rep( seq(1,3), times = 4) + rep( seq(0,3), each=3)]