1.
Create a vector variable with the values "yes", "no", "yes", "maybe
# Enter your code here. Read input from STDIN. Print output to STDO
UT
V <-factor(c("yes","no","yes","maybe"))
levels(V)
R Basics-2 - Coding- Date and Time in R
# Enter your code here. Read input from STDIN. Print output to STDO
UT
s= "25-12-2016"
as.Date(s,format("%d-%m-%Y"))
3. Coding-Vector Operations
V1 <- c(1:5)
V2 <- c(10,20,30,40,50)
print(V1 + V2)
4. R Basics-4 - Coding-Vectors and Matrices
V <- c(1:9)
M <- matrix(V, byrow =TRUE, nrow = 3)
print (M * 2)
5. R Basics-5 - Coding-Categorial to Numeric Variable
v1 <- factor (round(runif(10,10,70)))
v2 <- as.numeric(as.character(v1))
v1 == v2
6. R Basics-6 -Coding- Random Numbers
# Enter your code here.
V <- runif(10,0,1)
V <- round(V, digits=2)
V < 0.50
7. R Basics-7 - Coding-Handling 'NA'
x <- c(1, 4, NA, 7, 9, NA, 2)
x[!(is.na(x) | x %% 2 == 1)]
8.