x <- sqrt(10)
x^3.14
## [1] 37.15352
set.seed(10)
rnorm(n = 1,mean = 1,sd =1)
## [1] 1.018746
set.seed(21)
rnorm(n = 1,mean = 1.1,sd =1)
## [1] 1.893013
lm
## function (formula, data, subset, weights, na.action, method = "qr",
## model = TRUE, x = FALSE, y = FALSE, qr = TRUE, singular.ok = TRUE,
## contrasts = NULL, offset, ...)
## {
## ret.x <- x
## ret.y <- y
## cl <- match.call()
## mf <- match.call(expand.dots = FALSE)
## m <- match(c("formula", "data", "subset", "weights", "na.action",
## "offset"), names(mf), 0L)
## mf <- mf[c(1L, m)]
## mf$drop.unused.levels <- TRUE
## mf[[1L]] <- quote(stats::model.frame)
## mf <- eval(mf, parent.frame())
## if (method == "model.frame")
## return(mf)
## else if (method != "qr")
## warning(gettextf("method = '%s' is not supported. Using 'qr'",
## method), domain = NA)
## mt <- attr(mf, "terms")
## y <- model.response(mf, "numeric")
## w <- as.vector(model.weights(mf))
## if (!is.null(w) && !is.numeric(w))
## stop("'weights' must be a numeric vector")
## offset <- model.offset(mf)
## mlm <- is.matrix(y)
## ny <- if (mlm)
## nrow(y)
## else length(y)
## if (!is.null(offset)) {
## if (!mlm)
## offset <- as.vector(offset)
## if (NROW(offset) != ny)
## stop(gettextf("number of offsets is %d, should equal %d (number of observations)",
## NROW(offset), ny), domain = NA)
## }
## if (is.empty.model(mt)) {
## x <- NULL
## z <- list(coefficients = if (mlm) matrix(NA_real_, 0,
## ncol(y)) else numeric(), residuals = y, fitted.values = 0 *
## y, weights = w, rank = 0L, df.residual = if (!is.null(w)) sum(w !=
## 0) else ny)
## if (!is.null(offset)) {
## z$fitted.values <- offset
## z$residuals <- y - offset
## }
## }
## else {
## x <- model.matrix(mt, mf, contrasts)
## z <- if (is.null(w))
## lm.fit(x, y, offset = offset, singular.ok = singular.ok,
## ...)
## else lm.wfit(x, y, w, offset = offset, singular.ok = singular.ok,
## ...)
## }
## class(z) <- c(if (mlm) "mlm", "lm")
## z$na.action <- attr(mf, "na.action")
## z$offset <- offset
## z$contrasts <- attr(x, "contrasts")
## z$xlevels <- .getXlevels(mt, mf)
## z$call <- cl
## z$terms <- mt
## if (model)
## z$model <- mf
## if (ret.x)
## z$x <- x
## if (ret.y)
## z$y <- y
## if (!qr)
## z$qr <- NULL
## z
## }
## <bytecode: 0x7fc1c6be28f8>
## <environment: namespace:stats>
set.seed(3)
x <- runif(n = 1,min = 10000,max = 10000000)
y <- rep("NA", times =x)
length(y)
## [1] 1688734
set.seed(202)
rnorm(n = 1, mean = 12.1,sd = 1)
## [1] 10.96822
set.seed(103)
sample(x = LETTERS,size = 1,replace = TRUE)
## [1] "H"
set.seed(1.011)
x1 <- rnorm(n = 10,mean = 10.1,sd = 2.1)
x2 <- rnorm(n = 10,mean = 11,sd = 2.2)
t.test(x1,x2)
##
## Welch Two Sample t-test
##
## data: x1 and x2
## t = -1.29, df = 16.071, p-value = 0.2153
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## -3.0915348 0.7518686
## sample estimates:
## mean of x mean of y
## 10.37763 11.54746
set.seed(1.10111)
x <- matrix(data = NA,nrow = runif(1,1000,10000), ncol= runif(1,1000,10000))
dim(x)
## [1] 3389 4349
set.seed(112.304)
x <- rnorm(654, 12, 10)
x[654]
## [1] 8.683049