Assessment Questions for Concept Map on Basic Syntax of an R Function

May 13, 2014 • Jon Duncan
  1. What does the following function

square = function(x) x * x

return when you enter:

square(1:4)

a.) 1

b.) 4

c.) 1, 4, 9, 16

d) 1, 16

  1. What does this function:

square.plus.y = function(x, plus.y=0)
square(x)+plus.y

return when you enter:

square.plus.y(5, 5)

a. 25

b. 20

c. 30

d. 5, 25, 625, 390625, 152587890625