cat("R detected: ", R.version.string, "\n", sep = "")R detected: R version 4.3.2 (2023-10-31 ucrt)
This guide explains, step by step, how to install:
You need:
It is a good idea to close unnecessary programs before starting.
Open your web browser.
Go to https://cran.r-project.org.
Click Download R for Windows.
Download the latest .exe installer.
Wait for the file to finish downloading.
Open the downloaded R installer.
Click Next through the installation steps.
Click Install.
Wait for installation to complete.
Click Finish when done.
Open Command Prompt.
Type:
R --versionYou should see something like:
R version 4.x.x
versionIf R is not found:
Close Command Prompt.
Install R again from CRAN.
Open a new Command Prompt window.
Test again with:
R --versionOpen your web browser.
Download the RStudio Desktop installer for Windows.
Wait for the file to download.
Open the downloaded RStudio installer.
Click Next through the installation steps.
Click Install.
Wait for installation to complete.
Click Finish.
Open your web browser.
Download the Quarto installer for Windows.
Wait for the .exe file to download.
Open the downloaded Quarto installer.
Click Next through the installation steps.
Click Install.
Wait for installation to complete.
Click Finish.
Open Command Prompt.
Type:
quarto --versionYou should see something like:
1.x.x
Open RStudio.
Wait for the program to finish loading.
Confirm that the Console panel appears.
In the Console, type:
versionExample:
C:\Users\YourName\Documents\R-Projects
Open RStudio.
Use File > New Project or File > Open File… later when needed.
File > New File > Quarto Document
Choose HTML.
Save the file as:
test-quarto-pc.qmd
---
title: "My First Quarto Report"
format: html
---
# Hello Yahya
R, RStudio, and Quarto are working on Windows.In RStudio, open test-quarto-pc.qmd.
Click the Render button.
Wait for the HTML output to open.
Expected result:
A web page appears showing the title and the message.
In the RStudio Console, type:
install.packages("tidyverse")
install.packages("ggplot2")
install.packages("readxl")Press Enter after each line, or paste all lines together.
In the RStudio Console, type:
installed.packages()[, "Package"]Look for packages such as:
This section displays the detected R version and Quarto version when this QMD file is rendered successfully.
If this section renders correctly, then R is installed and Quarto is available to render the document.
cat("R detected: ", R.version.string, "\n", sep = "")R detected: R version 4.3.2 (2023-10-31 ucrt)
quarto_path <- Sys.which("quarto")
if (nzchar(quarto_path)) {
cat("Quarto executable: ", quarto_path, "\n", sep = "")
} else {
cat("Quarto executable: Not found in PATH\n")
}Quarto executable: C:\PROGRA~1\Quarto\bin\quarto.exe
quarto_version <- tryCatch(
system2("quarto", "--version", stdout = TRUE, stderr = TRUE),
error = function(e) paste("Could not run quarto --version:", conditionMessage(e))
)
cat("Quarto version check:\n")Quarto version check:
cat(paste(quarto_version, collapse = "\n"))1.6.40
R --version and quarto --version.R not recognizedFix:
R --versionquarto not recognizedFix:
quarto --versionFix:
Try again in the RStudio Console with:
install.packages("tidyverse")Then repeat for the other packages.
You have now completed the following:
Create a second Quarto file and add:
Then render it to HTML.