Carregamento e Manipulação de Dados

# Carregando o conjunto de dados mtcars
data(mtcars)

# Ordenando os dados pela coluna mpg (milhas por galão)
mtcars <- mtcars[order(mtcars$mpg),]

# Filtrando carros com mpg maior que 20
mtcars <- mtcars[mtcars$mpg > 20,]

# Criando uma nova variável
mtcars$efficiency <- ifelse(mtcars$mpg > 20, "High", "Low")

Carregando o pacote DT

library(DT)

Criando uma tabela interativa

datatable(mtcars, options = list(pageLength = 5))

Equações LaTeX:

  • Equação Quadrática: \[ax^2 + bx + c = 0\]
  • Lei dos Cossenos: \[c^2 = a^2 + b^2 - 2ab \cos(C)\]
  • Equação de Euler: \[e^{i\pi} + 1 = 0\]
  • Fórmula de Bhaskara: \[x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}\]
  • Teorema de Pitágoras: \[a^2 + b^2 = c^2\]

Carregando o pacote ggplot2:

library(ggplot2)

# Gráfico de dispersão
ggplot(mtcars, aes(x=mpg, y=hp)) + geom_point()

# Histograma
ggplot(mtcars, aes(x=mpg)) + geom_histogram(binwidth=5)

Referências Bibliográficas:

  • Wickham, H. (2016). ggplot2: Elegant Graphics for Data Analysis. Springer-Verlag New York.
  • Xie, Y., Allaire, J.J., Grolemund, G. (2018). R Markdown: The Definitive Guide. Chapman and Hall/CRC.
  • Venables, W.N., Smith, D.M., Team, R.C. (2020). An Introduction to R. Network Theory.
  • Wickham, H., Averick, M., Bryan, J., Chang, W., McGowan, L.D., François, R., Grolemund, G., Hayes, A., Henry, L., Hester, J., Kuhn, M., Pedersen, T.L., Miller, E., Bache, S.M., Müller, K., Ooms, J., Robinson, D., Seidel, D.P., Spinu, V., Takahashi, K., Vaughan, D., Wilke, C., Woo, K., Yutani, H. (2019). Welcome to the tidyverse. Journal of Open Source Software, 4(43), 1686.
  • R Core Team (2020). R: A Language and Environment for Statistical Computing. R Foundation for Statistical Computing.