Hello R Markdown
Contents
hello
Last compiled on 09 February, 2021
testlibrary(metricsgraphics)
mjs_plot(mtcars, x = wt, y = mpg) %>% mjs_point(color_accessor = carb,
size_accessor = carb) %>% mjs_labs(x = "Weight of Car",
y = "Miles per Gallon")
## Warning in widget_html(name = class(x)[1], package = attr(x, "package"), :
## metricsgraphics_html returned an object of class `list` instead of a
## `shiny.tag`.
library("threejs")
N = 20000
theta = runif(N)*2*pi
phi = runif(N)*2*pi
R = 1.5
r = 1.0
x = (R + r*cos(theta))*cos(phi)
y = (R + r*cos(theta))*sin(phi)
z = r*sin(theta)
d = 6
h = 6
t = 2*runif(N) - 1
w = t^2*sqrt(1-t^2)
x1 = d*cos(theta)*sin(phi)*w
y1 = d*sin(theta)*sin(phi)*w
i = order(phi)
j = order(t)
col = c(rainbow(length(phi))[order(i)],
rainbow(length(t), start=0, end=2/6)[order(j)])
M = cbind(x=c(x, x1), y=c(y, y1), z=c(z, h*t))
scatterplot3js(M, size=0.1, color=col, bg="black", pch=".")
data(ego)
graphjs(ego, bg="black")
x = 42 * 2
print(x)
## 84
R Markdow
This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.
You can embed an R code chunk like this:
summary(cars)
## speed dist
## Min. : 4.0 Min. : 2.00
## 1st Qu.:12.0 1st Qu.: 26.00
## Median :15.0 Median : 36.00
## Mean :15.4 Mean : 42.98
## 3rd Qu.:19.0 3rd Qu.: 56.00
## Max. :25.0 Max. :120.00
fit <- lm(dist ~ speed, data = cars)
fit
##
## Call:
## lm(formula = dist ~ speed, data = cars)
##
## Coefficients:
## (Intercept) speed
## -17.579 3.932
Including Plots
plot(1:10,(1:10+rnorm(10)) )
# execute code if the date is later than a specified day
do_it = Sys.Date() > '2018-02-14'
x = rnorm(100)
You can also embed plots. See Figure 1 for example:
par(mar = c(0, 1, 0, 1))
pie(
c(280, 60, 20),
c('Sky', 'Sunny side of pyramid', 'Shady side of pyramid'),
col = c('#0292D8', '#F7EA39', '#C4B632'),
init.angle = -50, border = NA
)