#Vector of strings

fruits <- c('Cherries', 'Apple', 'Persimmon', 'Peach', 'Fig', 'Kiwi', 'Avocado', 'Lychee', 'Grapes', 'Watermelon')

for(i in fruits){
  cat("The fruit is: ", i, ".\n", sep = "")
}
## The fruit is: Cherries.
## The fruit is: Apple.
## The fruit is: Persimmon.
## The fruit is: Peach.
## The fruit is: Fig.
## The fruit is: Kiwi.
## The fruit is: Avocado.
## The fruit is: Lychee.
## The fruit is: Grapes.
## The fruit is: Watermelon.
cat("The length is: ", length(fruits), ".\n")
## The length is:  10 .
numbers <- c(6, 8, 9, 16, 18, 19, 27, 36, 45, 54, 63, 72, 81, 90)

for(i in numbers){
  cat("The number is: ", i, ".\n", sep = "")
}
## The number is: 6.
## The number is: 8.
## The number is: 9.
## The number is: 16.
## The number is: 18.
## The number is: 19.
## The number is: 27.
## The number is: 36.
## The number is: 45.
## The number is: 54.
## The number is: 63.
## The number is: 72.
## The number is: 81.
## The number is: 90.
log_values <- c(TRUE, FALSE, FALSE, TRUE, TRUE, FALSE)
log_values
## [1]  TRUE FALSE FALSE  TRUE  TRUE FALSE
#repeat vectors
repeat_each <- rep(c(1, 6, 8, 9), each=3)
repeat_each
##  [1] 1 1 1 6 6 6 8 8 8 9 9 9
repeat_times <- rep(c(1, 6, 8, 9), times=3)
repeat_times
##  [1] 1 6 8 9 1 6 8 9 1 6 8 9
repeat_indepent <- rep(c(1, 2, 3), times=c(5, 2, 1))
repeat_indepent
## [1] 1 1 1 1 1 2 2 3
#Generating sequenced vectors

numbers <- 1:8
numbers
## [1] 1 2 3 4 5 6 7 8
#sort a vector

sort(fruits)
##  [1] "Apple"      "Avocado"    "Cherries"   "Fig"        "Grapes"    
##  [6] "Kiwi"       "Lychee"     "Peach"      "Persimmon"  "Watermelon"
sort(fruits, decreasing = TRUE)
##  [1] "Watermelon" "Persimmon"  "Peach"      "Lychee"     "Kiwi"      
##  [6] "Grapes"     "Fig"        "Cherries"   "Avocado"    "Apple"