# Define a vector of numbers
my_vector <- c(10, 5, 20, 15)
# Use the mean() function to calculate the mean of the vector
mean_value <- mean(my_vector)
print(paste("The mean of my_vector is", mean_value))
## [1] "The mean of my_vector is 12.5"
# Use the max() function to find the maximum value in the vector
max_value <- max(my_vector)
print(paste("The maximum value in my_vector is", max_value))
## [1] "The maximum value in my_vector is 20"
# Use the sum() function to calculate the sum of the vector
sum_value <- sum(my_vector)
print(paste("The sum of my_vector is", sum_value))
## [1] "The sum of my_vector is 50"
# Use the length() function to find the length of the vector
length_value <- length(my_vector)
print(paste("The length of my_vector is", length_value))
## [1] "The length of my_vector is 4"
# Use the sort() function to sort the vector in ascending order
sorted_vector <- sort(my_vector)
print("The sorted vector is:")
## [1] "The sorted vector is:"
print(sorted_vector)
## [1] 5 10 15 20
# Use the paste() function to concatenate two strings
string1 <- "Hello"
string2 <- "world!"
concatenated_string <- paste(string1, string2)
print(concatenated_string)
## [1] "Hello world!"