Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write command/code for the following a) A numeric vector with values 1 to 30 and 50 to 80 (1pt) b) A numeric vector from 0
Write command/code for the following a) A numeric vector with values 1 to 30 and 50 to 80 (1pt) b) A numeric vector from 0 to 1000 where the difference between successive elements is 50 (2pt) c) A sequence where the vector c(1, 3) is repeated ten times (2pt) d) A sequence where each element of the vector c(3, 30) is repeated ten times (pt) e) Sort the numeric vector c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) in descending order (1pt) f) Reverse the numeric vector c(10, 9, 8, 7, 6, 5, 4, 3, 2, 1) (1 pt) g) Unique values of the character vector c("a", "b", "b", "c") (1pt) h) Retrieve the 34 and 6h element of the vector a = c(12, 4, 6, 73, 67, 84, 45, 74, 5, 52, 35) (2pt) 1) Retrieve all elements except the 39 and 6 element of the vector a = c(12, 4, 6, 73, 67, 84, 45, 74, 5,52,35) (2pt) D) Retrieve elements which are less than 10 in vector a = c(12, 4, 6, 73, 67, 84, 45, 74, 5, 52, 35) (2pt) k) Write a "while" loop which prints values 1 to 10 (3pt) Homework 1 1) Write a conditional if statement which prints the following (3pt) Yes if the value of variable " is equal to 3 "No" if the value of variable "t' is not equal to 3 m) What is the class of the object a in the code a = letters ? (1pt) n) Convert the character vector to c("1", "3","6") to a numeric vector (1pt) o) Convert the numeric vector to c(6, 3, 1) to a character vector (1pt) p) Generate a vector where each of its element represents rank of each element in the vector c(12, 4,6, 73, 67, 84, 45, 74, 5, 52, 35) (2pt) a) Variance of the elements in the numeric vector c(12, 4, 6, 73, 67, 84, 45, 74, 5, 52, 35) (1pt) 1) List all variables in the environment window (1pt) s) Remove all the variables in the environment window (1pt) t) Create a 3 by 3 matrix with values 1 to 9 (2pt) u) Join three multiple vectors (say, X, Y and Z) separated by an underscore symbol (1pt) v) Join elements of a vector (say, X) (1pt) w) Display the number of characters in a string (1 pt) x) Convert a string from lower case to uppercase (1pt)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started