> For the complete documentation index, see [llms.txt](https://laboratory-of-lipid-metabolism-a.gitbook.io/omics-data-visualization-in-r-and-python/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://laboratory-of-lipid-metabolism-a.gitbook.io/omics-data-visualization-in-r-and-python/metabolites-and-lipids-descriptive-statistical-analysis-in-r/basic-plotting-in-r.md).

# Basic plotting in R

R is an excellent solution for producing graphics depicting descriptive statistics. Among the R packages, there are various solutions suitable for beginners, e.g., dlookr, DataExplorer, ggpubr, or ggstatsplot, which create charts via uncomplicated functions. More experienced users select libraries that offer a high level of flexibility, like ggplot2 or plotly. However, in some cases, the code can become too complex for a beginner.&#x20;

Here, we will show you how to prepare essential charts in R, which are frequently used in lipidomics and metabolomics studies. We will start every subchapter with the simplest method, progressing toward ggplot2 or plotly solution. We will begin with setting the working directory (wd) and the installation of all necessary packages:

```r
# Set your working directory through setwd("dir").
# If your files with data are on the D drive, in the "Data analysis folder," then use:
setwd("D:/Data analysis")

# Installing packages for the data visualization:
# 1. ggpubr
install.packages("ggpubr")

# 2. ggstatsplot
install.packages("ggstatsplot")

# 3. dlookr -- already installed if you follow the handbook
install.packages("devtools")
devtools::install_github("choonghyunryu/dlookr")

# 4. DataExplorer -- already installed if you follow the handbook
install.packages("DataExplorer")

# 5. plotly
install.packages("plotly")

# 6. ggplot2 -- it is a part of the tidyverse collection!
install.packages("ggplot2")
```

Here, we keep using the lipidomics data set we shared at the beginning of the Gitbook. Now, we are ready to prepare the first plots in R.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://laboratory-of-lipid-metabolism-a.gitbook.io/omics-data-visualization-in-r-and-python/metabolites-and-lipids-descriptive-statistical-analysis-in-r/basic-plotting-in-r.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
