Some of these problems are adapted from:
Jones, O., R. Maillardet, and A. Robinson. 2009. Scientific Programming and Simulation Using R. CRC Press, Boca Raton.
Suppose x = 1.1, a = 2.2, and b = 3.3. Assign each expression to the value of the variable z and print the value stored in z.
Using the rep and seq functions, create
the following vectors:
Create a vector of two random uniform numbers. In a spatial map,
these can be interpreted as x and y coordinates that
give the location of an individual (such as a marked forest tree in a
plot that has been mapped). Using one of R’s inverse trigonometry
functions (asin(), acos(), or
atan()), convert these numbers into polar coordinates (If
you don’t know what polar coordinates are, read about them on the web here,
here,
or in your calculus textbook).
Create a vector
queue <- c("sheep", "fox", "owl", "ant") where
queue represents the animals that are lined up to enter
Noah’s Ark, with the sheep at the front of the line. Using R
expressions, update queue as:
Use R to create a vector of all of the integers from 1 to 100 that are not divisible by 2, 3, or 7. You will need one of the arithmetic operators on this cheat sheet.