Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

What are the schemes of comparing two sets of continuous data by R language ggplot2 drawing?

Shulou Source: shulou.com Published: 2022-06-01 22:10:07 09月29日 Update

R language ggplot2 drawing to compare the two groups of continuous data of several solutions are, many novices are not very clear, in order to help you solve this problem, the following editor will explain in detail for you, people with this need can come to learn, I hope you can gain something.

The grouping comparison of continuous data is very common in scientific research life, such as the comparison of gene expression between the experimental group and the control group, the comparison of some examination indexes between the clinical patient survival group and the death group, and so on. T-test is usually used to check whether there are differences between two sets of continuous data. The data can usually be displayed in several ways, such as column chart, box line chart, violin chart, histogram, scatter chart and so on. Today's tweet introduces the ggplot2 implementation code of the above five graphics.

The following code uses three R language packs

Respectively, ggplot2 is used to draw pictures, RColorBrewer is used to generate color dplyr, and it is used to organize data.

Ggplot2 and dplyr need to be installed if they are used for the first time, the command used for installation is

Install.packages ("ggplot2")

Install.packages ("dplyr")

The first is the analog data set set.seed (1234)

Crp1

Tags: Data graphics line graphs violins histograms continuum language code objects differences methods patients grouping help testing combination clear intuitive cumbersome full Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Tech Info Docker macOS Microsoft Apple