Question: ALL the answers must be using R language. Create and print a vector x with all integers from 1 to 80 and a vector y

ALL the answers must be using R language.

  1. Create and print a vector x with all integers from 1 to 80 and a vector y containing multiples of 3 in the same range. Hint: use seq()function. Calculate the difference in lengths of the vectors x and y. Hint: use length().
  2. Create a new vector, x_square, with the square of elements at indices 1, 3, 5, 7, 9, 15, 20, 23, 24, and 29 from the variable x. Hint: Use indexing rather than a for loop. Calculate the mean and median of the FIRST five values from x_square.
  3. To convert factor to number, would it be correct to use the following commands? Explain your answer. factorVar <- factor(c(1, 6, 5.4, 3.2)) as.numeric(factorVar)
  4. A comma-separated values file dataset.csv consists of missing values represented by Not A Number (NaN) and question mark (?). How can you read this type of files in R?
  5. Compute n=150n!3n And n=222(3n+3n3)
  6. Describe what the following R command does: c(0:5)[NA]
  7. What is the difference between is.vector() and is.numeric() functions?

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 Mathematics Questions!