Convert TRUE to an integer
as.integer(TRUE)
[1] 1
What is the datatype of the value returned by Sys.time()?
class(Sys.time())
[1] "POSIXct" "POSIXt"
What is the datatype of the value returned by Sys.timezone()?
class(Sys.timezone())
[1] "character"
Make this quote into an R string - “Do you think this is a game?”, he said. “No, I think Jenga’s game”, Archer responded.
pi^2
pi > 3
[1] TRUE
5 > 3 & 5 <= 6
[1] TRUE
1:5 <= 3
[1] TRUE TRUE TRUE FALSE FALSE
vecA * vecB
[1] 2 6
vecA * 3
[1] 3 6
vecA * vecC
[1] 1 4 3 8 5 12
vecC * vecA
[1] 1 4 3 8 5 12
dim(iris)
[1] 150 5
nrow(iris)
[1] 150
length(iris)
[1] 5
names(iris)
[1] "Sepal.Length" "Sepal.Width" "Petal.Length" "Petal.Width" "Species"
colnames(iris)
[1] "Sepal.Length" "Sepal.Width" "Petal.Length" "Petal.Width" "Species"
rownames(iris)
[1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" "13" "14"
[15] "15" "16" "17" "18" "19" "20" "21" "22" "23" "24" "25" "26" "27" "28"
[29] "29" "30" "31" "32" "33" "34" "35" "36" "37" "38" "39" "40" "41" "42"
[43] "43" "44" "45" "46" "47" "48" "49" "50" "51" "52" "53" "54" "55" "56"
[57] "57" "58" "59" "60" "61" "62" "63" "64" "65" "66" "67" "68" "69" "70"
[71] "71" "72" "73" "74" "75" "76" "77" "78" "79" "80" "81" "82" "83" "84"
[85] "85" "86" "87" "88" "89" "90" "91" "92" "93" "94" "95" "96" "97" "98"
[99] "99" "100" "101" "102" "103" "104" "105" "106" "107" "108" "109" "110" "111" "112"
[113] "113" "114" "115" "116" "117" "118" "119" "120" "121" "122" "123" "124" "125" "126"
[127] "127" "128" "129" "130" "131" "132" "133" "134" "135" "136" "137" "138" "139" "140"
[141] "141" "142" "143" "144" "145" "146" "147" "148" "149" "150"
mylist
$`a`
[1] 1 2 3
[[2]]
[1] "A" "B" "C" "D" "E" "F" "G" "H" "I" "J" "K" "L" "M" "N" "O" "P" "Q" "R" "S" "T" "U"
[22] "V" "W" "X" "Y" "Z"
mylist[[1]]
[1] 1 2 3
mylist[[2]]
[1] "A" "B" "C" "D" "E" "F" "G" "H" "I" "J" "K" "L" "M" "N" "O" "P" "Q" "R" "S" "T" "U"
[22] "V" "W" "X" "Y" "Z"
mylist[[1]] [3]
[1] 3
mylist2[[2]][1]
$`item2a`
[1] "a" "b" "c" "d" "e"
mylist2[[2]] [[1]] [3]
[1] "c"
head(mylist2)
$`item1`
[1] 1 2 3
$item2
$item2$`item2a`
[1] "a" "b" "c" "d" "e"
$item2$item3b
[1] TRUE FALSE TRUE TRUE
str(mylist2)
List of 2
$ item1: int [1:3] 1 2 3
$ item2:List of 2
..$ item2a: chr [1:5] "a" "b" "c" "d" ...
..$ item3b: logi [1:4] TRUE FALSE TRUE TRUE
mylist2[[2]][1]
$`item2a`
[1] "a" "b" "c" "d" "e"
"a" %in% mylist2[[2]][1]
[1] FALSE