This is some text written in R Markdown
I can use markdown syntax here.
# some R code
1 + 2
## [1] 3
# and simple plot...
that_data = rnorm(100)
plot(density(that_data), main='a PDF...', xlab='the actual numbers',
lwd=2)
rug(that_data, col='red')
Trying new code… type Ctr + Alt + i to get the chunk
library(ggplot2)
ggplot(cars, aes(dist, speed)) + geom_point(size=2.5)
More code here… btw, type like in Latex e.g. \(\pi\) is equal to 3.14… something
# for automated time stamp in R type
# ts and then press SHIFT + Tab key
ts # you'll see the R code for this function below...
## function (data = NA, start = 1, end = numeric(), frequency = 1,
## deltat = 1, ts.eps = getOption("ts.eps"), class = if (nseries >
## 1) c("mts", "ts", "matrix") else "ts", names = if (!is.null(dimnames(data))) colnames(data) else paste("Series",
## seq(nseries)))
## {
## if (is.data.frame(data))
## data <- data.matrix(data)
## if (is.matrix(data)) {
## nseries <- ncol(data)
## ndata <- nrow(data)
## dimnames(data) <- list(NULL, names)
## }
## else {
## nseries <- 1
## ndata <- length(data)
## }
## if (ndata == 0)
## stop("'ts' object must have one or more observations")
## if (missing(frequency))
## frequency <- 1/deltat
## else if (missing(deltat))
## deltat <- 1/frequency
## if (frequency > 1 && abs(frequency - round(frequency)) <
## ts.eps)
## frequency <- round(frequency)
## if (length(start) > 1L) {
## start <- start[1L] + (start[2L] - 1)/frequency
## }
## if (length(end) > 1L) {
## end <- end[1L] + (end[2L] - 1)/frequency
## }
## if (missing(end))
## end <- start + (ndata - 1)/frequency
## else if (missing(start))
## start <- end - (ndata - 1)/frequency
## if (start > end)
## stop("'start' cannot be after 'end'")
## nobs <- floor((end - start) * frequency + 1.01)
## if (nobs != ndata)
## data <- if (NCOL(data) == 1) {
## if (ndata < nobs)
## rep_len(data, nobs)
## else if (ndata > nobs)
## data[1L:nobs]
## }
## else {
## if (ndata < nobs)
## data[rep_len(1L:ndata, nobs), ]
## else if (ndata > nobs)
## data[1L:nobs, ]
## }
## attr(data, "tsp") <- c(start, end, frequency)
## if (!is.null(class) && class[[1]] != "none")
## attr(data, "class") <- class
## data
## }
## <bytecode: 0x000000000d18cda0>
## <environment: namespace:stats>