Programming > CODING SOLUTION > Coding > R Basics hands on The American School of Dubai DATABASE BASIC (All)
#Write your code here type conversation K<-2 if (class(K)!="integer") { K <- as.integer(K) print(K) } R Basics - Variables #Write your code here L<-as.Date('2018-01-01') get_next_leap_year <... - function(L) { all_years <- L + 1:4 all_years[(all_years %% 4 == 0 & all_years %%100 != 0) | all_years %% 400 == 0] } LN <-get_next_leap_year(2018) print(LN) Conditional Operations - if/else #Write your code here Marks <- c(78,85,90) for (value in Marks) { if(value>=80){print("Above Average")}else{print("Average")} } Conditional Operations - which() #Write your code here M<-10:20 print(M) which(M>13 & M<16) Random Numbers in R #Write your code here V<-round(runif(10,0,1), 2) print(V ) ifelse(V<0.50,"Less","More") Factors and Levels #Write your code here a<-factor(c("yes","no","yes","maybe")) print(levels(a)) Vector Operations #Write your code here X<-1:5 Y<-seq(2,10,2) [Show More]
Last updated: 1 year ago
Preview 1 out of 4 pages
Connected school, study & course
About the document
Uploaded On
Jan 15, 2023
Number of pages
4
Written in
This document has been written for:
Uploaded
Jan 15, 2023
Downloads
0
Views
90
In Browsegrades, a student can earn by offering help to other student. Students can help other students with materials by upploading their notes and earn money.
We're available through e-mail, Twitter, Facebook, and live chat.
FAQ
Questions? Leave a message!
Copyright © Browsegrades · High quality services·