ASSIGNMENT NO.1

#create a new variable called my.num that contains 6 numbers

my.num <- seq(1,6)
print(my.num)
## [1] 1 2 3 4 5 6
#mulitply my.num by 4

print(my.num * 4)
## [1]  4  8 12 16 20 24
#create a second variable called my. char that contains 5 character strings

my.char <- c("Pakistan","China","India","California","Itly")
my.char
## [1] "Pakistan"   "China"      "India"      "California" "Itly"
#combine the two variables my. num and my. char into a variable called both 

both <- paste(my.num,my.char)
both
## [1] "1 Pakistan"   "2 China"      "3 India"      "4 California" "5 Itly"      
## [6] "6 Pakistan"
#what is the length of both?

length(both)
## [1] 6
# what class is both?

typeof(both)
## [1] "character"
#divide both by 3, what happens?
#print(both/3)
#This show error cause we cannot divide an integer number with character object and here both becomes character object.
#create a vector with elements 1 2 3 4 5 6 and call it x 
x <- seq(1,6)
x
## [1] 1 2 3 4 5 6
#create another vector with elements 10 20 30 40 50 and call it y

y <- seq(10,50,10)
y
## [1] 10 20 30 40 50
#what happens if you try to add x and y together?why?

x+y 
## Warning in x + y: longer object length is not a multiple of shorter object
## length
## [1] 11 22 33 44 55 16
# why?
#comments: Ans when we try to add x and y it show warning message(In x + y : longer object length is not a multiple of shorter object length) and automatically append dummy value at the end of the vector here it add 16 at the end of the vector elements.
#append the value 60 onto the vector y (hint: you can use the c() function) 

y <- append(y,60)
y
## [1] 10 20 30 40 50 60
#add x and y together

x+y
## [1] 11 22 33 44 55 66
#multiply x and y together. pay attention to how R performs operations on vectors of the same length

x*y
## [1]  10  40  90 160 250 360