HW-Q 2: Calculate \(e^2\) with appropriate code (show the code & the output as well).

exp(2)
## [1] 7.389056

HW-Q 3: Calculate the natural \(log\) of 0 and natural \(log\) of 10.

log(0, base = exp(1))
## [1] -Inf
log(10, base = exp(1))
## [1] 2.302585

HW-Q 4: Calculate the mean of \(y\) with the missing values removed. Use only the mean() function.

y = c(0, 2, NA, 3, 4, 1, 9, 0)
mean(y, na.rm = TRUE)
## [1] 2.714286

HW-Q 5: Given that,

x = 1:100

Now, for the following expression \(\sum_{i=1}^{n}ln(x_i)\)

n = 100
sum(log(x, base = exp(1)))
## [1] 363.7394

HW-Q 6: Based on the given information below:

set.seed(42)
some_vector = rnorm(100)
length(some_vector[some_vector > 1])
## [1] 17