M02-In depth Literate Programmign

Author

Jessica Garcia

Essay Prompts

Question 1:

Summarize the instructor’s lecture about Quarto that you found impressive. Do you see yourself using Quarto every day for your job or studies, such as taking notes in class or preparing a presentation? More eye-catching effects will be introduced in later modules.

After watching the instructor’s lecture, what I found impressive is that using the visual mode seems much easier to understand compared to the source mode. I also found that the slash / makes it much easier to find things like the heading, table, and much more. Before the Digital Marketing program, I had no idea Quarto existed. I see myself using Quarto much more than before. I would not say every day but often. I am eager to learn about the eye-catching effects.

Question 2: Summarize the Posit video on Quarto’s capabilities

The Posit video was very insightful and interesting. It highlighted Quarto as a powerful and flexible publishing system. it builds on ideas from R Markdown but extends them to support formats, and publishing workflows. Quarto makes it easy to create a reproducible documents that combine narrative text with executable code and results.

Question 3: Choose a previous class assignment in which you wrote a couple of pages. Copy it into Quarto and style it to make it nice. 

Intro to Function Programming

quantity <- 50

if (quantity > 20) {
  print("You sold a lot")
} else {
  print("Not enough for today")
}
[1] "You sold a lot"
category <- "A"
price <- 100

tax_rate <- 0

if (category == "A") {
  tax_rate <- 0.08
} else if (category == "B") {
  tax_rate <- 0.10
} else if (category == "C") {
  tax_rate <- 0.20
}

final_price <- price * (1 + tax_rate)

print(paste("A tax rate of", tax_rate * 100, "% is applied. The total price is", final_price))
[1] "A tax rate of 8 % is applied. The total price is 108"
q4 <- c(2, 5, 3, 9, 8, 11, 6)

even_count <- 0

for (number in q4) {
  if (number %% 2 == 0) {
    even_count <- even_count + 1
  }
}

print(even_count)
[1] 3
q5 <- 1:8

for (number in q5) {
  if (number > 4 && number %% 2 == 0) {
    print(number)
  } else {
    print("Condition not satisfied")
  }
}
[1] "Condition not satisfied"
[1] "Condition not satisfied"
[1] "Condition not satisfied"
[1] "Condition not satisfied"
[1] "Condition not satisfied"
[1] 6
[1] "Condition not satisfied"
[1] 8
pow <- function(x, y) {
  result <- x^y
  print(paste(x, "raised to the power of", y, "is", result))
}

pow(8, 2)
[1] "8 raised to the power of 2 is 64"

Question 4: Publish this assignment document in an HTML file to Quarto Pub.