This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.
When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
library(data.table)
library(ggplot2)
frq_data <- fread("plink_results.frq")
ggplot(frq_data, aes(x = MAF)) +
geom_histogram(binwidth = 0.01, fill = "skyblue", color = "black") +
scale_x_continuous(breaks = seq(0, 0.5, 0.05)) +
labs(
title = "MAF分布",
x = "MAF",
y = "SNP数"
)
You can also embed plots, for example:
library(data.table)
library(ggplot2)
het_data <- fread("plink_results.het")
ggplot(het_data, aes(x = `F`)) +
geom_histogram(binwidth = 0.01, fill = "lightgreen", color = "black") +
scale_x_continuous(breaks = seq(0, 0.5, 0.05)) +
labs(
title = "F",
x = "F",
y = "個体数"
)
Note that the echo = FALSE parameter was added to the
code chunk to prevent printing of the R code that generated the
plot.