Question: a . Construct a numeric vector named vec _ num containing the following values using the function ) . - 1 0 , - 8

a. Construct a numeric vector named vec_num containing the following values using the function ).
-10,-8,-6,-4,-2,0,10,11,12,13,14
b. Perform the following operations and print your results:
i. Raise vec_num to the power of 2.
ii. Raise e to the power of vec_num.
1
iii. Using the function rep() create a vector of 7 repeated 11 times named vec_seven. Subtract vec_seven from vec_num.
iv. Use the following code to create a vector of Boolean vector of length n=11 named vec_bool. Multiply vec_num by vec_bool.
vec_bool -c(rep(TRUE,5), rep(FALSE,6))
c. Using the seq() function with the by argument, define a vector object named vec_seq_by containing all integers between 3 and 500 that are multiples of three. Print only the first and last 10 values using the following code:
print_first_and_last(vec_seq_by)
d. Using the seq() function with the length, out argument, define an ordered vector of numbers named vec_seq_1en between 3 and 500 of length equal to the length of vec_seq_by. Print only the first and last 10 values using the following code:
print_first_and_last(yec_seq_len)
How does this vector differ from the vector in (c)?
e. Try to define a vector with the seq() vector using both the length and by arguments and comment on what happens.
a . Construct a numeric vector named vec _ num

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!