Code Challenge 1

Do the following:

  1. Create a vector of 23 equally spaced numbers that starts at 1 and ends at 511.

  2. Find the 13th element in the vector from Part 1.

  3. Calculate the base 2 logarithm of the result from Part 2.

  4. Calculate the square root of the result from Part 3.

What is the answer to part 4?



Solution below…















# part 1
p1 <- seq(1,511,length.out=23)

# part 2
p2 <- p1[13]

# part 3
p3 <- log(p2, base=2)

# part 4
p4 <- sqrt(p3)

# answer
p4
[1] 2.850449