Load data in the workspace by executing:
source("http://www3.nd.edu/~steve/computing_with_data_2014/7_Loops_etc/work_along_data_S7.R")
r <- numeric(100)
r[1] <- 0
for (i in 2:100) {
r[i] <- rnorm(1, r[i - 1], 1)
}
head(r, n = 5)
## [1] 0.0000000 -0.9707701 -0.9019612 -0.5487872 0.1724308
tail(r, n = 5)
## [1] 5.443355 2.919855 4.001404 5.264163 4.905254
Based on the above inspection of the first 5 entries and the last 5 entries, the last 5 entries continue to become more negative. Each entry is within the specified standard deviation of 1.
p1[j] should be a vector of the first entries.
N <- length(prob_L)
p1 <- character(N)
for (j in 1:N) {
p1[j] <- prob_L[[j]][1]
}
p1
## [1] "word" "A" "8" "FALSE" "yes"
p2 should be a vector of all of the second entries
N <- length(prob_L)
p2 <- character(N)
for (j in 1:N) {
p2[j] <- prob_L[[j]][2]
}
p2
## [1] "word2" "2" NA NA "no"