set.seed(1)   
x <- round(rnorm(10), 2)
print(x)
##  [1] -0.63  0.18 -0.84  1.60  0.33 -0.82  0.49  0.74  0.58 -0.31
plot(x)

x <- 1:10; y <- x^2; lmr <- lm(y ~ x)
co <- summary(lmr)$coefficients
print(co)
##             Estimate Std. Error   t value     Pr(>|t|)
## (Intercept)      -22  5.5497748 -3.964125 4.152962e-03
## x                 11  0.8944272 12.298374 1.777539e-06
knitr::kable(co)
Estimate Std. Error t value Pr(>|t|)
(Intercept) -22 5.5497748 -3.964125 0.0041530
x 11 0.8944272 12.298374 0.0000018
print(xtable::xtable(lmr), type='html')
## <!-- html table generated in R 4.2.0 by xtable 1.8-4 package -->
## <!-- Thu Jun  2 16:30:09 2022 -->
## <table border=1>
## <tr> <th>  </th> <th> Estimate </th> <th> Std. Error </th> <th> t value </th> <th> Pr(&gt;|t|) </th>  </tr>
##   <tr> <td align="right"> (Intercept) </td> <td align="right"> -22.0000 </td> <td align="right"> 5.5498 </td> <td align="right"> -3.96 </td> <td align="right"> 0.0042 </td> </tr>
##   <tr> <td align="right"> x </td> <td align="right"> 11.0000 </td> <td align="right"> 0.8944 </td> <td align="right"> 12.30 </td> <td align="right"> 0.0000 </td> </tr>
##    </table>
pander::pander(lmr)   ###对于中文支持不好,容易报错
Fitting linear model: y ~ x
  Estimate Std. Error t value Pr(>|t|)
(Intercept) -22 5.55 -3.964 0.004153
x 11 0.8944 12.3 1.778e-06

cat('This is 第一段, 有标签.\n')  
## This is 第一段, 有标签.
s <- 0
for(x in 1:5) s <- s + x^x
s
## [1] 3413
> sum(1:5)
[1] 15
## [1] 1 2 3 4 5
s <- 0
for (x in 1:5) {
    s <- s + x^x
    print(s)
}
## [1] 1
## [1] 5
## [1] 32
## [1] 288
## [1] 3413
sin(pi/2)
## [1] 1
cos(pi/2)
## [1] 6.123032e-17
sin(pi/2)
## [1] 1
cos(pi/2)
## [1] 6.123032e-17
sin(pi/2)
cos(pi/2)
## [1] 1
## [1] 6.123032e-17
sin(pi/2)
cos(pi/2)
sin(pi/2)

[1] 1

cos(pi/2)

[1] 6.123032e-17

print(123456789001:123456789020)
##  [1] 123456789001 123456789002 123456789003 123456789004 123456789005
##  [6] 123456789006 123456789007 123456789008 123456789009 123456789010
## [11] 123456789011 123456789012 123456789013 123456789014 123456789015
## [16] 123456789016 123456789017 123456789018 123456789019 123456789020
options(width=200)
print(123456789001:123456789020)
##  [1] 123456789001 123456789002 123456789003 123456789004 123456789005 123456789006 123456789007 123456789008 123456789009 123456789010 123456789011 123456789012 123456789013 123456789014 123456789015
## [16] 123456789016 123456789017 123456789018 123456789019 123456789020
curve(exp(-0.1*x)*sin(x), 0, 4*pi)
abline(h=0, lty=3)

curve(exp(-0.1*x)*sin(x), 0, 4*pi)
abline(h=0, lty=3)

par(mar = c(3, 3, 0.1, 0.1))
plot(1:10, ann = FALSE, las = 1)
text(5, 9, "Testing low level graphics")