Exam Questions and CORRECT Answers
x<-7:10 - CORRECT ANSWER - creates a vector 7 through
7 8 9 10
2^(0:10) - CORRECT ANSWER - 2 to the power of all values in a vector from 0 to 10
rm(x) - CORRECT ANSWER - removes object x
q() - CORRECT ANSWER - quit Rstudio
x<-c(3,7,9) - CORRECT ANSWER - c is combine function
379
1) x<-c("hello","world")
2) paste("hello", "world") - CORRECT ANSWER - 1) "hello" "world"
2 " hello world"
date() - CORRECT ANSWER - gives today's time and date
?paste
help(paste) - CORRECT ANSWER - help function
getwd() - CORRECT ANSWER - get work directory
setwd() - CORRECT ANSWER - set working directory
, data("CO2")
View(CO2) - CORRECT ANSWER - indicates data set of interest
view CO2 in top left pane
(CAPITAL V)
CO2$uptake - CORRECT ANSWER - only takes data from uptake column in CO2 data
5 basic object classes in R - CORRECT ANSWER - logical(T,F)
integer(1,2,3,4)
numeric(2.2 3.355, 3,pi)
complex(i, 3i, 4i)
character("A", "APPLE")
Data structures - CORRECT ANSWER - vector
matrix
data frame
factors
tables
Vector Syntax - CORRECT ANSWER - vector(class of object, length)
typeof(z) - CORRECT ANSWER - gives class of vector
"character", "numeric"
length(x) - CORRECT ANSWER - gives vector length