x
with 1000 numbers.
You can use any function or operator of your choice.x = runif(1000)
length()
to verify that x
has
exactly 1000 elements.length(x)
## [1] 1000
mean(x)
## [1] 0.5012098
min(x)
## [1] 0.000440466
max(x)
## [1] 0.999839
range(x)
## [1] 0.000440466 0.999838982
x
.x[5]
## [1] 0.8802926
x
.x[6:10]
## [1] 0.8733721 0.5301184 0.9430610 0.9559014 0.7440458
my_favorites = c("vanilla", "chocolate chip", "mocha")
my_favorites
## [1] "vanilla" "chocolate chip" "mocha"
LETTERS[1:10]
## [1] "A" "B" "C" "D" "E" "F" "G" "H" "I" "J"
letters[21:26]
## [1] "u" "v" "w" "x" "y" "z"
1:10 * 2
## [1] 2 4 6 8 10 12 14 16 18 20
(1:10 * 2) - 1
## [1] 1 3 5 7 9 11 13 15 17 19
rnorm()
, saving
the results to an object called my_nums
.my_nums = rnorm(100)
my_nums
that are greater than 1.my_nums[ my_nums > 1 ]
## [1] 1.735812 1.884419 1.220173 1.080568 1.250175 1.075364 2.244210 1.459166
## [9] 1.356417 2.248809 1.219744 1.375777 1.765311 1.229856 2.069471 1.547659
## [17] 1.350288 1.013668 1.310789 1.792947 1.805619
my_nums
are greater than 1.sum(my_nums > 1)
## [1] 21
Sys.Date()
## [1] "2023-09-30"