Week 2 Flashcards
‘x’ is a vector of length 10 and ‘if’ can only test a single logical statement.
The number 27 is returned
f
What is an environment in R?
a collection of symbol/value pairs
The R language uses what type of scoping rule for resolving free variables?
Lexical scoping
How are free variables in R functions resolved?
The values of free variables are searched for in the environment in which the function was defined
What is one of the consequences of the scoping rules used in R?
All objects must be stored in memory
In R, what is the parent frame?
It is the environment in which a function was called
control structures in R allow you to…
control the flow of execution of the program
if/else
testing a condition
for
execute a loop a fixed number of times
while
execute a loop while a condition is true
repeat
execute an infinite loop
break
break the execution of a loop
next
skip an interaction of a loop