R Markdown From RSTUDIO: https://rmarkdown.rstudio.com/lesson-1.html
R Markdown: The Definitive Guide: https://bookdown.org/yihui/rmarkdown/
R for Data Science: https://r4ds.had.co.nz/
O ideal e criar em formato word e depois converter em PDF atraves do ILOVEPDF
#install.packages('tinytex')
#tinytex::install_tinytex()
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.
When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. 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
You can also embed plots, for example:
Note that the echo = FALSE parameter was added to the
code chunk to prevent printing of the R code that generated the
plot.
\[\bar{x} = \frac{\sum_{i=1}^n x_i}{n}\]
\[\bar{x} = \frac{\sum_{i=1}^n w_i x_i}{ \sum_{i=1}^n w_i}\]
\[md(X) = \left\{ \begin{array}{rr} x_{\left( \frac{n+1}{2}\right) }, & \mbox{se } n \mbox{ impar} \\ \frac{x_{\left( \frac{n}{2}\right) } + x_{\left( \frac{n}{2}+1\right) } }{2} & \mbox{se } n \mbox{ par} \end{array}\right.\]
\[var(x) = \frac{1}{n-1} \sum_{i=1}^n (x_i - \bar{x})^2\]
\[sd(x) = \sqrt{\frac{1}{n-1} \sum_{i=1}^n (x_i - \bar{x})^2}\]
\(f(x) = \frac{1}{\displaystyle \sqrt(2\pi\sigma^2)}\exp\{-\frac{1}{2 \sigma^2}(x-\mu)^2 \}\)
\[ H_0: \mu = 4 \mbox{ vs } H_a: \mu \neq 4 \]
\[ H_0: p_{ij} = p_{i} p_{j} \phantom{11} \mbox{ vs }\phantom{11} H_a: p_{ij} \neq p_{i} p{j} \]
\(f(x) = \frac{2x}{3}I(x)_{[0,1)} + (\frac{-x}{3} +1)I(x)_{[1,3)}\)
\(f(x) = cx^2I(x)_{[-1,1]}\)
\(P(10 < X < 20)\)
\(L(\theta; y)\)
\[L(\theta) = \prod_{i=1}^n f(x_i|\theta)\]
\(\chi^2\)
# ```{r}
# ```)
Os ## Regula o tamanho e defini se é titulo, subtitulo, topicos 1,2,3. Além disso é possÃvel configurar, as exibicoes do codigo digitado, escolhendo se quer mostrar o codigo no relatio, os avisos que sai ao executar comandos e regular o tipo de linguagem a ser usada. Por exeplo: {r}=Linguagem R,{python}=Linguagem Python.
É possÃvel utilizar Python dentro do Rmarkdown
Fonte: https://www.youtube.com/watch?v=gn8oJ8FMSWY
library(reticulate)
## Warning: package 'reticulate' was built under R version 4.3.2
use_python("C:/Users/william/AppData/Local/Programs/Python/Python311/python.exe")
print("Hello Python!")
## Hello Python!
import numpy as np
import matplotlib.pyplot as plt
# Gerar dados de uma distribuição normal padrão
dados = np.random.randn(10000)
# Criar histograma
plt.hist(dados, bins=50, density=True, alpha=0.7, color='blue', edgecolor='black')
# Adicionar uma curva de distribuição normal para comparação
xmin, xmax = plt.xlim()
x = np.linspace(xmin, xmax, 100)
p = np.exp(-0.5 * x**2) / np.sqrt(2 * np.pi)
plt.plot(x, p, 'k', linewidth=2)
# Personalizar o gráfico
plt.title('Histograma de uma Distribuição Normal Padrão')
plt.xlabel('Valores')
plt.ylabel('Frequência')
plt.show()