-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.Rmd
78 lines (65 loc) · 2.33 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
---
title: "README"
author: "zcp"
date: "2024-12-30"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
## corhex
corhex is an R package for generating correlation hexagon plots. It helps you quickly visualize correlations between multiple groups within the R environment, particularly suited for large-scale datasets.
## Installation
```{r}
if(!require(devtools)){install.packages("devtools")}
if(!require(spatstat.geom)){install.packages("spatstat.geom")}#dependency package
# Install corHex package from GitHub
devtools::install_github("Chuanping-Zhao/corhex")
```
## Example Data
Loading example data:
```{r}
library(corhex)
data("demo", package = "corhex")
DT::datatable(demo)
```
## Using the cor_hex Function
```{r}
result=cor_hex(dt=demo,
id.col="Index",
cor.method=c("pearson", "kendall", "spearman")[3],
savefile="outputfile",
singleplotsize=c(3,2.5),
facetplotsize=c(3*3,2.5*3),
bin=50,#Number of bins for hex plot. Default is 50.
logL=FALSE,#Whether to log-transform the data (log10). Default is TRUE.
pointcolor=c("A","B","C","D","E")[3],#Color scheme for density point plots. Options include "A", "B", "C", "D", "E". Default is "C".
pointsize=0.5,#Size of points in density point plots. Default is 0.5
kde2d.n=50,#Grid size for kernel density estimation using `MASS::kde2d`. Default is 50.
plottype=c("hex","point")[2],#Type of plot to generate: "hex" for hexagon plots, "point" for density point plots. Default is "point"
smooth.color = "black",
smooth.width = 0.5,
savePPT = FALSE
)
```
![Figure 1](Figure/facetwrapPlot_cor.png)
## Using the corpairs Function
```{r}
corpairs(dt=demo,
id.col="Index",
cor.method=c("pearson", "kendall", "spearman")[3],
savefile="Figure",
corpairplotsize=c(3*3,2.5*3),#width height
bin=50,
logL=FALSE,
plottype=c("hex","point")[2],
pointcolor=c("A","B","C","D","E")[3],
pointsize=1,
kde2d.n=50,
smooth.color = "black",
smooth.width = 0.5,
savePPT = FALSE,
density.color = "#B83677"
)
```
![Figure 2](Figure/pairsCorplot.png)