speech <- c("four", "score", "and", "seven", "years", "ago", "our", "fathers",
"brought", "forth", "on", "this", "continent", "a", "new", "nation",
"conceivedl", "in", "liberty", "and", "dedicated", "to", "the",
"propostion", "that", "all", "people", "are", "created", "equal")From the speech vector, extract:
length() function?)Hint (for 6 & 7): help("Arithmetic")
Also, how many characters are in the 15th element? (Hint: help("nchar")).
What do the following command end up doing in the R console?
seq(1, 100)
seq(1, 100, by=3)
seq(1, 100, length.out=4)
rep(20:30, 2)
rep(20:30, each=2) # why is this different? help("rep")
rep(20:30, each=2, times=2)See what these do and then play with parenthseis.
TRUE | FALSE | FALSE | TRUE | TRUE | FALSE
FALSE | FALSE | FALSE | FALSE | TRUE
TRUE & FALSE & TRUE & FALSE
(TRUE | FALSE) & (TRUE & FALSE)result <- cos(sin(log(sqrt(abs(-6*3*2*1)))))result?result <- sqrt(abs(-64))can be broken down into:
step_1 <- abs(-64)
result <- sqrt(step_1)Explore:
help("Logic")help("typeof")help("class")help("double")help("character")help("integer")help("logical") (NOTE: Using T or F instead of TRUE or FALSE has the same impact on the kitten population as the use of =)help("NA")help("any")help("all")You should google for data sets in your area of interest and be prepared to talk about them in the next class.