Quarto Basics

Author

Lasya

Font Size

Font Size

Font Size

Font Size

Font Size

  • i1

  • i2

  • i3

Numeric List

  1. i1

  2. i2

Quarto

Quarto enables you to weave together content and executable code into a finished document. To learn more about Quarto see https://quarto.org.

Running Code

When you click the Render button a document will be generated that includes both content and the output of embedded code. You can embed code like this:

1 + 1
[1] 2

You can add options to executable code like this

[1] 4

The echo: false option disables the printing of code (only output is displayed).

library(tidyverse)

smaller <- diamonds |>
  filter(carat <=2.5)

smaller |>
  ggplot(aes(x=carat))+
  geom_bar(binwidth=0.01)

Figure

library(plotly)
Warning: package 'plotly' was built under R version 4.5.2

Attaching package: 'plotly'
The following object is masked from 'package:ggplot2':

    last_plot
The following object is masked from 'package:stats':

    filter
The following object is masked from 'package:graphics':

    layout
library(ggplot2)
data(economics)

plot_ly(
  data=economics,
  x= ~date,
  y= ~unemploy,
  type="scatter",
  mode="lines"
)%>%
  layout(
    xaxis=list(title="Date"),
    yaxis=list(title="Number of unemployed")
  )
plot_ly(
  data=economics,
  x= ~date,
  y= ~unemploy,
  type="scatter",
  mode="makers"
)%>%
  layout(
    xaxis=list(title="Date"),
    yaxis=list(title="Number of unemployed")
  )
plot_ly(
  data=economics,
  x= ~unemploy,
  type="histogram"
  
)
library(leaflet)
library(leaflet)

leaflet()%>%
  addTiles()%>%
  addMarkers(
    lng= -84.39,
    lat=33.75,
    popup="Atlanta"
  )

INTERaCTIVE TABLES

subcars <- mtcars[1:5,1:4]

knitr::kable(subcars,
             colnames=c("Mile/Gallon","#Cylinder","Eng Displacement", "Horsepower"),
             row.names = F,
             caption="Car Data")
Car Data
mpg cyl disp hp
21.0 6 160 110
21.0 6 160 110
22.8 4 108 93
21.4 6 258 110
18.7 8 360 175
library(DT)
datatable(mpg)