Create a numeric vector of length 10 using a selection of integers between 1 and 9. Assign the first 10 elements of the letters vector as the element names of your vector. Using this vector, do the following:

Select the first and last values of the vector.

Select all values of the vector greater than 3.

Select all values of the vector between 2 and 7.

Select all values of the vector that are not 5.

Select the "D", "E", and, "G" elements of your vector.
原题是这个,翻译有问题
x =sample(1:9, 10, replace = T)
names(x) = LETTERS[1:10]
原书链接:
https://learning.oreilly.com/library/view/sams-teach-yourself/9780134288819/ch03.html#ch03lev1sec10