potato
whose value corresponds to the number of potatos you’ve eaten in the last week. Or something equally stupid. It doesn’t matter.potato
by typing the variable name.print()
functionpotato
using the sqrt()
function.potato
hasn’t changedpotato
to potato * 2
Inf
(infinity), -Inf
(minus infinity), NaN
(“not a number”)NA
NULL
c()
c()
age
whose elements contain the ages of three people you know, where the names of each element correspond to the names of those peopleage
greater than (say) 25 (or some other number if that makes the results more interesting)age
For this exercise, we’ll use one of the data frames that comes bundled with R, rather than trying to create a new one. The airquality
data frame contains 153 cases and 6 variables. You can’t actually see it in the workspace because R is storing it in a “hidden” location (sort of).
airquality
at the command line to see what it looks like. (I won’t include the output for this in the solution set because it’s 153 lines long!)$
method to print out the Wind
variable in airquality
Wind
variableaq
that includes only the first 10 cases. Hint: typing c(1,2,3,4,5,6,7,8,9,10)
is tedious. R allows you to use 1:10
as a shorthand method!aq
where the Ozone level was higher than 20. (Note how the output deals with the NA
values)subset()
to do the same thing. Notice the difference in the output.TooWindy
variable inside aq
, which is a logical variable that is TRUE
if Windy
is greater than 10, and FALSE
otherwise"male","female","other"
rm()
.